tests/simple: Update persistent DB tests
authorMartin Schwenke <martin@meltin.net>
Fri, 15 Nov 2013 04:21:58 +0000 (15:21 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 19 Nov 2013 05:47:52 +0000 (16:47 +1100)
* 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 <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

tests/simple/70_recoverpdbbyseqnum.sh
tests/simple/71_ctdb_wipedb.sh
tests/simple/72_update_record_persistent.sh

index a83dbe0ebc6a7d24cdb2a8ea58f09e5d8522e4c6..cb6021fd459df9f4e2cd9904f38a957147378aa5 100755 (executable)
@@ -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
index 1e6618c3dadef0119802977b6aa500a15660da43..3bf695e06639c42dd1be2e1efdca56bd29d73476 100755 (executable)
@@ -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
index c5183ca0b27f559b4cdcffb6a2f91db650a38d3c..3f1d2a137f6f889c86a74aca98d5138ac09b755f 100755 (executable)
@@ -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