summaryrefslogtreecommitdiffstats
path: root/libnetdata/config
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-12-01 06:15:04 +0000
commite970e0b37b8bd7f246feb3f70c4136418225e434 (patch)
tree0b67c0ca45f56f2f9d9c5c2e725279ecdf52d2eb /libnetdata/config
parentAdding upstream version 1.31.0. (diff)
downloadnetdata-e970e0b37b8bd7f246feb3f70c4136418225e434.tar.xz
netdata-e970e0b37b8bd7f246feb3f70c4136418225e434.zip
Adding upstream version 1.32.0.upstream/1.32.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--libnetdata/config/appconfig.c26
-rw-r--r--libnetdata/config/appconfig.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/libnetdata/config/appconfig.c b/libnetdata/config/appconfig.c
index 6e4df2d09..37e9e7688 100644
--- a/libnetdata/config/appconfig.c
+++ b/libnetdata/config/appconfig.c
@@ -225,6 +225,31 @@ void appconfig_section_destroy_non_loaded(struct config *root, const char *secti
error("Cannot remove section '%s' from config.", section);
return;
}
+
+ appconfig_wrlock(root);
+
+ if (root->first_section == co) {
+ root->first_section = co->next;
+
+ if (root->last_section == co)
+ root->last_section = root->first_section;
+ } else {
+ struct section *co_cur = root->first_section, *co_prev = NULL;
+
+ while(co_cur && co_cur != co) {
+ co_prev = co_cur;
+ co_cur = co_cur->next;
+ }
+
+ if (co_cur) {
+ co_prev->next = co_cur->next;
+
+ if (root->last_section == co_cur)
+ root->last_section = co_prev;
+ }
+ }
+
+ appconfig_unlock(root);
avl_destroy_lock(&co->values_index);
freez(co->name);
@@ -771,6 +796,7 @@ void appconfig_generate(struct config *root, BUFFER *wb, int only_changed)
|| !strcmp(co->name, CONFIG_SECTION_BACKEND)
|| !strcmp(co->name, CONFIG_SECTION_STREAM)
|| !strcmp(co->name, CONFIG_SECTION_HOST_LABEL)
+ || !strcmp(co->name, CONFIG_SECTION_ML)
)
pri = 0;
else if(!strncmp(co->name, "plugin:", 7)) pri = 1;
diff --git a/libnetdata/config/appconfig.h b/libnetdata/config/appconfig.h
index 246d1d5b9..bfc927353 100644
--- a/libnetdata/config/appconfig.h
+++ b/libnetdata/config/appconfig.h
@@ -91,6 +91,7 @@
#define CONFIG_SECTION_HEALTH "health"
#define CONFIG_SECTION_BACKEND "backend"
#define CONFIG_SECTION_STREAM "stream"
+#define CONFIG_SECTION_ML "ml"
#define CONFIG_SECTION_EXPORTING "exporting:global"
#define CONFIG_SECTION_PROMETHEUS "prometheus:exporter"
#define CONFIG_SECTION_HOST_LABEL "host labels"