Fixed the check condition for chart name change (#9503)
Fixed the check condition for chart name change
Stelios Fragkakis committed
Jul 8, 2020 at 14:37 UTC
628598c4d5d401f41f5bb43dfb2951c0bae0703e
1 file changed
+8
-5
database/rrdset.c
+8
-5
@@ -181,7 +181,7 @@ int rrdset_set_name(RRDSET *st, const char *name) {
181
rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_IGNORE);
182
rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED);
183
184
- return 1;
184
+ return 2;
185
}
186
187
inline void rrdset_is_obsolete(RRDSET *st) {
@@ -545,12 +545,15 @@ RRDSET *rrdset_create_custom(
545
}
546
char *old_plugin = NULL, *old_module = NULL, *old_title = NULL, *old_family = NULL, *old_context = NULL,
547
*old_title_v = NULL, *old_family_v = NULL, *old_context_v = NULL;
548
- const char *new_name = name ? name : id;
548
+ int rc;
549
550
- if (unlikely((st->name && !strcmp(st->name, new_name)) || !st->name)) {
550
+ if(unlikely(name))
551
+ rc = rrdset_set_name(st, name);
552
+ else
553
+ rc = rrdset_set_name(st, id);
554
+
555
+ if (rc == 2)
556
mark_rebuild |= META_CHART_UPDATED;
552
- rrdset_set_name(st, new_name);
553
- }
557
558
if (unlikely(st->priority != priority)) {
559
st->priority = priority;