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>
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