Skip to content

Commit

Permalink
QA: for #5384 and #5430
Browse files Browse the repository at this point in the history
For non-templated Data Sources we should keep discard the unused use.
  • Loading branch information
TheWitness committed Jul 31, 2023
1 parent 7b1ae5b commit 828c953
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 33 deletions.
22 changes: 6 additions & 16 deletions lib/boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,8 @@ function boost_process_poller_output($local_data_id, $rrdtool_pipe = '') {
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',
WHERE dtr.local_data_id = ?
AND gti.task_item_id IS NULL',
array($item['local_data_id'])),
'data_source_name', 'data_source_name'
);
Expand All @@ -941,13 +942,7 @@ function boost_process_poller_output($local_data_id, $rrdtool_pipe = '') {
'data_name', 'data_source_name'
);

$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
WHERE dtr.local_data_id = ? AND gti.task_item_id IS NULL',
array($item['local_data_id'])),
'data_source_name', 'data_source_name'
);
$unused_data_source_names = array();
}

$rrd_tmpl = '';
Expand Down Expand Up @@ -1023,7 +1018,8 @@ function boost_process_poller_output($local_data_id, $rrdtool_pipe = '') {
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',
WHERE dtr.local_data_id = ?
AND gti.task_item_id IS NULL',
array($item['local_data_id'])),
'data_source_name', 'data_source_name'
);
Expand All @@ -1038,13 +1034,7 @@ function boost_process_poller_output($local_data_id, $rrdtool_pipe = '') {
'data_name', 'data_source_name'
);

$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
WHERE dtr.local_data_id = ? AND gti.task_item_id IS NULL',
array($item['local_data_id'])),
'data_source_name', 'data_source_name'
);
$unused_data_source_names = array();
}

$rrd_tmpl = '';
Expand Down
9 changes: 1 addition & 8 deletions lib/poller.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,14 +724,7 @@ function process_poller_output(&$rrdtool_pipe, $remainder = 0) {
'data_name', 'data_source_name'
);
} else {
$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
WHERE dtr.local_data_id = ?
AND gti.task_item_id IS NULL',
array($local_data_id)),
'data_source_name', 'data_source_name'
);
$unused_data_source_names = array();

$nt_rrd_field_names = array_rekey(
db_fetch_assoc_prepared('SELECT DISTINCT dtr.data_source_name, dif.data_name
Expand Down
14 changes: 5 additions & 9 deletions poller_boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,8 @@ function boost_process_local_data_ids($last_id, $child, $rrdtool_pipe) {
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',
WHERE dtr.local_data_id = ?
AND gti.task_item_id IS NULL',
array($item['local_data_id'])),
'data_source_name', 'data_source_name'
);
Expand Down Expand Up @@ -1037,7 +1038,8 @@ function boost_process_local_data_ids($last_id, $child, $rrdtool_pipe) {
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',
WHERE dtr.local_data_id = ?
AND gti.task_item_id IS NULL',
array($item['local_data_id'])),
'data_source_name', 'data_source_name'
);
Expand All @@ -1054,13 +1056,7 @@ function boost_process_local_data_ids($last_id, $child, $rrdtool_pipe) {
'data_name', 'data_source_name'
);
} else {
$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
WHERE dtr.local_data_id = ? AND gti.task_item_id IS NULL',
array($item['local_data_id'])),
'data_source_name', 'data_source_name'
);
$unused_data_source_names = array();

$nt_rrd_field_names = array_rekey(
db_fetch_assoc_prepared('SELECT DISTINCT dtr.data_source_name, dif.data_name
Expand Down

0 comments on commit 828c953

Please sign in to comment.