BIG_OPERATION_STEP, SMALL_OPERATION_STEP of pandora_db.pl to be configured through the Console. TICKET #3558.

This commit is contained in:
Hirofumi Kosaka 2016-05-27 16:37:58 +09:00
parent 60278d03f0
commit 225aef21ad
8 changed files with 50 additions and 4 deletions

View File

@ -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');

View File

@ -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');

View File

@ -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 '<form id="form_setup" method="post">';
echo "<fieldset>";
echo "<legend>" . __('Database maintenance options') . "</legend>";

View File

@ -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;
@ -795,6 +799,14 @@ function config_process_config () {
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);
}

View File

@ -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');

View File

@ -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'),

View File

@ -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'),

View File

@ -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;
@ -680,6 +681,14 @@ sub pandora_load_config ($) {
$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);
log_message ('', "Pandora DB now initialized and running (PURGE=" . $conf->{'_days_purge'} . " days, COMPACT=$conf->{'_days_compact'} days, STEP=" . $conf->{'_step_compact'} . ") . \n\n");