summaryrefslogtreecommitdiff
path: root/ctdb/config
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2017-06-09 14:34:56 +1000
committerMartin Schwenke <martins@samba.org>2017-06-13 09:12:19 +0200
commitdac075129b93dd0ecf0c59189f8e8ef294ab65c4 (patch)
tree90a4f983c192f8b27e7e92a99a3fd14c4a70f387 /ctdb/config
parentd79c601fde6ec97e0463d42a133c5ec42193b025 (diff)
downloadsamba-dac075129b93dd0ecf0c59189f8e8ef294ab65c4.tar.gz
ctdb-scripts: Compact server-end TCP connection killing output
When thousands of connections are being killed the logs are flooded with information about connections that should be killed. When some connections are not killed then the number not killed is printed. This is the wrong way around! When debugging "fail-back" problems, it is important to know details of connections that were *not* killed. It is almost never important to know the full list of all connections that were *supposed* to be killed. Instead, print a summary showing how many connections of the total were killed. If any were not killed then print a list of remaining connections. Update unit tests: infrastructure for fake TCP connections, existing, test cases, add new test cases. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/config')
-rwxr-xr-xctdb/config/functions22
1 files changed, 14 insertions, 8 deletions
diff --git a/ctdb/config/functions b/ctdb/config/functions
index f4539685137..2c630bd11be 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -414,7 +414,6 @@ kill_tcp_connections ()
139|445) __oneway=true ;;
esac
- echo "Killing TCP connection $_src $_dst"
_connections="${_connections}${_nl}${_src} ${_dst}"
if ! $__oneway ; then
_connections="${_connections}${_nl}${_dst} ${_src}"
@@ -433,15 +432,22 @@ kill_tcp_connections ()
return
}
- _remaining=$(get_tcp_connections_for_ip "$_ip" | wc -l)
-
- if [ "$_remaining" -eq 0 ] ; then
- echo "Killed $_killcount TCP connections to released IP $_ip"
- return
+ _connections=$(get_tcp_connections_for_ip "$_ip")
+ if [ -z "$_connections" ] ; then
+ _remaining=0
+ else
+ _remaining=$(echo "$_connections" | wc -l)
fi
- _t="${_remaining}/${_killcount}"
- echo "Failed to kill TCP connections for IP $_ip (${_t} remaining)"
+ _actually_killed=$((_killcount - _remaining))
+
+ _t="${_actually_killed}/${_killcount}"
+ echo "Killed ${_t} TCP connections to released IP $_ip"
+
+ if [ -n "$_connections" ] ; then
+ echo "Remaining connections:"
+ echo "$_connections" | sed -e 's|^| |'
+ fi
}
}