Fixed the check condition for chart name change (#9503)

Fixed the check condition for chart name change
This commit is contained in:
Stelios Fragkakis 2020-07-08 14:37:58 +03:00 committed by GitHub
parent 1bc242d937
commit 628598c4d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -181,7 +181,7 @@ int rrdset_set_name(RRDSET *st, const char *name) {
rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_IGNORE);
rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED);
return 1;
return 2;
}
inline void rrdset_is_obsolete(RRDSET *st) {
@ -545,12 +545,15 @@ RRDSET *rrdset_create_custom(
}
char *old_plugin = NULL, *old_module = NULL, *old_title = NULL, *old_family = NULL, *old_context = NULL,
*old_title_v = NULL, *old_family_v = NULL, *old_context_v = NULL;
const char *new_name = name ? name : id;
int rc;
if (unlikely((st->name && !strcmp(st->name, new_name)) || !st->name)) {
if(unlikely(name))
rc = rrdset_set_name(st, name);
else
rc = rrdset_set_name(st, id);
if (rc == 2)
mark_rebuild |= META_CHART_UPDATED;
rrdset_set_name(st, new_name);
}
if (unlikely(st->priority != priority)) {
st->priority = priority;