A RRD file with no values would not be enqueued, so it would never be
flushed.  Therefore, its "flushed" condition would never be broadcast.
Therefore, a "flush" issued against a file with no updates would block
until the file was written to disk for another reason (i.e. periodic
timer, flush after update, etc).

If we have no values, do not try to enqueue the RRD, and do not block
waiting for it to be flushed.
---
 src/rrd_daemon.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index d6f77eb..36d090c 100644
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
@@ -745,12 +745,14 @@ static int flush_file (const char *filename) /* {{{ */
     return (ENOENT);
   }
 
-  /* Enqueue at head */
-  enqueue_cache_item (ci, HEAD);
-  pthread_cond_signal (&cache_cond);
+  if (ci->values > 0)
+  {
+    /* Enqueue at head */
+    enqueue_cache_item (ci, HEAD);
+    pthread_cond_signal (&cache_cond);
+    pthread_cond_wait(&ci->flushed, &cache_lock);
+  }
 
-  pthread_cond_wait(&ci->flushed, &cache_lock);
-  assert((ci->flags & CI_FLAGS_IN_QUEUE) == 0);
   pthread_mutex_unlock(&cache_lock);
 
   return (0);
-- 
1.6.0.2

_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Reply via email to