From b8254f9495fee8ab38a949b0ee216f74dbc3c83f Mon Sep 17 00:00:00 2001 From: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> Date: Mon, 19 Feb 2024 17:52:51 +0200 Subject: Metric release does not need to fetch retention (#17033) metric release does not need to fetch retention --- src/database/engine/metric.c | 10 +++++++--- src/database/engine/metric.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/database/engine/metric.c b/src/database/engine/metric.c index 9922d93273..c618e22595 100644 --- a/src/database/engine/metric.c +++ b/src/database/engine/metric.c @@ -153,7 +153,7 @@ static inline REFCOUNT metric_acquire(MRG *mrg __maybe_unused, METRIC *metric) { return refcount; } -static inline bool metric_release_and_can_be_deleted(MRG *mrg __maybe_unused, METRIC *metric) { +static inline void metric_release(MRG *mrg __maybe_unused, METRIC *metric) { spinlock_lock(&metric->refcount_spinlock); if (metric->refcount <= 0) @@ -169,6 +169,10 @@ static inline bool metric_release_and_can_be_deleted(MRG *mrg __maybe_unused, ME __atomic_sub_fetch(&mrg->index[partition].stats.entries_referenced, 1, __ATOMIC_RELAXED); __atomic_sub_fetch(&mrg->index[partition].stats.current_references, 1, __ATOMIC_RELAXED); +} + +static inline bool metric_release_and_can_be_deleted(MRG *mrg __maybe_unused, METRIC *metric) { + metric_release(mrg, metric); time_t first, last; mrg_metric_get_retention(mrg, metric, &first, &last, NULL); @@ -376,8 +380,8 @@ inline METRIC *mrg_metric_dup(MRG *mrg, METRIC *metric) { return metric; } -inline bool mrg_metric_release(MRG *mrg, METRIC *metric) { - return metric_release_and_can_be_deleted(mrg, metric); +inline void mrg_metric_release(MRG *mrg, METRIC *metric) { + metric_release(mrg, metric); } inline Word_t mrg_metric_id(MRG *mrg __maybe_unused, METRIC *metric) { diff --git a/src/database/engine/metric.h b/src/database/engine/metric.h index 6e8facf4fa..8fed08abbf 100644 --- a/src/database/engine/metric.h +++ b/src/database/engine/metric.h @@ -52,7 +52,7 @@ MRG *mrg_create(ssize_t partitions); void mrg_destroy(MRG *mrg); METRIC *mrg_metric_dup(MRG *mrg, METRIC *metric); -bool mrg_metric_release(MRG *mrg, METRIC *metric); +void mrg_metric_release(MRG *mrg, METRIC *metric); METRIC *mrg_metric_add_and_acquire(MRG *mrg, MRG_ENTRY entry, bool *ret); METRIC *mrg_metric_get_and_acquire(MRG *mrg, uuid_t *uuid, Word_t section); -- cgit v1.2.3