traverse: Send traverse end record from traverse child process master
authorAmitay Isaacs <amitay@gmail.com>
Mon, 9 Sep 2013 02:46:26 +0000 (12:46 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 17 Sep 2013 01:32:48 +0000 (11:32 +1000)
commita0346b4ff3068aee3f74f5084a46f0f164d6849d
tree6fa9106890ceab31b82eaa84044bd03cb3de2ac4
parent17dda86042b1384a897e07ff0fb4109f2a602153
traverse: Send traverse end record from traverse child process

To improve the traverse performance, records are directly sent from
traverse child process to originating node.  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 processes the status write
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>
server/ctdb_traverse.c