From 2b6db9041dcac3cb7950f151294b92dc1e569142 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 15 Nov 2013 15:21:58 +1100 Subject: [PATCH] ctdb-tests/simple: Update persistent DB tests * Low level DB checks should ignore the sequence number record. * A restart is needed after messing with the RecoverPDBBySeqNum tunable. Signed-off-by: Martin Schwenke Pair-programmed-with: Amitay Isaacs Reviewed-by: Michael Adam --- ctdb/tests/simple/70_recoverpdbbyseqnum.sh | 19 ++++++++----------- ctdb/tests/simple/71_ctdb_wipedb.sh | 4 +++- .../simple/72_update_record_persistent.sh | 3 ++- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ctdb/tests/simple/70_recoverpdbbyseqnum.sh b/ctdb/tests/simple/70_recoverpdbbyseqnum.sh index a83dbe0ebc6..cb6021fd459 100755 --- a/ctdb/tests/simple/70_recoverpdbbyseqnum.sh +++ b/ctdb/tests/simple/70_recoverpdbbyseqnum.sh @@ -48,6 +48,9 @@ set -e cluster_is_healthy +# Reset configuration +ctdb_restart_when_done + try_command_on_node 0 "$CTDB listnodes" num_nodes=$(echo "$out" | wc -l) @@ -149,11 +152,11 @@ try_command_on_node all $CTDB setvar RecoverPDBBySeqNum 1 # 5, # If RecoverPDBBySeqNum==1 and no __db_sequence_number__ -# recover record by record +# recover whole database # # wipe database echo -echo test that RecoverPDBBySeqNum==1 and no __db_sequence_number__ blends the database during recovery +echo test that RecoverPDBBySeqNum==1 and no __db_sequence_number__ does not blend the database during recovery echo wipe the test database try_command_on_node 0 $CTDB wipedb persistent_test.tdb @@ -173,11 +176,11 @@ try_command_on_node 0 $CTDB recover # check that we now have both records on node 0 num_records=$(try_command_on_node -v 0 $CTDB cattdb persistent_test.tdb | grep key | egrep "ABC|DEF" | wc -l) -[ $num_records != "2" ] && { - echo "BAD: we did not end up with the expected two records after the recovery" +[ $num_records != "1" ] && { + echo "BAD: we did not end up with the expected single record after the recovery" exit 1 } -echo "OK. databases were blended" +echo "OK. databases were not blended" @@ -224,9 +227,3 @@ num_records=$(try_command_on_node -v 0 $CTDB cattdb persistent_test.tdb | grep k } echo "OK. databases were not blended" - - - -# set RecoverPDBBySeqNum=1 -echo "setting RecoverPDBBySeqNum back to 0" -try_command_on_node all $CTDB setvar RecoverPDBBySeqNum 0 diff --git a/ctdb/tests/simple/71_ctdb_wipedb.sh b/ctdb/tests/simple/71_ctdb_wipedb.sh index 1e6618c3dad..3bf695e0663 100755 --- a/ctdb/tests/simple/71_ctdb_wipedb.sh +++ b/ctdb/tests/simple/71_ctdb_wipedb.sh @@ -55,11 +55,13 @@ try_command_on_node 1 $CTDB tstore $TDB 0x444546 0x07000000000000000000000000000 # 4, echo wipe the persistent test database try_command_on_node 0 $CTDB wipedb persistent_test.tdb + echo force a recovery try_command_on_node 0 $CTDB recover # check that the database is wiped -num_records=$(try_command_on_node -v 1 $CTDB cattdb persistent_test.tdb | grep key | wc -l) +num_records=$(try_command_on_node -v 1 $CTDB cattdb persistent_test.tdb | \ + grep key | grep -v '__db_sequence_number__' | wc -l) [ $num_records != "0" ] && { echo "BAD: we did not end up with an empty database" exit 1 diff --git a/ctdb/tests/simple/72_update_record_persistent.sh b/ctdb/tests/simple/72_update_record_persistent.sh index c5183ca0b27..3f1d2a137f6 100755 --- a/ctdb/tests/simple/72_update_record_persistent.sh +++ b/ctdb/tests/simple/72_update_record_persistent.sh @@ -51,7 +51,8 @@ echo force a recovery try_command_on_node 0 $CTDB recover # check that the database is wiped -num_records=$(try_command_on_node -v 1 $CTDB cattdb $TDB | grep key | wc -l) +num_records=$(try_command_on_node -v 1 $CTDB cattdb $TDB | \ + grep key | grep -v '__db_sequence_number__' | wc -l) [ $num_records != "0" ] && { echo "BAD: we did not end up with an empty database" exit 1