diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2023-01-20 16:32:50 +0200 |
---|---|---|
committer | Costa Tsaousis <costa@netdata.cloud> | 2023-01-20 16:32:50 +0200 |
commit | 997b9c813b290882ba18a8c44bf73f9ee5480adf (patch) | |
tree | 8c4bd4ea2e15c6b0e0a531fb57ebddb07ce7a308 | |
parent | 4afa6461fcce859d03f1c9cf56dd3b5933ee5ebc (diff) |
Revert "first search for a metric then add it if it does not exist"
This reverts commit 4afa6461fcce859d03f1c9cf56dd3b5933ee5ebc.
-rw-r--r-- | database/engine/journalfile.c | 26 | ||||
-rwxr-xr-x | database/engine/rrdengineapi.c | 2 |
2 files changed, 12 insertions, 16 deletions
diff --git a/database/engine/journalfile.c b/database/engine/journalfile.c index 78837df293..43c52c6454 100644 --- a/database/engine/journalfile.c +++ b/database/engine/journalfile.c @@ -17,7 +17,7 @@ static void update_metric_retention_and_granularity_by_uuid( last_time_s = now_s; } - if (unlikely(first_time_s > last_time_s)) { + if(unlikely(first_time_s > last_time_s)) { error_limit_static_global_var(erl, 1, 0); error_limit(&erl, "DBENGINE JV2: wrong first time on-disk (%ld - %ld, now %ld), " "fixing first time to last time", @@ -26,25 +26,23 @@ static void update_metric_retention_and_granularity_by_uuid( first_time_s = last_time_s; } - if (unlikely(first_time_s == 0 || last_time_s == 0)) { + if(unlikely(first_time_s == 0 || last_time_s == 0)) { error_limit_static_global_var(erl, 1, 0); error_limit(&erl, "DBENGINE JV2: zero on-disk timestamps (%ld - %ld, now %ld), " "using them as-is", first_time_s, last_time_s, now_s); } - bool added = false; - METRIC *metric = mrg_metric_get_and_acquire(main_mrg, uuid, (Word_t) ctx); - if (!metric) { - MRG_ENTRY entry = { - .section = (Word_t) ctx, - .first_time_s = first_time_s, - .last_time_s = last_time_s, - .latest_update_every_s = update_every_s - }; - uuid_copy(entry.uuid, *uuid); - metric = mrg_metric_add_and_acquire(main_mrg, entry, &added); - } + MRG_ENTRY entry = { + .section = (Word_t)ctx, + .first_time_s = first_time_s, + .last_time_s = last_time_s, + .latest_update_every_s = update_every_s + }; + uuid_copy(entry.uuid, *uuid); + + bool added; + METRIC *metric = mrg_metric_add_and_acquire(main_mrg, entry, &added); if (likely(!added)) mrg_metric_expand_retention(main_mrg, metric, first_time_s, last_time_s, update_every_s); diff --git a/database/engine/rrdengineapi.c b/database/engine/rrdengineapi.c index b044e05989..ee4853a54c 100755 --- a/database/engine/rrdengineapi.c +++ b/database/engine/rrdengineapi.c @@ -868,8 +868,6 @@ static void rrdeng_populate_mrg(struct rrdengine_instance *ctx) { if(cpus > (size_t)libuv_worker_threads) cpus = (size_t)libuv_worker_threads; - info("DBENGINE: populating retention to MRG from %zu journal files of tier %d, using %zu threads...", datafiles, ctx->tier, cpus); - struct completion cs[cpus]; for (size_t i = 0; i < cpus; i++) { |