diff --git a/Netdisco/Changes b/Netdisco/Changes index 49cc06a0..ba149ef7 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -4,6 +4,10 @@ * Support for Device Details plugins (see X::RANCID) + [ENHANCEMENTS] + + * Improvements in arpnip/arpwalk and macsuck/macwalk performance + [BUG FIXES] * Respect macsuck_bleed on broken topology detection diff --git a/Netdisco/lib/App/Netdisco/Core/Arpnip.pm b/Netdisco/lib/App/Netdisco/Core/Arpnip.pm index ea39ca62..17ba23dc 100644 --- a/Netdisco/lib/App/Netdisco/Core/Arpnip.pm +++ b/Netdisco/lib/App/Netdisco/Core/Arpnip.pm @@ -117,25 +117,21 @@ sub store_arp { schema('netdisco')->txn_do(sub { my $current = schema('netdisco')->resultset('NodeIp') - ->search({ip => $ip, -bool => 'active'}) - ->search(undef, { - columns => [qw/mac ip/], - order_by => [qw/mac ip/], - for => 'update' - }); - $current->first; # lock rows - $current->update({active => \'false'}); + ->search( + { ip => $ip, -bool => 'active'}, + { columns => [qw/mac ip/] })->update({active => \'false'}); schema('netdisco')->resultset('NodeIp') - ->search({'me.mac' => $mac, 'me.ip' => $ip}) ->update_or_create( { + mac => $mac, + ip => $ip, dns => $name, active => \'true', time_last => \$now, }, { - order_by => [qw/mac ip/], + key => 'primary', for => 'update', }); }); diff --git a/Netdisco/lib/App/Netdisco/DB.pm b/Netdisco/lib/App/Netdisco/DB.pm index 4b2a1ea1..abbc8377 100644 --- a/Netdisco/lib/App/Netdisco/DB.pm +++ b/Netdisco/lib/App/Netdisco/DB.pm @@ -8,7 +8,7 @@ use base 'DBIx::Class::Schema'; __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 File::Basename; diff --git a/Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-30-31-PostgreSQL.sql b/Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-30-31-PostgreSQL.sql new file mode 100644 index 00000000..4db119d7 --- /dev/null +++ b/Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-30-31-PostgreSQL.sql @@ -0,0 +1,6 @@ + +BEGIN; + +CREATE INDEX node_ip_idx_ip_active ON node_ip (ip, active); + +COMMIT;