From 828c9534b01d9f3e72abd2064c8d4266fe339b88 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Mon, 31 Jul 2023 11:47:27 -0400 Subject: [PATCH] QA: for #5384 and #5430 For non-templated Data Sources we should keep discard the unused use. --- lib/boost.php | 22 ++++++---------------- lib/poller.php | 9 +-------- poller_boost.php | 14 +++++--------- 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/lib/boost.php b/lib/boost.php index c1fd6f5295..5f7d92374e 100644 --- a/lib/boost.php +++ b/lib/boost.php @@ -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' ); @@ -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 = ''; @@ -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' ); @@ -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 = ''; diff --git a/lib/poller.php b/lib/poller.php index 425ccba3ba..e775683b90 100644 --- a/lib/poller.php +++ b/lib/poller.php @@ -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 diff --git a/poller_boost.php b/poller_boost.php index 790a22b082..6b9b3e97a2 100755 --- a/poller_boost.php +++ b/poller_boost.php @@ -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' ); @@ -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' ); @@ -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