cleanup obsolete host files; #2329
Costa Tsaousis (ktsaou) committed
Jun 15, 2017 at 01:46 UTC
73a7970a18f2b9d17b74f23f50646ed6776ad3e2
2 files changed
+3
-4
src/rrd.h
+1
-1
@@ -352,7 +352,7 @@ typedef struct rrdset RRDSET;
352
// and may lead to missing information.
353
354
typedef enum rrdhost_flags {
355
- RRDHOST_ORPHAN = 1 << 0, // this host is orphan
355
+ RRDHOST_ORPHAN = 1 << 0, // this host is orphan (not receiving data)
356
RRDHOST_DELETE_OBSOLETE_FILES = 1 << 1, // delete files of obsolete charts
357
RRDHOST_DELETE_ORPHAN_FILES = 1 << 2 // delete the entire host when orphan
358
} RRDHOST_FLAGS;
src/rrdpush.c
+2
-3
@@ -219,8 +219,6 @@ static void rrdpush_sender_thread_cleanup_locked_all(RRDHOST *host) {
219
host->rrdpush_buffer = NULL;
220
221
host->rrdpush_spawn = 0;
222
-
223
- rrdhost_flag_set(host, RRDHOST_ORPHAN);
222
}
223
224
void rrdpush_sender_thread_stop(RRDHOST *host) {
@@ -621,6 +619,7 @@ int rrdpush_receive(int fd, const char *key, const char *hostname, const char *r
619
620
rrdhost_wrlock(host);
621
host->connected_senders++;
622
+ rrdhost_flag_clear(host, RRDHOST_ORPHAN);
623
if(health_enabled != CONFIG_BOOLEAN_NO)
624
host->health_delay_up_to = now_realtime_sec() + alarms_delay;
625
rrdhost_unlock(host);
@@ -634,6 +633,7 @@ int rrdpush_receive(int fd, const char *key, const char *hostname, const char *r
633
host->senders_disconnected_time = now_realtime_sec();
634
host->connected_senders--;
635
if(!host->connected_senders) {
636
+ rrdhost_flag_set(host, RRDHOST_ORPHAN);
637
if(health_enabled == CONFIG_BOOLEAN_AUTO)
638
host->health_enabled = 0;
639
}
@@ -696,7 +696,6 @@ void rrdpush_sender_thread_spawn(RRDHOST *host) {
696
else if(pthread_detach(host->rrdpush_thread))
697
error("STREAM %s [send]: cannot request detach newly created thread.", host->hostname);
698
699
- rrdhost_flag_clear(host, RRDHOST_ORPHAN);
699
host->rrdpush_spawn = 1;
700
}
701