2011-11-15 Sancho Lerena <slerena@artica.es>

* util/pandora_db.pl: Small optimization in module deletion. Instead
        delete module data, left in there to be deleted on "timestamp" deletion.
        This is like 100 times faster!.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5134 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2011-11-14 23:47:47 +00:00
parent 4ce316397c
commit dfdc527e53
2 changed files with 8 additions and 24 deletions

View File

@ -1,3 +1,9 @@
2011-11-15 Sancho Lerena <slerena@artica.es>
* util/pandora_db.pl: Small optimization in module deletion. Instead
delete module data, left in there to be deleted on "timestamp" deletion.
This is like 100 times faster!.
2011-11-14 Sergio Martin <sergio.martin@artica.es>
* util/pandora_manage.pl: Moved to functions each command bit of code

View File

@ -30,7 +30,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "4.0 PS110810";
my $version = "4.0.1 PS111115";
# Pandora server configuration
my %conf;
@ -201,34 +201,12 @@ sub pandora_purgedb ($$) {
print " Deleting data for module " . $id_module . "\n";
while(1) {
my $nd = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module);
my $ndinc = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module);
my $ndlog4x = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module);
my $ndstring = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module);
my $nstate = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_estado WHERE id_agente_modulo=?', $id_module);
my $ntot = $nd + $ndinc + $ndlog4x + $ndstring + $nstate;
if($ntot == 0) {
if($nstate == 0) {
last;
}
if($nd > 0) {
db_do ($dbh, 'DELETE FROM tagente_datos WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer);
}
if($ndinc > 0) {
db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer);
}
if($ndlog4x > 0) {
db_do ($dbh, 'DELETE FROM tagente_datos_log4x WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer);
}
if($ndstring > 0) {
db_do ($dbh, 'DELETE FROM tagente_datos_string WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer);
}
if($nstate > 0) {
db_do ($dbh, 'DELETE FROM tagente_estado WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer);
}