1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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)
This commit is contained in:
Amitay Isaacs 2013-09-10 17:52:26 +10:00
parent 1740cbb58c
commit f1f1788f10

View File

@ -215,6 +215,12 @@ static struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_con
} else { } else {
res = h->records_sent; 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)); write(h->fd[1], &res, sizeof(res));
while (ctdb_kill(ctdb, parent, 0) == 0 || errno != ESRCH) { while (ctdb_kill(ctdb, parent, 0) == 0 || errno != ESRCH) {