summaryrefslogtreecommitdiff
path: root/ctdb/server/ctdb_traverse.c
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2013-09-10 17:52:26 +1000
committerAmitay Isaacs <amitay@gmail.com>2013-09-25 14:59:45 +1000
commitf1f1788f103677a9a96fd25562750df234274676 (patch)
treef673a2efe96d95dafe69f10dda0cd99930374618 /ctdb/server/ctdb_traverse.c
parent1740cbb58c0d3af97d3d037db2f63afbce62e1fb (diff)
downloadsamba-f1f1788f103677a9a96fd25562750df234274676.tar.gz
traverse: Wait till all data has been flushed from output queue
To improve the traverse performance, records are directly sent from traverse child process to the originating node. Make sure that all the data is sent via socket, before informing ctdbd that traverse is complete. Without waiting for all the packets to be flushed from the queue, child process can incorrectly signal ctdbd that traverse has ended. This will cause the pending records in the queue never to make it to the originating node and traverse information will not be complete. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 482ac708cb79cb6378d814a79c2cf13f88435bc4)
Diffstat (limited to 'ctdb/server/ctdb_traverse.c')
-rw-r--r--ctdb/server/ctdb_traverse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_traverse.c b/ctdb/server/ctdb_traverse.c
index f75227e67ca..5b588c6a225 100644
--- a/ctdb/server/ctdb_traverse.c
+++ b/ctdb/server/ctdb_traverse.c
@@ -215,6 +215,12 @@ static struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_con
} else {
res = h->records_sent;
}
+
+ /* Wait till all the data is flushed from output queue */
+ while (ctdb_queue_length(ctdb->daemon.queue) > 0) {
+ tevent_loop_once(ctdb->ev);
+ }
+
write(h->fd[1], &res, sizeof(res));
while (ctdb_kill(ctdb, parent, 0) == 0 || errno != ESRCH) {