summaryrefslogtreecommitdiffstats
path: root/src/database/rrddim.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:33:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:34:10 +0000
commit83ba6762cc43d9db581b979bb5e3445669e46cc2 (patch)
tree2e69833b43f791ed253a7a20318b767ebe56cdb8 /src/database/rrddim.c
parentReleasing debian version 1.47.5-1. (diff)
downloadnetdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.tar.xz
netdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.zip
Merging upstream version 2.0.3+dfsg (Closes: #923993, #1042533, #1045145).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/database/rrddim.c')
-rw-r--r--src/database/rrddim.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/database/rrddim.c b/src/database/rrddim.c
index 580319d30..7b98b64d0 100644
--- a/src/database/rrddim.c
+++ b/src/database/rrddim.c
@@ -41,6 +41,13 @@ static void rrddim_insert_callback(const DICTIONARY_ITEM *item __maybe_unused, v
RRDSET *st = ctr->st;
RRDHOST *host = st->rrdhost;
+ rd->dimension_id = __atomic_add_fetch(&host->accounting.dimension_count, 1, __ATOMIC_RELAXED);
+ spinlock_lock(&host->accounting.spinlock);
+ Pvoid_t *Pvalue = JudyLIns(&host->accounting.JudyL, rd->dimension_id, PJE0);
+ if (Pvalue)
+ *Pvalue = rd;
+ spinlock_unlock(&host->accounting.spinlock);
+
rd->flags = RRDDIM_FLAG_NONE;
rd->id = string_strdupz(ctr->id);
@@ -231,6 +238,10 @@ static void rrddim_delete_callback(const DICTIONARY_ITEM *item __maybe_unused, v
freez(rd->db.data);
}
+ spinlock_lock(&host->accounting.spinlock);
+ (void) JudyLDel(&host->accounting.JudyL, rd->dimension_id, PJE0);
+ spinlock_unlock(&host->accounting.spinlock);
+
string_freez(rd->id);
string_freez(rd->name);
}
@@ -557,6 +568,12 @@ collected_number rrddim_timed_set_by_pointer(RRDSET *st __maybe_unused, RRDDIM *
rrddim_set_updated(rd);
rd->collector.counter++;
+// spinlock_lock(&st->rrdhost->accounting.spinlock);
+// Pvoid_t *Pvalue = JudyLIns(&st->rrdhost->accounting.JudySecL, (Word_t) collected_time.tv_sec, PJE0);
+// if (Pvalue)
+// *((int64_t *)Pvalue) = *((int64_t *)Pvalue) + 1;
+// spinlock_unlock(&st->rrdhost->accounting.spinlock);
+
collected_number v = (value >= 0) ? value : -value;
if (unlikely(v > rd->collector.collected_value_max))
rd->collector.collected_value_max = v;