summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2021-11-08 14:29:34 +0200
committerGitHub <noreply@github.com>2021-11-08 14:29:34 +0200
commit989c68cac8ae800e369ceac1abc825846982ff34 (patch)
tree34fe48215174379cc7140280a02fd7e5a562c0ea /database
parent6206095944e6418edb2a10e582aa81cc9f9bd8cb (diff)
Fix retention messages (#11762)
Diffstat (limited to 'database')
-rw-r--r--database/sqlite/sqlite_aclk_chart.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/database/sqlite/sqlite_aclk_chart.c b/database/sqlite/sqlite_aclk_chart.c
index 428893c0f0..cc1cb028d9 100644
--- a/database/sqlite/sqlite_aclk_chart.c
+++ b/database/sqlite/sqlite_aclk_chart.c
@@ -768,7 +768,11 @@ void aclk_update_retention(struct aclk_database_worker_config *wc, struct aclk_d
if (!update_every || update_every != (uint32_t) sqlite3_column_int(res, 1)) {
if (update_every) {
debug(D_ACLK_SYNC,"Update %s for %u oldest time = %ld", wc->host_guid, update_every, start_time);
- rotate_data.interval_durations[rotate_data.interval_duration_count].retention = rotate_data.rotation_timestamp.tv_sec - start_time;
+ if (start_time == LONG_MAX)
+ rotate_data.interval_durations[rotate_data.interval_duration_count].retention = 0;
+ else
+ rotate_data.interval_durations[rotate_data.interval_duration_count].retention =
+ rotate_data.rotation_timestamp.tv_sec - start_time;
rotate_data.interval_duration_count++;
}
update_every = (uint32_t) sqlite3_column_int(res, 1);
@@ -813,16 +817,19 @@ void aclk_update_retention(struct aclk_database_worker_config *wc, struct aclk_d
}
if (update_every) {
debug(D_ACLK_SYNC, "Update %s for %u oldest time = %ld", wc->host_guid, update_every, start_time);
- rotate_data.interval_durations[rotate_data.interval_duration_count].retention = rotate_data.rotation_timestamp.tv_sec - start_time;
+ if (start_time == LONG_MAX)
+ rotate_data.interval_durations[rotate_data.interval_duration_count].retention = 0;
+ else
+ rotate_data.interval_durations[rotate_data.interval_duration_count].retention =
+ rotate_data.rotation_timestamp.tv_sec - start_time;
rotate_data.interval_duration_count++;
}
- for (int i = 0; i < rotate_data.interval_duration_count; ++i) {
#ifdef NETDATA_INTERNAL_CHECKS
- info("%d --> Update %s for %u Retention = %u", i, wc->host_guid,
+ for (int i = 0; i < rotate_data.interval_duration_count; ++i)
+ info("Update for host %s (node %s) for %u Retention = %u", wc->host_guid, wc->node_id,
rotate_data.interval_durations[i].update_every, rotate_data.interval_durations[i].retention);
#endif
- };
aclk_retention_updated(&rotate_data);
freez(rotate_data.node_id);
freez(rotate_data.interval_durations);