1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

ctdb-scripts: Avoid no-op "ctdb ptrans" call

This causes unnecessary g_lock activity and overhead.

This could be optimised in ctdb.c:control_ptrans().  However, that
makes the code more complex.  Let's only do that if we get more
potentially no-op uses.

Note no optimisation is needed in the "notify" case because there is
already an early exit if there are no items.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2017-01-04 09:53:54 +11:00 committed by Martin Schwenke
parent 9a12d6af05
commit 2ad1604c2b

View File

@ -91,10 +91,14 @@ case "$1" in
printf "/statd-state@%s@/p\n", ip }')
# Intentional multi-word expansion for multiple files
# shellcheck disable=SC2086
if sed -n "$sed_expr" $files | $CTDB ptrans "ctdb.tdb" ; then
rm $files
items=$(sed -n "$sed_expr" $files)
if [ -n "$items" ] ; then
if echo "$items" | $CTDB ptrans "ctdb.tdb" ; then
# shellcheck disable=SC2086
rm $files
fi
fi
;;
;;
notify)
# we must restart the lockmanager (on all nodes) so that we get