diff options
-rw-r--r-- | database/rrdset.c | 14 | ||||
-rw-r--r-- | database/sqlite/sqlite_aclk.c | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/database/rrdset.c b/database/rrdset.c index 75696d8f85..25f0bcb7dc 100644 --- a/database/rrdset.c +++ b/database/rrdset.c @@ -1807,12 +1807,14 @@ after_second_database_work: continue; #if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) - int live = ((mark - rd->last_collected_time.tv_sec) < (RRDSET_MINIMUM_LIVE_COUNT * rd->update_every)); - if (unlikely(live != rd->state->aclk_live_status)) { - if (likely(rrdset_flag_check(st, RRDSET_FLAG_ACLK))) { - if (likely(!queue_dimension_to_aclk(rd))) { - rd->state->aclk_live_status = live; - rrddim_flag_set(rd, RRDDIM_FLAG_ACLK); + if (!rrddim_flag_check(rd, RRDDIM_FLAG_HIDDEN)) { + int live = ((mark - rd->last_collected_time.tv_sec) < (RRDSET_MINIMUM_LIVE_COUNT * rd->update_every)); + if (unlikely(live != rd->state->aclk_live_status)) { + if (likely(rrdset_flag_check(st, RRDSET_FLAG_ACLK))) { + if (likely(!queue_dimension_to_aclk(rd))) { + rd->state->aclk_live_status = live; + rrddim_flag_set(rd, RRDDIM_FLAG_ACLK); + } } } } diff --git a/database/sqlite/sqlite_aclk.c b/database/sqlite/sqlite_aclk.c index dedba6159d..5af3607555 100644 --- a/database/sqlite/sqlite_aclk.c +++ b/database/sqlite/sqlite_aclk.c @@ -20,6 +20,10 @@ const char *aclk_sync_config[] = { "(dimension_id, dimension_name, chart_type_id, dim_id, chart_id, host_id, date_created)" " select old.id, old.name, c.type||\".\"||c.id, old.dim_id, old.chart_id, c.host_id, strftime('%s') FROM" " chart c WHERE c.chart_id = old.chart_id; END;", + + "DELETE FROM dimension_delete WHERE host_id NOT IN" + " (SELECT host_id FROM host) OR strftime('%s') - date_created > 604800;", + NULL, }; @@ -746,6 +750,8 @@ void sql_check_aclk_table_list(struct aclk_database_worker_config *wc) error_report("Query failed when trying to check for obsolete ACLK sync tables, %s", err_msg); sqlite3_free(err_msg); } + db_execute("DELETE FROM dimension_delete WHERE host_id NOT IN (SELECT host_id FROM host) " + " OR strftime('%s') - date_created > 604800;"); return; } |