[SCM] CTDB repository - branch master updated - ctdb-1.0.108-52-g59f46d7

Ronnie Sahlberg sahlberg at samba.org
Wed Dec 9 14:17:51 MST 2009


The branch, master has been updated
       via  59f46d7261dfdbdef900bf95dd9eb28ad22a46b2 (commit)
       via  b022863d44026c19d5aae54aa485b670bea0540e (commit)
       via  9ac82311d796e1fab31f8de62b8ccc754445093c (commit)
       via  2ff2679e8f3d50ebf735f2c420898a84268bdc95 (commit)
       via  c13077ca64f6e6569c30ef7fcb044e5711dce1a3 (commit)
       via  c46adb210e47530488503e20d682d4d182c0fb79 (commit)
       via  54d227811753f4a87f1a2c9dc0b1389f5ca2a12f (commit)
       via  7f64a00c76203fdf6673c3f862a4bfd17fb848d7 (commit)
      from  a78b8ea7168e5fdb2d62379ad3112008b2748576 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 59f46d7261dfdbdef900bf95dd9eb28ad22a46b2
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 9 22:04:48 2009 +0100

    tests: remove the no_trans mode from ctdb_transaction.
    
    Writes without transaction are not possible any more on
    persistent databases.
    
    Michael

commit b022863d44026c19d5aae54aa485b670bea0540e
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 30 11:59:59 2009 +0200

    tests: remove the persistent_unsafe writes test.
    
    This is useless now that persistent write operations without
    transaction are forbidden.
    
    Michael

commit 9ac82311d796e1fab31f8de62b8ccc754445093c
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 30 11:59:02 2009 +0200

    tests: remove persistent_safe write test.
    
    This is useless now that persistent writes without transactions are forbidden.
    
    Michael

commit 2ff2679e8f3d50ebf735f2c420898a84268bdc95
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 9 21:38:44 2009 +0100

    test: add test 54_ctdb_transaction_recovery.sh
    
    This is like the 53_ctdb_transaction test, but it additionally
    runs a loop with recoveries while the transactions are running.
    
    When called like this, the transaction loops run for 10 minutes:
    
    CTDB_TEST_TIMELIMIT=600 tests/scripts/run_tests tests/simple/54_ctdb_transaction_recovery.sh
    
    The default timelimit is 30 seconds.
    
    Michael

commit c13077ca64f6e6569c30ef7fcb044e5711dce1a3
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 9 21:36:42 2009 +0100

    test: get value for --timelimit from environment var CTDB_TEST_TIMELIMIT in transaction test
    
    Michael

commit c46adb210e47530488503e20d682d4d182c0fb79
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 9 15:05:20 2009 +0100

    client: lower level of commit retry message WARNING->DEBUG
    
    This can happen frequently when recoveries intercept transactions.
    
    Michael

commit 54d227811753f4a87f1a2c9dc0b1389f5ca2a12f
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 9 13:48:49 2009 +0100

    client: lower debug level of transaction-active-retry message to DEBUG
    
    This reduces some noise.
    
    Michael

