summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorMarkos Fountoulakis <44345837+mfundul@users.noreply.github.com>2020-09-04 13:03:25 +0300
committerGitHub <noreply@github.com>2020-09-04 13:03:25 +0300
commitadf253f710f62106193bbcf5f46543ba6fd93d2a (patch)
tree8bba2a75dc41ce88d4d816a9b025cc855c7bfdfe /database
parentbe5945212363633b7c5fc704739f93a00ccf69ea (diff)
Fix race condition with orphan hosts (#9862)
* Fix race condition between orphan host cleanup and new streaming connections. * Remove health enabling from log replay, it will be handled at streaming connection time.
Diffstat (limited to 'database')
-rwxr-xr-xdatabase/engine/metadata_log/metalogpluginsd.c6
-rw-r--r--database/rrdhost.c6
2 files changed, 7 insertions, 5 deletions
diff --git a/database/engine/metadata_log/metalogpluginsd.c b/database/engine/metadata_log/metalogpluginsd.c
index 25af24143b..1fa94e315a 100755
--- a/database/engine/metadata_log/metalogpluginsd.c
+++ b/database/engine/metadata_log/metalogpluginsd.c
@@ -12,7 +12,6 @@ PARSER_RC metalog_pluginsd_host_action(
{
int history = 5;
RRD_MEMORY_MODE mode = RRD_MEMORY_MODE_DBENGINE;
- int health_enabled = default_health_enabled;
int rrdpush_enabled = default_rrdpush_enabled;
char *rrdpush_destination = default_rrdpush_destination;
char *rrdpush_api_key = default_rrdpush_api_key;
@@ -49,9 +48,6 @@ PARSER_RC metalog_pluginsd_host_action(
update_every = (int)appconfig_get_number(&stream_config, machine_guid, "update every", update_every);
if(update_every < 0) update_every = 1;
- //health_enabled = appconfig_get_boolean_ondemand(&stream_config, rpt->key, "health enabled by default", health_enabled);
- health_enabled = appconfig_get_boolean_ondemand(&stream_config, machine_guid, "health enabled", health_enabled);
-
//rrdpush_enabled = appconfig_get_boolean(&stream_config, rpt->key, "default proxy enabled", rrdpush_enabled);
rrdpush_enabled = appconfig_get_boolean(&stream_config, machine_guid, "proxy enabled", rrdpush_enabled);
@@ -77,7 +73,7 @@ PARSER_RC metalog_pluginsd_host_action(
, update_every
, history // entries
, mode
- , health_enabled // health enabled
+ , 0 // health enabled
, rrdpush_enabled // Push enabled
, rrdpush_destination //destination
, rrdpush_api_key // api key
diff --git a/database/rrdhost.c b/database/rrdhost.c
index 08bdb1b3ba..c5e0e069cd 100644
--- a/database/rrdhost.c
+++ b/database/rrdhost.c
@@ -573,6 +573,12 @@ RRDHOST *rrdhost_find_or_create(
, rrdpush_send_charts_matching
, system_info);
}
+ if (host) {
+ rrdhost_wrlock(host);
+ rrdhost_flag_clear(host, RRDHOST_FLAG_ORPHAN);
+ host->senders_disconnected_time = 0;
+ rrdhost_unlock(host);
+ }
rrdhost_cleanup_orphan_hosts_nolock(host);