diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2021-06-01 14:26:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-01 14:26:22 +0300 |
commit | 37bee1d197229a4de1d6eac9942fc626f1da8ee3 (patch) | |
tree | f975420d4f6cd6c47dbd5c8735a71e649041a281 /database/rrddim.c | |
parent | 0d96e0a187ee3419a9939b56970248356d05c1e7 (diff) |
Store uuid_t metric_uuid in the dimension state structure instead of uuid_t * (#11212)
Diffstat (limited to 'database/rrddim.c')
-rw-r--r-- | database/rrddim.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/database/rrddim.c b/database/rrddim.c index 510538d4b9..66650ffbf2 100644 --- a/database/rrddim.c +++ b/database/rrddim.c @@ -232,7 +232,7 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte rc += rrddim_set_multiplier(st, rd, multiplier); rc += rrddim_set_divisor(st, rd, divisor); if (rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED)) { - store_active_dimension(rd->state->metric_uuid); + store_active_dimension(&rd->state->metric_uuid); rd->state->collect_ops.init(rd); rrddim_flag_clear(rd, RRDDIM_FLAG_ARCHIVED); rrddimvar_create(rd, RRDVAR_TYPE_CALCULATED, NULL, NULL, &rd->last_stored_value, RRDVAR_OPTION_DEFAULT); @@ -242,7 +242,7 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte } if (unlikely(rc)) { debug(D_METADATALOG, "DIMENSION [%s] metadata updated", rd->id); - (void)sql_store_dimension(rd->state->metric_uuid, rd->rrdset->chart_uuid, rd->id, rd->name, rd->multiplier, rd->divisor, + (void)sql_store_dimension(&rd->state->metric_uuid, rd->rrdset->chart_uuid, rd->id, rd->name, rd->multiplier, rd->divisor, rd->algorithm); } rrdset_unlock(st); @@ -387,10 +387,10 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte rd->last_collected_time.tv_usec = 0; rd->rrdset = st; rd->state = mallocz(sizeof(*rd->state)); + (void) find_dimension_uuid(st, rd, &(rd->state->metric_uuid)); if(memory_mode == RRD_MEMORY_MODE_DBENGINE) { #ifdef ENABLE_DBENGINE - uuid_t *dim_uuid = find_dimension_uuid(st, rd); - rrdeng_metric_init(rd, dim_uuid); + rrdeng_metric_init(rd); rd->state->collect_ops.init = rrdeng_store_metric_init; rd->state->collect_ops.store_metric = rrdeng_store_metric_next; rd->state->collect_ops.finalize = rrdeng_store_metric_finalize; @@ -402,9 +402,6 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte rd->state->query_ops.oldest_time = rrdeng_metric_oldest_time; #endif } else { - rd->state->metric_uuid = find_dimension_uuid(st, rd); - if (unlikely(!rd->state->metric_uuid)) - rd->state->metric_uuid = create_dimension_uuid(rd->rrdset, rd); rd->state->collect_ops.init = rrddim_collect_init; rd->state->collect_ops.store_metric = rrddim_collect_store_metric; rd->state->collect_ops.finalize = rrddim_collect_finalize; @@ -415,7 +412,7 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte rd->state->query_ops.latest_time = rrddim_query_latest_time; rd->state->query_ops.oldest_time = rrddim_query_oldest_time; } - store_active_dimension(rd->state->metric_uuid); + store_active_dimension(&rd->state->metric_uuid); rd->state->collect_ops.init(rd); // append this dimension if(!st->dimensions) @@ -475,7 +472,7 @@ void rrddim_free_custom(RRDSET *st, RRDDIM *rd, int db_rotated) uint8_t can_delete_metric = rd->state->collect_ops.finalize(rd); if (can_delete_metric && rd->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { /* This metric has no data and no references */ - delete_dimension_uuid(rd->state->metric_uuid); + delete_dimension_uuid(&rd->state->metric_uuid); } } @@ -499,7 +496,6 @@ void rrddim_free_custom(RRDSET *st, RRDDIM *rd, int db_rotated) error("RRDDIM: INTERNAL ERROR: attempt to remove from index dimension '%s' on chart '%s', removed a different dimension.", rd->id, st->id); // free(rd->annotations); - freez(rd->state->metric_uuid); RRD_MEMORY_MODE rrd_memory_mode = rd->rrd_memory_mode; switch(rrd_memory_mode) { |