Avoid pathological delete mac for millions of nodes (S. Xu)
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
* [#279] Web sessions use cookies instead of files on disk (M. Johnson)
|
* [#279] Web sessions use cookies instead of files on disk (M. Johnson)
|
||||||
* Strip realm from username (B. Marshall)
|
* Strip realm from username (B. Marshall)
|
||||||
* Mention netdisco-users mail list in docs (C. Goldsmith)
|
* Mention netdisco-users mail list in docs (C. Goldsmith)
|
||||||
|
* Avoid pathological delete mac for millions of nodes (S. Xu)
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
|
|||||||
@@ -115,21 +115,21 @@ sub delete {
|
|||||||
NodeIp
|
NodeIp
|
||||||
NodeNbt
|
NodeNbt
|
||||||
/) {
|
/) {
|
||||||
$schema->resultset($set)->search({
|
$schema->resultset($set)->search({
|
||||||
'-and' => [
|
'me.mac' => { '-in' => $schema->resultset($set)->search({
|
||||||
'me.mac' => { '-in' => $nodes->as_query },
|
'-and' => [
|
||||||
'me.mac' => { '-in' => $schema->resultset($set)->search({
|
-bool => 'nodes.active',
|
||||||
-bool => 'nodes.active',
|
'me.mac' => { '-in' => $nodes->as_query }
|
||||||
},
|
]
|
||||||
{
|
},
|
||||||
columns => 'mac',
|
{
|
||||||
join => 'nodes',
|
columns => 'mac',
|
||||||
group_by => 'me.mac',
|
join => 'nodes',
|
||||||
having => \[ 'count(nodes.mac) = 0' ],
|
group_by => 'me.mac',
|
||||||
})->as_query,
|
having => \[ 'count(nodes.mac) = 0' ],
|
||||||
},
|
})->as_query,
|
||||||
],
|
},
|
||||||
})->delete;
|
})->delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $set (qw/
|
foreach my $set (qw/
|
||||||
|
|||||||
Reference in New Issue
Block a user