@cryptotaxi247 / netdata-1 / commits / 51869f7a0

Skip sending hidden dimensions via ACLK (#11770)

* Do not send hidden dimensions to the cloud * Cleanup dimension_delete table from stale entries

Stelios Fragkakis committed Nov 11, 2021 at 12:43 UTC 51869f7a0677dc1e6e3a9ff16aedc78b67e59739
2 files changed +14 -6
database/rrdset.c
+8 -6
@@ -1807,12 +1807,14 @@ after_second_database_work:
1807 continue;
1808
1809 #if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL)
1810 - int live = ((mark - rd->last_collected_time.tv_sec) < (RRDSET_MINIMUM_LIVE_COUNT * rd->update_every));
1811 - if (unlikely(live != rd->state->aclk_live_status)) {
1812 - if (likely(rrdset_flag_check(st, RRDSET_FLAG_ACLK))) {
1813 - if (likely(!queue_dimension_to_aclk(rd))) {
1814 - rd->state->aclk_live_status = live;
1815 - rrddim_flag_set(rd, RRDDIM_FLAG_ACLK);
1810 + if (!rrddim_flag_check(rd, RRDDIM_FLAG_HIDDEN)) {
1811 + int live = ((mark - rd->last_collected_time.tv_sec) < (RRDSET_MINIMUM_LIVE_COUNT * rd->update_every));
1812 + if (unlikely(live != rd->state->aclk_live_status)) {
1813 + if (likely(rrdset_flag_check(st, RRDSET_FLAG_ACLK))) {
1814 + if (likely(!queue_dimension_to_aclk(rd))) {
1815 + rd->state->aclk_live_status = live;
1816 + rrddim_flag_set(rd, RRDDIM_FLAG_ACLK);
1817 + }
1818 }
1819 }
1820 }
database/sqlite/sqlite_aclk.c
+6
@@ -20,6 +20,10 @@ const char *aclk_sync_config[] = {
20 "(dimension_id, dimension_name, chart_type_id, dim_id, chart_id, host_id, date_created)"
21 " select old.id, old.name, c.type||\".\"||c.id, old.dim_id, old.chart_id, c.host_id, strftime('%s') FROM"
22 " chart c WHERE c.chart_id = old.chart_id; END;",
23 +
24 + "DELETE FROM dimension_delete WHERE host_id NOT IN"
25 + " (SELECT host_id FROM host) OR strftime('%s') - date_created > 604800;",
26 +
27 NULL,
28 };
29
@@ -746,6 +750,8 @@ void sql_check_aclk_table_list(struct aclk_database_worker_config *wc)
750 error_report("Query failed when trying to check for obsolete ACLK sync tables, %s", err_msg);
751 sqlite3_free(err_msg);
752 }
753 + db_execute("DELETE FROM dimension_delete WHERE host_id NOT IN (SELECT host_id FROM host) "
754 + " OR strftime('%s') - date_created > 604800;");
755 return;
756 }
757