commit 7f64a00c76203fdf6673c3f862a4bfd17fb848d7
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 9 13:43:38 2009 +0100

    call: lower the debug message "refusing migration while transction" to lvl INFO
    
    This gets just too noisy on a busy system.
    And it is purley informational anyways...
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 client/ctdb_client.c                         |   14 ++--
 server/ctdb_call.c                           |    2 +-
 tests/simple/53_ctdb_transaction.sh          |    6 ++-
 tests/simple/54_ctdb_transaction_recovery.sh |   66 ++++++++++++++++++
 tests/simple/61_ctdb_persistent_safe.sh      |   39 -----------
 tests/simple/62_ctdb_persistent_unsafe.sh    |   39 -----------
 tests/src/ctdb_transaction.c                 |   92 ++++++++++----------------
 7 files changed, 113 insertions(+), 145 deletions(-)
 create mode 100755 tests/simple/54_ctdb_transaction_recovery.sh
 delete mode 100755 tests/simple/61_ctdb_persistent_safe.sh
 delete mode 100755 tests/simple/62_ctdb_persistent_unsafe.sh


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index aa462fb..0469ba7 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -3229,10 +3229,10 @@ again:
 					      ctdb_db->db_id);
 	if (status == 1) {
 		unsigned long int usec = (1000 + random()) % 100000;
-		DEBUG(DEBUG_NOTICE, (__location__ " transaction is active "
-				     "on db_id[0x%08x]. waiting for %lu "
-				     "microseconds\n",
-				     ctdb_db->db_id, usec));
+		DEBUG(DEBUG_DEBUG, (__location__ " transaction is active "
+				    "on db_id[0x%08x]. waiting for %lu "
+				    "microseconds\n",
+				    ctdb_db->db_id, usec));
 		talloc_free(tmp_ctx);
 		usleep(usec);
 		goto again;
@@ -3517,9 +3517,9 @@ again:
 			   &timeout, NULL);
 	if (ret != 0 || status != 0) {
 		tdb_transaction_cancel(h->ctdb_db->ltdb->tdb);
-		DEBUG(DEBUG_WARNING, (__location__ " transaction commit%s failed"
-				      ", retrying after 1 second...\n",
-				      (retries==0)?"":"retry "));
+		DEBUG(DEBUG_NOTICE, (__location__ " transaction commit%s failed"
+				     ", retrying after 1 second...\n",
+				     (retries==0)?"":"retry "));
 		sleep(1);
 
 		if (ret != 0) {
diff --git a/server/ctdb_call.c b/server/ctdb_call.c
index cd52867..82c1304 100644
--- a/server/ctdb_call.c
+++ b/server/ctdb_call.c
@@ -442,7 +442,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 	       && header.lacount >= ctdb->tunable.max_lacount)
 	      || (c->flags & CTDB_IMMEDIATE_MIGRATION)) ) {
 		if (ctdb_db->transaction_active) {
-			DEBUG(DEBUG_WARNING, (__location__ " refusing migration"
+			DEBUG(DEBUG_INFO, (__location__ " refusing migration"
 			      " of key %s while transaction is active\n",
 			      (char *)call->key.dptr));
 		} else {
diff --git a/tests/simple/53_ctdb_transaction.sh b/tests/simple/53_ctdb_transaction.sh
index a7dac50..760f78b 100755
--- a/tests/simple/53_ctdb_transaction.sh
+++ b/tests/simple/53_ctdb_transaction.sh
@@ -33,7 +33,11 @@ cluster_is_healthy
 try_command_on_node 0 "$CTDB listnodes"
 num_nodes=$(echo "$out" | wc -l)
 
-t="$CTDB_TEST_WRAPPER $VALGRIND ctdb_transaction --timelimit=30"
+if test "x${CTDB_TEST_TIMELIMIT}" == "x" ; then
+	CTDB_TEST_TIMELIMIT=30
+fi
+
+t="$CTDB_TEST_WRAPPER $VALGRIND ctdb_transaction --timelimit=${CTDB_TEST_TIMELIMIT}"
 
 echo "Running ctdb_transaction on all $num_nodes nodes."
 try_command_on_node -v -pq all "$t & $t"
diff --git a/tests/simple/54_ctdb_transaction_recovery.sh b/tests/simple/54_ctdb_transaction_recovery.sh
new file mode 100755
index 0000000..13a92cc
--- /dev/null
+++ b/tests/simple/54_ctdb_transaction_recovery.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+test_info()
+{
+    cat <<EOF
+Verify that the ctdb_transaction test succeeds.
+
+Prerequisites:
+
+* An active CTDB cluster with at least 2 active nodes.
+
+Steps:
+
+1. Verify that the status on all of the ctdb nodes is 'OK'.
+2. Run two copies of ctdb_transaction on each node with a 30 second
+   timeout.
+3. Ensure that all ctdb_transaction processes complete successfully.
+
+Expected results:
+
+* ctdb_transaction runs without error.
+EOF
+}
+
+recovery_loop()
+{
+	local COUNT=1
+
+	while true ; do
+		echo Recovery $COUNT
+		ctdb recover
+		sleep 2
+		COUNT=$((COUNT + 1))
+	done
+}
+
+recovery_loop_start()
+{
+	recovery_loop > /tmp/recloop.out &
+	RECLOOP_PID=$!
+	ctdb_test_exit_hook_add "kill $RECLOOP_PID >/dev/null 2>&1"
+}
+
+. ctdb_test_functions.bash
+
+ctdb_test_init "$@"
+
+set -e
+
+cluster_is_healthy
+
+try_command_on_node 0 "$CTDB listnodes"
+num_nodes=$(echo "$out" | wc -l)
+
+if test "x${CTDB_TEST_TIMELIMIT}" == "x" ; then
+	CTDB_TEST_TIMELIMIT=30
+fi
+
+t="$CTDB_TEST_WRAPPER $VALGRIND ctdb_transaction --timelimit=${CTDB_TEST_TIMELIMIT}"
+
+echo "Starting recovery loop"
+recovery_loop_start
+
+echo "Running ctdb_transaction on all $num_nodes nodes."
+try_command_on_node -v -pq all "$t & $t"
+
diff --git a/tests/simple/61_ctdb_persistent_safe.sh b/tests/simple/61_ctdb_persistent_safe.sh
deleted file mode 100755
index 4faf0a9..0000000
--- a/tests/simple/61_ctdb_persistent_safe.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-test_info()
-{
-    cat <<EOF
-Verify that the ctdb_persistent test succeeds for safe persistent writes.
-
-Prerequisites:
-
-* An active CTDB cluster with at least 2 active nodes.
-
-Steps:
-
-1. Verify that the status on all of the ctdb nodes is 'OK'.
-2. Run two copies of ctdb_persistent on each node with a 30 second
-   timeout.
-3. Ensure that all ctdb_persistent processes complete successfully.
-
-Expected results:
-
-* ctdb_persistent tests safe persistent writes without error.
-EOF
-}
-
-. ctdb_test_functions.bash
-
-ctdb_test_init "$@"
-
-set -e
-
-cluster_is_healthy
-
-try_command_on_node 0 "$CTDB listnodes"
-num_nodes=$(echo "$out" | wc -l)
-
-t="$CTDB_TEST_WRAPPER $VALGRIND ctdb_persistent --timelimit=30"
-
-echo "Running ctdb_persistent on all $num_nodes nodes."
-try_command_on_node -v -pq all "$t & $t"
diff --git a/tests/simple/62_ctdb_persistent_unsafe.sh b/tests/simple/62_ctdb_persistent_unsafe.sh
deleted file mode 100755
index eb5706e..0000000
--- a/tests/simple/62_ctdb_persistent_unsafe.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-test_info()
-{
-    cat <<EOF
-Verify that the ctdb_persistent test succeeds for unsafe persistent writes.
-
-Prerequisites:
-
-* An active CTDB cluster with at least 2 active nodes.
-
-Steps:
-
-1. Verify that the status on all of the ctdb nodes is 'OK'.
-2. Run two copies of ctdb_persistent on each node with a 30 second
-   timeout and with the --unsafe-writes option.
-3. Ensure that all ctdb_persistent processes complete successfully.
-
-Expected results:
-
-* ctdb_persistent tests unsafe persistent writes without error.
-EOF
-}
-
-. ctdb_test_functions.bash
-
-ctdb_test_init "$@"
-
-set -e
-
-cluster_is_healthy
-
-try_command_on_node 0 "$CTDB listnodes"
-num_nodes=$(echo "$out" | wc -l)
-
-t="$CTDB_TEST_WRAPPER $VALGRIND ctdb_persistent --unsafe-writes --timelimit=30"
-
-echo "Running ctdb_persistent --unsafe-writes on all $num_nodes nodes."
-try_command_on_node -v -pq all "$t & $t"
diff --git a/tests/src/ctdb_transaction.c b/tests/src/ctdb_transaction.c
index 2144719..6fba1e0 100644
--- a/tests/src/ctdb_transaction.c
+++ b/tests/src/ctdb_transaction.c
@@ -45,7 +45,6 @@ static double end_timer(void)
 static int timelimit = 10;
 static int delay = 0;
 static int verbose = 0;
-static int no_trans = 0;
 
 static unsigned int pnn;
 
@@ -129,37 +128,25 @@ static void test_store_records(struct ctdb_context *ctdb, struct event_context *
 		TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
 		TDB_DATA data;
 		struct ctdb_transaction_handle *h;
-		struct ctdb_record_handle *rec;
-
-
-		if (!no_trans) {
-			if (verbose) DEBUG(DEBUG_ERR, ("starting transaction\n"));
-			h = ctdb_transaction_start(ctdb_db, tmp_ctx);
-			if (h == NULL) {
-				DEBUG(DEBUG_ERR, ("Failed to start transaction on node %d\n",
-				       ctdb_get_pnn(ctdb)));
-				talloc_free(tmp_ctx);
-				return;
-			}
-			if (verbose) DEBUG(DEBUG_ERR, ("transaction started\n"));
-			do_sleep(delay);
-
-			if (verbose) DEBUG(DEBUG_ERR, ("calling transaction_fetch\n"));
-			ret = ctdb_transaction_fetch(h, tmp_ctx, key, &data);
-			if (ret != 0) {
-				DEBUG(DEBUG_ERR,("Failed to fetch record\n"));
-				exit(1);
-			}
-			if (verbose) DEBUG(DEBUG_ERR, ("fetched data ok\n"));
-		} else {
-			if (verbose) DEBUG(DEBUG_ERR, ("calling fetch_lock\n"));
-			rec = ctdb_fetch_lock(ctdb_db, tmp_ctx, key, &data);
-			if (rec == NULL) {
-				DEBUG(DEBUG_ERR,("Failed to fetch record\n"));
-				exit(1);
-			}
-			if (verbose) DEBUG(DEBUG_ERR, ("fetched record ok\n"));
+
+		if (verbose) DEBUG(DEBUG_ERR, ("starting transaction\n"));
+		h = ctdb_transaction_start(ctdb_db, tmp_ctx);
+		if (h == NULL) {
+			DEBUG(DEBUG_ERR, ("Failed to start transaction on node %d\n",
+			       ctdb_get_pnn(ctdb)));
+			talloc_free(tmp_ctx);
+			return;
+		}
+		if (verbose) DEBUG(DEBUG_ERR, ("transaction started\n"));
+		do_sleep(delay);
+
+		if (verbose) DEBUG(DEBUG_ERR, ("calling transaction_fetch\n"));
+		ret = ctdb_transaction_fetch(h, tmp_ctx, key, &data);
+		if (ret != 0) {
+			DEBUG(DEBUG_ERR,("Failed to fetch record\n"));
+			exit(1);
 		}
+		if (verbose) DEBUG(DEBUG_ERR, ("fetched data ok\n"));
 		do_sleep(delay);
 
 		if (data.dsize < sizeof(uint32_t) * (pnn+1)) {
@@ -183,33 +170,23 @@ static void test_store_records(struct ctdb_context *ctdb, struct event_context *
 		/* bump our counter */
 		counters[pnn]++;
 
-		if (!no_trans) {
-			if (verbose) DEBUG(DEBUG_ERR, ("calling transaction_store\n"));
-			ret = ctdb_transaction_store(h, key, data);
-			if (ret != 0) {
-				DEBUG(DEBUG_ERR,("Failed to store record\n"));
-				exit(1);
-			}
-			if (verbose) DEBUG(DEBUG_ERR, ("stored data ok\n"));
-			do_sleep(delay);
-
-			if (verbose) DEBUG(DEBUG_ERR, ("calling transaction_commit\n"));
-			ret = ctdb_transaction_commit(h);
-			if (ret != 0) {
-				DEBUG(DEBUG_ERR,("Failed to commit transaction\n"));
-				check_counters(ctdb, data);
-				exit(1);
-			}
-			if (verbose) DEBUG(DEBUG_ERR, ("transaction committed\n"));
-		} else {
-			if (verbose) DEBUG(DEBUG_ERR, ("calling record_store\n"));
-			ret = ctdb_record_store(rec, data);
-			if (ret != 0) {
-				DEBUG(DEBUG_ERR,("Failed to store record\n"));
-				exit(1);
-			}
-			if (verbose) DEBUG(DEBUG_ERR, ("stored record ok\n"));
+		if (verbose) DEBUG(DEBUG_ERR, ("calling transaction_store\n"));
+		ret = ctdb_transaction_store(h, key, data);
+		if (ret != 0) {
+			DEBUG(DEBUG_ERR,("Failed to store record\n"));
+			exit(1);
+		}
+		if (verbose) DEBUG(DEBUG_ERR, ("stored data ok\n"));
+		do_sleep(delay);
+
+		if (verbose) DEBUG(DEBUG_ERR, ("calling transaction_commit\n"));
+		ret = ctdb_transaction_commit(h);
+		if (ret != 0) {
+			DEBUG(DEBUG_ERR,("Failed to commit transaction\n"));
+			check_counters(ctdb, data);
+			exit(1);
 		}
+		if (verbose) DEBUG(DEBUG_ERR, ("transaction committed\n"));
 
 		/* store the counters and verify that they are sane */
 		if (verbose || (pnn == 0)) {
@@ -237,7 +214,6 @@ int main(int argc, const char *argv[])
 		{ "timelimit", 't', POPT_ARG_INT, &timelimit, 0, "timelimit", "integer" },
 		{ "delay", 'D', POPT_ARG_INT, &delay, 0, "delay (in seconds) between operations", "integer" },
 		{ "verbose", 'v', POPT_ARG_NONE,  &verbose, 0, "switch on verbose mode", NULL },
-		{ "no-trans", 'n', POPT_ARG_NONE, &no_trans, 0, "use fetch_lock/record store instead of transactions", NULL },
 		{ "unsafe-writes", 'u', POPT_ARG_NONE, &unsafe_writes, 0, "do not use tdb transactions when writing", NULL },
 		POPT_TABLEEND
 	};


-- 
CTDB repository


More information about the samba-cvs mailing list