@cryptotaxi247 / netdata-1 / commits / 4ac52b168

Remove unused entries from structures (#10519)

* Remove compaction_id (increment the unused in rrdset structure) * Remove old_family as it is not used for detection of metadata change (due to concurrency issues it results to data corruption)

Stelios Fragkakis committed Jan 19, 2021 at 14:43 UTC 4ac52b168df03417ad1f7ce0bc54dd5888a3f921
4 files changed +3 -15
database/engine/rrdengineapi.c
-1
@@ -120,7 +120,6 @@ void rrdeng_metric_init(RRDDIM *rd, uuid_t *dim_uuid)
120 }
121 rd->state->rrdeng_uuid = &page_index->id;
122 rd->state->page_index = page_index;
123 - rd->state->compaction_id = 0;
123 }
124
125 /*
database/rrd.h
+1 -6
@@ -367,7 +367,6 @@ struct rrddim_volatile {
367 uuid_t *rrdeng_uuid; // database engine metric UUID
368 uuid_t *metric_uuid; // global UUID for this metric (unique_across hosts)
369 struct pg_cache_page_index *page_index;
370 - uint32_t compaction_id; // The last metadata log compaction procedure that has processed this object.
370 #endif
371 union rrddim_collect_handle handle;
372 // ------------------------------------------------------------------------
@@ -410,7 +409,6 @@ struct rrddim_volatile {
409 // volatile state per chart
410 struct rrdset_volatile {
411 char *old_title;
413 - char *old_family;
412 char *old_context;
413 struct label *new_labels;
414 struct label_index labels;
@@ -531,10 +529,9 @@ struct rrdset {
529 char *plugin_name; // the name of the plugin that generated this
530 char *module_name; // the name of the plugin module that generated this
531 uuid_t *chart_uuid; // Store the global GUID for this chart
534 - size_t compaction_id; // The last metadata log compaction procedure that has processed
532 // this object.
533 struct rrdset_volatile *state; // volatile state that is not persistently stored
537 - size_t unused[2];
534 + size_t unused[3];
535
536 size_t rrddim_page_alignment; // keeps metric pages in alignment when using dbengine
537
@@ -855,8 +852,6 @@ struct rrdhost {
852 #ifdef ENABLE_DBENGINE
853 struct rrdengine_instance *rrdeng_ctx; // DB engine instance for this host
854 uuid_t host_uuid; // Global GUID for this host
858 - uint32_t compaction_id; // The last metadata log compaction procedure that has processed
859 - // this object.
855 #endif
856
857 #ifdef ENABLE_HTTPS
database/rrdhost.c
-1
@@ -307,7 +307,6 @@ RRDHOST *rrdhost_create(const char *hostname,
307 }
308 else
309 error_report("Host machine GUID %s is not valid", host->machine_guid);
310 - host->compaction_id = 0;
310 char dbenginepath[FILENAME_MAX + 1];
311 int ret;
312
database/rrdset.c
+2 -7
@@ -382,7 +382,6 @@ void rrdset_free(RRDSET *st) {
382 freez(st->plugin_name);
383 freez(st->module_name);
384 freez(st->state->old_title);
385 - freez(st->state->old_family);
385 freez(st->state->old_context);
386 free_label_list(st->state->labels.head);
387 freez(st->state);
@@ -554,8 +553,8 @@ RRDSET *rrdset_create_custom(
553 changed_from_archived_to_active = 1;
554 mark_rebuild |= META_CHART_ACTIVATED;
555 }
557 - char *old_plugin = NULL, *old_module = NULL, *old_title = NULL, *old_family = NULL, *old_context = NULL,
558 - *old_title_v = NULL, *old_family_v = NULL, *old_context_v = NULL;
556 + char *old_plugin = NULL, *old_module = NULL, *old_title = NULL, *old_context = NULL,
557 + *old_title_v = NULL, *old_context_v = NULL;
558 int rc;
559
560 if(unlikely(name))
@@ -653,10 +652,8 @@ RRDSET *rrdset_create_custom(
652 freez(old_plugin);
653 freez(old_module);
654 freez(old_title);
656 - freez(old_family);
655 freez(old_context);
656 freez(old_title_v);
659 - freez(old_family_v);
657 freez(old_context_v);
658 if (mark_rebuild != META_CHART_ACTIVATED) {
659 info("Collector updated metadata for chart %s", st->id);
@@ -848,7 +845,6 @@ RRDSET *rrdset_create_custom(
845
846 st->state = callocz(1, sizeof(*st->state));
847 st->family = config_get(st->config_section, "family", family?family:st->type);
851 - st->state->old_family = strdupz(st->family);
848 json_fix_string(st->family);
849
850 st->units = config_get(st->config_section, "units", units?units:"");
@@ -936,7 +932,6 @@ RRDSET *rrdset_create_custom(
932 st->chart_uuid = create_chart_uuid(st, id, name);
933
934 store_active_chart(st->chart_uuid);
939 - st->compaction_id = 0;
935 }
936 #endif
937