Skip to content

Commit

Permalink
Fixed: more fix for #5336 for boost enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ddb4github committed Jan 14, 2024
1 parent ba2e93c commit 585cba0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,10 +844,25 @@ function boost_process_poller_output($local_data_id, $rrdtool_pipe = '') {
cacti_log('The RRDpath is ' . $rrd_path, false, 'BOOST', POLLER_VERBOSITY_MEDIUM);
cacti_log('The RRDpath template is ' . $rrd_tmpl, false, 'BOOST', POLLER_VERBOSITY_MEDIUM);

$unused_data_source_names = array_rekey(
db_fetch_assoc_prepared('SELECT DISTINCT dtr.data_source_name, dtr.data_source_name
FROM data_template_rrd AS dtr
LEFT JOIN graph_templates_item AS gti
ON dtr.id = gti.task_item_id
WHERE dtr.local_data_id = ?
AND gti.task_item_id IS NULL',
array($local_data_id)),
'data_source_name', 'data_source_name'
);

boost_timer('results_cycle', BOOST_TIMER_START);

/* go through each poller_output_boost entries and process */
foreach ($results as $item) {
if (cacti_sizeof($unused_data_source_names) && isset($unused_data_source_names[$item['rrd_name']])) {
continue;
}

/**
* detect duplicate records, this should not happen,
* but adding just in case.
Expand Down
20 changes: 20 additions & 0 deletions poller_boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,13 +762,19 @@ function boost_process_local_data_ids($last_id, $child, $rrdtool_pipe) {
$last_update = -1;
$reset_template = true;

$unused_data_source_names = array();

/* we are going to blow away all record if ok */
$vals_in_buffer = 0;

boost_timer('results_cycle', BOOST_TIMER_START);

/* go through each poller_output_boost entries and process */
foreach ($results as $item) {
if ($local_data_id == $item['local_data_id'] && cacti_sizeof($unused_data_source_names) && isset($unused_data_source_names[$item['rrd_name']])) {
continue;
}

$item['timestamp'] = trim($item['timestamp']);

if (!$locked) {
Expand All @@ -789,6 +795,20 @@ function boost_process_local_data_ids($last_id, $child, $rrdtool_pipe) {
* and discover the template for the next RRDfile.
*/
if ($local_data_id != $item['local_data_id']) {
$unused_data_source_names = array_rekey(
db_fetch_assoc_prepared('SELECT DISTINCT dtr.data_source_name, dtr.data_source_name
FROM data_template_rrd AS dtr
LEFT JOIN graph_templates_item AS gti
ON dtr.id = gti.task_item_id
WHERE dtr.local_data_id = ?
AND gti.task_item_id IS NULL',
array($item['local_data_id'])),
'data_source_name', 'data_source_name'
);
if (cacti_sizeof($unused_data_source_names) && isset($unused_data_source_names[$item['rrd_name']])) {
continue;
}

$reset_template = true;

if (isset($nt_rrd_field_names)) {
Expand Down

0 comments on commit 585cba0

Please sign in to comment.