Significant improvements in arpwalk performance by adding an additional index to node_ip and reduction in database calls
This commit is contained in:
@@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
* Support for Device Details plugins (see X::RANCID)
|
* Support for Device Details plugins (see X::RANCID)
|
||||||
|
|
||||||
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
|
* Improvements in arpnip/arpwalk and macsuck/macwalk performance
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
* Respect macsuck_bleed on broken topology detection
|
* Respect macsuck_bleed on broken topology detection
|
||||||
|
|||||||
@@ -117,25 +117,21 @@ sub store_arp {
|
|||||||
|
|
||||||
schema('netdisco')->txn_do(sub {
|
schema('netdisco')->txn_do(sub {
|
||||||
my $current = schema('netdisco')->resultset('NodeIp')
|
my $current = schema('netdisco')->resultset('NodeIp')
|
||||||
->search({ip => $ip, -bool => 'active'})
|
->search(
|
||||||
->search(undef, {
|
{ ip => $ip, -bool => 'active'},
|
||||||
columns => [qw/mac ip/],
|
{ columns => [qw/mac ip/] })->update({active => \'false'});
|
||||||
order_by => [qw/mac ip/],
|
|
||||||
for => 'update'
|
|
||||||
});
|
|
||||||
$current->first; # lock rows
|
|
||||||
$current->update({active => \'false'});
|
|
||||||
|
|
||||||
schema('netdisco')->resultset('NodeIp')
|
schema('netdisco')->resultset('NodeIp')
|
||||||
->search({'me.mac' => $mac, 'me.ip' => $ip})
|
|
||||||
->update_or_create(
|
->update_or_create(
|
||||||
{
|
{
|
||||||
|
mac => $mac,
|
||||||
|
ip => $ip,
|
||||||
dns => $name,
|
dns => $name,
|
||||||
active => \'true',
|
active => \'true',
|
||||||
time_last => \$now,
|
time_last => \$now,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
order_by => [qw/mac ip/],
|
key => 'primary',
|
||||||
for => 'update',
|
for => 'update',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use base 'DBIx::Class::Schema';
|
|||||||
|
|
||||||
__PACKAGE__->load_namespaces;
|
__PACKAGE__->load_namespaces;
|
||||||
|
|
||||||
our $VERSION = 29; # schema version used for upgrades, keep as integer
|
our $VERSION = 31; # schema version used for upgrades, keep as integer
|
||||||
|
|
||||||
use Path::Class;
|
use Path::Class;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
CREATE INDEX node_ip_idx_ip_active ON node_ip (ip, active);
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
Reference in New Issue
Block a user