summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorEmmanuel Vasilakis <mrzammler@mm.st>2023-09-06 11:35:53 +0300
committerGitHub <noreply@github.com>2023-09-06 11:35:53 +0300
commitf059f4da7d04deecbf1b40f2c585cd58f45debe4 (patch)
tree7af47382b5c4bdc7ab14360af40c6018b130a1fd /database
parent5c132e4ec8dce371352a1a7f97d6170e98d6b82e (diff)
Reset the obsolete flag on service thread (#15892)
* reset the RRDHOST_FLAG_PENDING_OBSOLETE_CHARTS flag * do rrdset_free even when in dbengine mode * remove RRDSET_FLAG_ARCHIVED * remove commented line * use is_available_for_viewers
Diffstat (limited to 'database')
-rw-r--r--database/contexts/instance.c2
-rw-r--r--database/rrd.h15
-rw-r--r--database/rrdset.c10
3 files changed, 4 insertions, 23 deletions
diff --git a/database/contexts/instance.c b/database/contexts/instance.c
index 0c1dbf4c49..8a60ce6624 100644
--- a/database/contexts/instance.c
+++ b/database/contexts/instance.c
@@ -494,7 +494,7 @@ inline void rrdinstance_updated_rrdset_flags(RRDSET *st) {
RRDINSTANCE *ri = rrdset_get_rrdinstance(st);
if(unlikely(!ri)) return;
- if(unlikely(rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED|RRDSET_FLAG_OBSOLETE)))
+ if(unlikely(rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE)))
rrd_flag_set_archived(ri);
rrdinstance_updated_rrdset_flags_no_action(ri, st);
diff --git a/database/rrd.h b/database/rrd.h
index baa3f4ab79..9ff838559c 100644
--- a/database/rrd.h
+++ b/database/rrd.h
@@ -693,9 +693,7 @@ typedef enum __attribute__ ((__packed__)) rrdset_flags {
RRDSET_FLAG_HIDDEN = (1 << 12), // if set, do not show this chart on the dashboard, but use it for exporting
RRDSET_FLAG_SYNC_CLOCK = (1 << 13), // if set, microseconds on next data collection will be ignored (the chart will be synced to now)
RRDSET_FLAG_OBSOLETE_DIMENSIONS = (1 << 14), // this is marked by the collector/module when a chart has obsolete dimensions
- // No new values have been collected for this chart since agent start, or it was marked RRDSET_FLAG_OBSOLETE at
- // least rrdset_free_obsolete_time seconds ago.
- RRDSET_FLAG_ARCHIVED = (1 << 15),
+
RRDSET_FLAG_METADATA_UPDATE = (1 << 16), // Mark that metadata needs to be stored
RRDSET_FLAG_ANOMALY_DETECTION = (1 << 18), // flag to identify anomaly detection charts.
RRDSET_FLAG_INDEXED_ID = (1 << 19), // the rrdset is indexed by its id
@@ -1403,8 +1401,6 @@ void rrdset_acquired_release(RRDSET_ACQUIRED *rsa);
static inline RRDSET *rrdset_find_active_localhost(const char *id)
{
RRDSET *st = rrdset_find_localhost(id);
- if (unlikely(st && rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED)))
- return NULL;
return st;
}
@@ -1414,8 +1410,6 @@ RRDSET *rrdset_find_bytype(RRDHOST *host, const char *type, const char *id);
static inline RRDSET *rrdset_find_active_bytype_localhost(const char *type, const char *id)
{
RRDSET *st = rrdset_find_bytype_localhost(type, id);
- if (unlikely(st && rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED)))
- return NULL;
return st;
}
@@ -1425,8 +1419,6 @@ RRDSET *rrdset_find_byname(RRDHOST *host, const char *name);
static inline RRDSET *rrdset_find_active_byname_localhost(const char *name)
{
RRDSET *st = rrdset_find_byname_localhost(name);
- if (unlikely(st && rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED)))
- return NULL;
return st;
}
@@ -1442,9 +1434,8 @@ void rrdset_is_obsolete(RRDSET *st);
void rrdset_isnot_obsolete(RRDSET *st);
// checks if the RRDSET should be offered to viewers
-#define rrdset_is_available_for_viewers(st) (!rrdset_flag_check(st, RRDSET_FLAG_HIDDEN) && !rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && !rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED) && rrdset_number_of_dimensions(st) && (st)->rrd_memory_mode != RRD_MEMORY_MODE_NONE)
-#define rrdset_is_available_for_exporting_and_alarms(st) (!rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && !rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED) && rrdset_number_of_dimensions(st))
-#define rrdset_is_archived(st) (rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED) && rrdset_number_of_dimensions(st))
+#define rrdset_is_available_for_viewers(st) (!rrdset_flag_check(st, RRDSET_FLAG_HIDDEN) && !rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && rrdset_number_of_dimensions(st) && (st)->rrd_memory_mode != RRD_MEMORY_MODE_NONE)
+#define rrdset_is_available_for_exporting_and_alarms(st) (!rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && rrdset_number_of_dimensions(st))
time_t rrddim_first_entry_s(RRDDIM *rd);
time_t rrddim_first_entry_s_of_tier(RRDDIM *rd, size_t tier);
diff --git a/database/rrdset.c b/database/rrdset.c
index 1e00d5c8a2..285e2bfda1 100644
--- a/database/rrdset.c
+++ b/database/rrdset.c
@@ -292,11 +292,6 @@ static bool rrdset_conflict_callback(const DICTIONARY_ITEM *item __maybe_unused,
ctr->react_action = RRDSET_REACT_NONE;
- if (rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED)) {
- rrdset_flag_clear(st, RRDSET_FLAG_ARCHIVED);
- ctr->react_action |= RRDSET_REACT_CHART_ACTIVATED;
- }
-
if (rrdset_reset_name(st, (ctr->name && *ctr->name) ? ctr->name : ctr->id) == 2)
ctr->react_action |= RRDSET_REACT_UPDATED;
@@ -657,11 +652,6 @@ void rrdset_get_retention_of_tier_for_collected_chart(RRDSET *st, time_t *first_
}
inline void rrdset_is_obsolete(RRDSET *st) {
- if(unlikely(rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED))) {
- netdata_log_info("Cannot obsolete already archived chart %s", rrdset_name(st));
- return;
- }
-
if(unlikely(!(rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE)))) {
rrdset_flag_set(st, RRDSET_FLAG_OBSOLETE);
rrdhost_flag_set(st->rrdhost, RRDHOST_FLAG_PENDING_OBSOLETE_CHARTS);