Another major boost improvement re #4066

Update language file as well.
This commit is contained in:
TheWitness committed 2021-02-11 19:17:24 -05:00
1 parent e2e6554cd0
commit bc60403c78
3 files changed
+2487 -905

No files matched your search

+2447 -881
View File
File diff suppressed because it is too large. Load diff
+17 -18
View File
@@ -175,8 +175,7 @@ if ($child == false) {
$tables = db_fetch_assoc("SELECT table_name AS name
FROM information_schema.tables
WHERE TABLE_SCHEMA = SCHEMA()
AND TABLE_NAME LIKE 'poller_output_boost_arch_%'
AND TABLE_ROWS = 0");
AND TABLE_NAME LIKE 'poller_output_boost_arch_%'");
if (cacti_sizeof($tables)) {
foreach($tables as $table) {
@@ -334,11 +333,11 @@ function boost_prepare_process_table() {
db_execute('TRUNCATE poller_output_boost_local_data_ids');
foreach ($arch_tables as $table) {
foreach($arch_tables as $table) {
db_execute("INSERT IGNORE INTO poller_output_boost_local_data_ids
(local_data_id)
SELECT DISTINCT local_data_id
FROM " . $table);
FROM $table");
}
$data_ids = db_fetch_cell("SELECT
@@ -547,9 +546,9 @@ function boost_output_rrd_data($child) {
$passes = ceil($total_rows / $max_per_select);
$ids_per_pass = ceil($data_ids / $passes);
$curpass = 0;
$curpass = 1;
while ($curpass <= $passes) {
while ($data_ids > 0) {
boost_debug("Processing $curpass of $passes for Boost Process $child");
$last_id = db_fetch_cell_prepared("SELECT MAX(local_data_id)
@@ -557,8 +556,8 @@ function boost_output_rrd_data($child) {
SELECT local_data_id
FROM poller_output_boost_local_data_ids
WHERE process_handler = ?
ORDER BY local_data_id
LIMIT " . (($curpass * $ids_per_pass) + 1) . ", $ids_per_pass
ORDER BY local_data_id ASC
LIMIT $ids_per_pass
) AS result",
array($child));
@@ -570,13 +569,18 @@ function boost_output_rrd_data($child) {
$curpass++;
$data_ids = db_fetch_cell_prepared('SELECT *
FROM poller_output_boost_local_data_ids
WHERE process_handler = ?',
array($child));
if (((time()-$start) > $max_run_duration) && (!$runtime_exceeded)) {
cacti_log('WARNING: RRD On Demand Updater Exceeded Runtime Limits. Continuing to Process!!!', false, 'BOOST');
$runtime_exceeded = true;
}
}
boost_debug("Processing Complete for Boost Process $child");
boost_debug("Processing Complete for Boost Process $child. It took $curpass passed to complete.");
/* log memory usage */
if (function_exists('memory_get_peak_usage')) {
@@ -864,15 +868,10 @@ function boost_process_local_data_ids($last_id, $child, $rrdtool_pipe) {
/* remove the entries from the table */
boost_timer('delete', BOOST_TIMER_START);
foreach ($archive_tables as $archive_table) {
db_execute_prepared("DELETE at
FROM $archive_table AS at
INNER JOIN poller_output_boost_local_data_ids AS bpt
ON at.local_data_id = bpt.local_data_id
WHERE bpt.local_data_id <= ?
AND bpt.process_handler = ?",
array($last_id, $child));
}
db_execute_prepared("DELETE FROM poller_output_boost_local_data_ids
WHERE local_data_id <= ?
AND process_handler = ?",
array($last_id, $child));
boost_timer('delete', BOOST_TIMER_END);
}
+23 -6
View File
@@ -2206,10 +2206,19 @@ function boost_display_run_status() {
$max_data_length = $table['MAX_DATA_LENGTH'];
}
$total_records = $pending_records + $arch_records;
$avg_row_length = ($total_records ? intval($data_length / $total_records) : 0);
$pending_ds = db_fetch_cell('SELECT COUNT(local_data_id)
FROM poller_output_boost_local_data_ids');
$total_data_sources = db_fetch_cell('SELECT COUNT(*) FROM poller_item');
$poller_items = db_fetch_cell('SELECT COUNT(local_data_id)
FROM poller_item');
$data_sources = db_fetch_cell('SELECT COUNT(id)
FROM data_local');
$pi_ds = $poller_items / $data_sources;
$remaining = $arch_records * (($pending_ds * $pi_ds) / $data_sources);
$total_records = $pending_records + $remaining;
$avg_row_length = ($total_records ? intval($data_length / $total_records) : 0);
$boost_status = read_config_option('boost_poller_status', true);
if ($boost_status != '') {
@@ -2293,14 +2302,22 @@ function boost_display_run_status() {
print '<td>' . __('Boost On-demand Updating:') . '</td><td>' . ($rrd_updates == '' ? 'Disabled' : $boost_status_text) . '</td>';
form_alternate_row();
print '<td>' . __('Total Data Sources:') . '</td><td>' . number_format_i18n($total_data_sources, -1) . '</td>';
print '<td>' . __('Total Poller Items:') . '</td><td>' . number_format_i18n($poller_items, -1) . '</td>';
$premaining = round(($pending_ds / $data_sources) * 100, 1);
if ($total_records) {
form_alternate_row();
print '<td>' . __('Pending Boost Records:') . '</td><td>' . number_format_i18n($pending_records, -1) . '</td>';
print '<td>' . __('Total Data Sources:') . '</td><td>' . number_format_i18n($data_sources, -1) . '</td>';
form_alternate_row();
print '<td>' . __('Archived Boost Records:') . '</td><td>' . number_format_i18n($arch_records, -1) . '</td>';
print '<td>' . __('Remaining Data Sources:') . '</td><td>' . ($pending_ds > 0 ? number_format_i18n($pending_ds, -1) . " ($premaining %)":__('TBD')) . '</td>';
form_alternate_row();
print '<td>' . __('Queued Boost Records:') . '</td><td>' . number_format_i18n($pending_records, -1) . '</td>';
form_alternate_row();
print '<td>' . __('Approximate in Process:') . '</td><td>' . number_format_i18n($remaining, -1) . '</td>';
form_alternate_row();
print '<td>' . __('Total Boost Records:') . '</td><td>' . number_format_i18n($total_records, -1) . '</td>';