ORDER BY ... FOR UPDATE will allow us to avoid table lock
This commit is contained in:
@@ -8,7 +8,6 @@ use App::Netdisco::Util::DNS ':all';
|
|||||||
use NetAddr::IP::Lite ':lower';
|
use NetAddr::IP::Lite ':lower';
|
||||||
use Time::HiRes 'gettimeofday';
|
use Time::HiRes 'gettimeofday';
|
||||||
use Net::MAC;
|
use Net::MAC;
|
||||||
use Try::Tiny;
|
|
||||||
|
|
||||||
use base 'Exporter';
|
use base 'Exporter';
|
||||||
our @EXPORT = ();
|
our @EXPORT = ();
|
||||||
@@ -61,7 +60,7 @@ sub do_arpnip {
|
|||||||
my $now = join '.', gettimeofday;
|
my $now = join '.', gettimeofday;
|
||||||
|
|
||||||
# update node_ip with ARP and Neighbor Cache entries
|
# update node_ip with ARP and Neighbor Cache entries
|
||||||
# TODO: find out whether FOR UPDATE would be suitable instead of table lock
|
# TODO: ORDER BY ... FOR UPDATE will allow us to avoid the table lock
|
||||||
schema('netdisco')->resultset('NodeIp')->txn_do_locked(
|
schema('netdisco')->resultset('NodeIp')->txn_do_locked(
|
||||||
EXCLUSIVE, sub {
|
EXCLUSIVE, sub {
|
||||||
_store_arp(@$_, $now) for @v4;
|
_store_arp(@$_, $now) for @v4;
|
||||||
|
|||||||
Reference in New Issue
Block a user