1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

ctdb-scripts: Optimise tickle_tcp_connections()

Pipe the connections to "ctdb tickle" on stdin to avoid having to fork
so many "ctdb tickle" processes.  This maintains the current level of
verbosity at the price of some extra memory usage.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Sep  8 10:45:42 CEST 2016 on sn-devel-144
This commit is contained in:
Martin Schwenke 2015-09-08 11:29:25 +10:00 committed by Amitay Isaacs
parent 30c56a0c80
commit c730f0b337

View File

@ -520,21 +520,12 @@ tickle_tcp_connections ()
{
_ip="$1"
get_tcp_connections_for_ip "$_ip" |
{
_failed=false
# Get connections, both directions
_conns=$(get_tcp_connections_for_ip "$_ip" | \
awk '{ print $1, $2 ; print $2, $1 }')
while read dest src; do
echo "Tickle TCP connection $src $dest"
$CTDB tickle "$src" "$dest" >/dev/null 2>&1 || _failed=true
echo "Tickle TCP connection $dest $src"
$CTDB tickle "$dest" "$src" >/dev/null 2>&1 || _failed=true
done
if $_failed ; then
echo "Failed to send tickle control"
fi
}
echo "$_conns" | awk '{ print "Tickle TCP connection", $1, $2 }'
echo "$_conns" | ctdb tickle
}
get_tcp_connections_for_ip ()