traverse: Send traverse end record from traverse child process
commita2d6bbe67a08094e558a30884c513c9413812a94
authorAmitay Isaacs <amitay@gmail.com>
Mon, 9 Sep 2013 02:46:26 +0000 (9 12:46 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Wed, 25 Sep 2013 04:59:45 +0000 (25 14:59 +1000)
treed1c0ee83d25f6615d0c17eb03d9579e43fa367ff
parentf1f1788f103677a9a96fd25562750df234274676
traverse: Send traverse end record from traverse child process

Traverse records are sent directly from traverse child process, but
the last empty record signalling end of traverse is sent from ctdbd.
This creates a race condition between ctdbd and traverse child.
There are two fds from traverse child to ctdbd - a pipe to track status
of the child process and unix socket connection for sending records.
It's possible that last few records are sitting in unix socket buffer
when ctdbd reads the status written from traverse child.  This will
be interpreted as end of traverse and ctdbd will send the last empty
record to originating node before it has processed the pending packets
in unix socket connection.

The race is avoided by sending the last empty record marking end of
traverse from the child process.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit 37e22fc3ac3eb64732f2e67058f5b7b06c093fbf)
ctdb/server/ctdb_traverse.c