diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql index f6c5709604..02278d0ed1 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql @@ -33,4 +33,9 @@ WHERE `id` = 4 AND `id_alert_command` = 11; -- --------------------------------------------------------------------- UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria IMS API path\",\"Integria IMS API pass\",\"Integria IMS user\",\"Integria IMS user pass\",\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Email copy\",\"Ticket owner\",\"Ticket description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria IMS Ticket'; +-- --------------------------------------------------------------------- +-- Table `tconfig` +-- --------------------------------------------------------------------- +INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql index 6c32126e8d..0594afda40 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql @@ -26,3 +26,11 @@ WHERE id = 4 AND id_alert_command = 11; -- Table `talert_commands` -- --------------------------------------------------------------------- UPDATE talert_commands SET fields_descriptions = '[\"Integria IMS API path\",\"Integria IMS API pass\",\"Integria IMS user\",\"Integria IMS user pass\",\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Email copy\",\"Ticket owner\",\"Ticket description\"]', fields_values = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very Serious\",\"\",\"\",\"\"]' WHERE id = 11 AND name = 'Integria IMS Ticket'; + +-- --------------------------------------------------------------------- +-- Table `tconfig` +-- --------------------------------------------------------------------- + +INSERT INTO tconfig (token, value) VALUES ('big_operation_step_datos_purge', '100'); +INSERT INTO tconfig (token, value) VALUES ('small_operation_step_datos_purge', '1000'); + diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index 2158bcddeb..ca313b8216 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -116,6 +116,12 @@ $table_other->data[9][0] = __('Delete not init modules'); $table_other->data[9][1] = __('Yes').' '.html_print_radio_button ('delete_notinit', 1, '', $config["delete_notinit"], true).'  '; $table_other->data[9][1] .= __('No').' '.html_print_radio_button ('delete_notinit', 0, '', $config["delete_notinit"], true); +$table_other->data[10][0] = __('Big Operation Step to purge old data') . ui_print_help_tip(__('The number of blocks that a time interval is split into. A bigger value means bigger blocks, which is faster but heavier on the database. Default is 100.'), true); +$table_other->data[10][1] = html_print_input_text ('big_operation_step_datos_purge', $config["big_operation_step_datos_purge"], '', 5, 5, true); + +$table_other->data[11][0] = __('Small Operation Step to purge old data') . ui_print_help_tip(__('The number of rows that are processed in a single query in deletion. Default is 1000. Increase to 3000-5000 in fast systems. Decrease to 500 or 250 on systems with locks.'), true); +$table_other->data[11][1] = html_print_input_text ('small_operation_step_datos_purge', $config["small_operation_step_datos_purge"], '', 5, 5, true); + echo '
'; echo "
"; echo "" . __('Database maintenance options') . ""; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index bc45bc5e52..627dd1a682 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -392,6 +392,10 @@ function config_update_config () { $error_update[] = __('Max. recommended number of files in attachment directory'); if (!config_update_value ('delete_notinit', get_parameter ('delete_notinit'))) $error_update[] = __('Delete not init modules'); + if (!config_update_value ('big_operation_step_datos_purge', get_parameter ('big_operation_step_datos_purge'))) + $error_update[] = __('Big Operatiopn Step to purge old data'); + if (!config_update_value ('small_operation_step_datos_purge', get_parameter ('small_operation_step_datos_purge'))) + $error_update[] = __('Small Operation Step to purge old data'); ///////////// break; @@ -758,7 +762,7 @@ function config_process_config () { if (!isset ($config["num_files_attachment"])) { config_update_value ('num_files_attachment', 100); } - + if (!isset ($config['status_images_set'])) { config_update_value ('status_images_set', 'default'); } @@ -794,7 +798,15 @@ function config_process_config () { if (!isset ($config["delete_notinit"])) { config_update_value ('delete_notinit', 0); } - + + if (!isset ($config["big_operation_step_datos_purge"])) { + config_update_value ('big_operation_step_datos_purge', 100); + } + + if (!isset ($config["small_operation_step_datos_purge"])) { + config_update_value ('small_operation_step_datos_purge', 1000); + } + if (!isset ($config["event_purge"])) { config_update_value ('event_purge', 15); } diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql index 96616b819b..8024bb2ba8 100644 --- a/pandora_console/pandoradb.data.oracle.sql +++ b/pandora_console/pandoradb.data.oracle.sql @@ -96,6 +96,8 @@ INSERT INTO tconfig (token, value) VALUES ('audit_purge', 15); INSERT INTO tconfig (token, value) VALUES ('trap_purge', 7); INSERT INTO tconfig (token, value) VALUES ('event_purge', 7); INSERT INTO tconfig (token, value) VALUES ('gis_purge', 7); +INSERT INTO tconfig (token, value) VALUES ('big_operation_step_datos_purge', '100'); +INSERT INTO tconfig (token, value) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO tconfig (token, value) VALUES ('sound_alert', 'include/sounds/air_shock_alarm.wav'); INSERT INTO tconfig (token, value) VALUES ('sound_critical', 'include/sounds/Star_Trek_emergency_simulation.wav'); INSERT INTO tconfig (token, value) VALUES ('sound_warning', 'include/sounds/negativebeep.wav'); diff --git a/pandora_console/pandoradb.data.postgreSQL.sql b/pandora_console/pandoradb.data.postgreSQL.sql index 9ecac660f5..8ea140a1ed 100644 --- a/pandora_console/pandoradb.data.postgreSQL.sql +++ b/pandora_console/pandoradb.data.postgreSQL.sql @@ -83,6 +83,8 @@ INSERT INTO "tconfig" ("token", "value") VALUES ('trap_purge', 7), ('event_purge', 15), ('gis_purge', 15), +('big_operation_step_datos_purge', '100'), +('small_operation_step_datos_purge', '1000'), ('sound_alert', 'include/sounds/air_shock_alarm.wav'), ('sound_critical', 'include/sounds/Star_Trek_emergency_simulation.wav'), ('sound_warning', 'include/sounds/negativebeep.wav'), diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index b0608161c1..39e046f3c2 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -70,6 +70,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('trap_purge', 7), ('event_purge', 7), ('gis_purge', 7), +('big_operation_step_datos_purge', '100'), +('small_operation_step_datos_purge', '1000'), ('sound_alert', 'include/sounds/air_shock_alarm.wav'), ('sound_critical', 'include/sounds/Star_Trek_emergency_simulation.wav'), ('sound_warning', 'include/sounds/negativebeep.wav'), diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 568da131aa..d9d6de7360 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -39,10 +39,11 @@ my $version = "6.1dev PS160527"; my %conf; # Long operations are divided in XX steps for performance -my $BIG_OPERATION_STEP = 100; +my $BIG_OPERATION_STEP = 100; # 100 is default + # Each long operations has a LIMIT of SMALL_OPERATION_STEP to avoid locks. #Increate to 3000~5000 in fast systems decrease to 500 or 250 on systems with locks -my $SMALL_OPERATION_STEP = 1000; +my $SMALL_OPERATION_STEP = 1000; # 1000 is default # FLUSH in each IO $| = 1; @@ -679,6 +680,14 @@ sub pandora_load_config ($) { $conf->{'_log_dir'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'log_dir'"); $conf->{'_log_max_lifetime'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'log_max_lifetime'"); $conf->{'_delete_notinit'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'delete_notinit'"); + + $conf->{'_big_operation_step_datos_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'big_operation_step_datos_purge'"); + $conf->{'_small_operation_step_datos_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'small_operation_step_datos_purge'"); + + $BIG_OPERATION_STEP = $conf->{'_big_operation_step_datos_purge'} + if ( $conf->{'_big_operation_step_datos_purge'} ); + $SMALL_OPERATION_STEP = $conf->{'_small_operation_step_datos_purge'} + if ( $conf->{'_small_operation_step_datos_purge'} ); db_disconnect ($dbh);