ctdb-tests: Avoid a race
authorMartin Schwenke <martin@meltin.net>
Tue, 17 Mar 2020 06:58:02 +0000 (17:58 +1100)
committerMartin Schwenke <martins@samba.org>
Mon, 17 Jan 2022 10:21:32 +0000 (10:21 +0000)
See the comment in the code for details.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/INTEGRATION/simple/cluster.016.reclock_move_lock_dir.sh

index 8a8290db64937bcd2e18e64404e41d45f40b4d09..a2ba112c68ca444ea46b8b261733684b14767a04 100755 (executable)
@@ -60,6 +60,19 @@ echo "Set ban period to 30s"
 ctdb_onnode all setvar RecoveryBanPeriod 30
 echo
 
+# Avoid a race where the election handler can be called before the
+# tunables are updated in the recovery daemon.  Ideally, since
+# everything is idle, this should take one RecoverInterval
+# (i.e. iteration of the monitor loop in the recovery daemon).
+# However, this is the interval between loops and each loop can take
+# an arbitrary amount of time.  The only way to be sure that the
+# tunables have definitely been updated is to do 2 recoveries - this
+# guarantees the tunables were read at the top of the loop between the
+# 2 recoveries.
+echo "2 recoveries to ensure that tunables have been re-read"
+ctdb_onnode "$test_node" "recover"
+ctdb_onnode "$test_node" "recover"
+
 dir=$(dirname "$reclock")
 
 echo "Rename recovery lock directory"