The Samba-Bugzilla – Attachment 12328 Details for
Bug 12109
Fixes to CTDB tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.5rc
BZ12109.patch (text/plain), 30.05 KB, created by
Martin Schwenke
on 2016-08-09 03:11:52 UTC
(
hide
)
Description:
Patch for 4.5rc
Filename:
MIME Type:
Creator:
Martin Schwenke
Created:
2016-08-09 03:11:52 UTC
Size:
30.05 KB
patch
obsolete
>From f3a16bd98a94ed79ccbcde13a5708ddc9dfe3b21 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 1 Aug 2016 14:07:04 +1000 >Subject: [PATCH 01/10] ctdb-tests: Stop cross-talk between reclock tests > >On a busy system the backgrounded counter reset can survive into the >next test and interfere with its result. > >To avoid this, wait until all forks of 01.reclock exit before >continuing on to the next test. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Volker Lendecke <vl@samba.org> > >Autobuild-User(master): Volker Lendecke <vl@samba.org> >Autobuild-Date(master): Mon Aug 1 17:53:27 CEST 2016 on sn-devel-144 > >(cherry picked from commit 19ed8165bbe374e1ea277fd4dd5a65ee932b4f05) >--- > ctdb/tests/eventscripts/scripts/local.sh | 11 +++++++++++ > 1 file changed, 11 insertions(+) > >diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh >index 7f6c91d..61a033a 100644 >--- a/ctdb/tests/eventscripts/scripts/local.sh >+++ b/ctdb/tests/eventscripts/scripts/local.sh >@@ -1132,10 +1132,21 @@ program $_rpc_service${_ver:+ version }${_ver} is not available" > > # Recovery lock fakery > >+cleanup_reclock () >+{ >+ _pattern="${script_dir}/${script}" >+ while pgrep -f "$_pattern" >/dev/null ; do >+ echo "Waiting for backgrounded ${script} to exit..." >+ (FAKE_SLEEP_REALLY=yes sleep 1) >+ done >+} >+ > setup_reclock () > { > CTDB_RECOVERY_LOCK=$(mktemp --tmpdir="$EVENTSCRIPTS_TESTS_VAR_DIR") > export CTDB_RECOVERY_LOCK >+ >+ test_cleanup cleanup_reclock > } > > ###################################################################### >-- >2.8.1 > > >From a36b6c2a55ed0b69c5a47b4e76716451e6255163 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 2 Aug 2016 14:16:35 +1000 >Subject: [PATCH 02/10] ctdb-tests: Add --interactive/-i option to test options > parsing code > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit b100d78597959ad314e4f4f6816a8ff14100fb6e) >--- > ctdb/tests/src/test_options.c | 3 +++ > ctdb/tests/src/test_options.h | 1 + > 2 files changed, 4 insertions(+) > >diff --git a/ctdb/tests/src/test_options.c b/ctdb/tests/src/test_options.c >index f330764..e28dcee 100644 >--- a/ctdb/tests/src/test_options.c >+++ b/ctdb/tests/src/test_options.c >@@ -39,6 +39,8 @@ static struct poptOption options_basic[] = { > "Number of cluster nodes" }, > { "debug", 'd', POPT_ARG_STRING, &_values.debugstr, 0, > "Debug level" }, >+ { "interactive", 'i', POPT_ARG_NONE, &_values.interactive, 0, >+ "Interactive output" }, > { NULL } > }; > >@@ -69,6 +71,7 @@ static void set_defaults_basic(struct test_options *opts) > opts->timelimit = 10; > opts->num_nodes = 1; > opts->debugstr = "ERR"; >+ opts->interactive = 0; > > ctdb_socket = getenv("CTDB_SOCKET"); > if (ctdb_socket != NULL) { >diff --git a/ctdb/tests/src/test_options.h b/ctdb/tests/src/test_options.h >index d299f4b..4874dd2 100644 >--- a/ctdb/tests/src/test_options.h >+++ b/ctdb/tests/src/test_options.h >@@ -26,6 +26,7 @@ struct test_options { > int timelimit; > int num_nodes; > const char *debugstr; >+ int interactive; > > /* Database options */ > const char *dbname; >-- >2.8.1 > > >From 02e6f2de8eb4a8245f7965011c18b2649e678a86 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 2 Aug 2016 14:19:18 +1000 >Subject: [PATCH 03/10] ctdb-tests: Implement --interactive/-i option in > message_ring > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit fbb3ef46b99f4e3ccf710367e50f8b9f89fee52c) >--- > ctdb/tests/src/message_ring.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > >diff --git a/ctdb/tests/src/message_ring.c b/ctdb/tests/src/message_ring.c >index a5d138b..2c8aa50 100644 >--- a/ctdb/tests/src/message_ring.c >+++ b/ctdb/tests/src/message_ring.c >@@ -34,6 +34,7 @@ struct message_ring_state { > struct ctdb_client_context *client; > int num_nodes; > int timelimit; >+ int interactive; > int msg_count; > int msg_plus, msg_minus; > struct timeval start_time; >@@ -50,7 +51,8 @@ static void message_ring_finish(struct tevent_req *subreq); > static struct tevent_req *message_ring_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct ctdb_client_context *client, >- int num_nodes, int timelimit) >+ int num_nodes, int timelimit, >+ int interactive) > { > struct tevent_req *req, *subreq; > struct message_ring_state *state; >@@ -64,6 +66,7 @@ static struct tevent_req *message_ring_send(TALLOC_CTX *mem_ctx, > state->client = client; > state->num_nodes = num_nodes; > state->timelimit = timelimit; >+ state->interactive = interactive; > > subreq = ctdb_client_set_message_handler_send( > state, state->ev, state->client, >@@ -162,12 +165,12 @@ static void message_ring_each_second(struct tevent_req *subreq) > } > > pnn = ctdb_client_pnn(state->client); >- if (pnn == 0) { >+ if (pnn == 0 && state->interactive == 1) { > double t; > > t = timeval_elapsed(&state->start_time); >- printf("Ring: %.2f msgs/sec (+ve=%d -ve=%d)\r", >- state->msg_count / t, >+ printf("Ring[%u]: %.2f msgs/sec (+ve=%d -ve=%d)\n", >+ pnn, state->msg_count / t, > state->msg_plus, state->msg_minus); > fflush(stdout); > } >@@ -342,7 +345,8 @@ int main(int argc, const char *argv[]) > } > > req = message_ring_send(mem_ctx, ev, client, >- opts->num_nodes, opts->timelimit); >+ opts->num_nodes, opts->timelimit, >+ opts->interactive); > if (req == NULL) { > fprintf(stderr, "Memory allocation error\n"); > exit(1); >-- >2.8.1 > > >From dc0ff5cb411c07e6890e5c4a74fa59c8f1525859 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 2 Aug 2016 14:47:39 +1000 >Subject: [PATCH 04/10] ctdb-tests: Clean up and rename simple message_ring > test > >* Rename to clarify purpose of test > >* Simplify test info to avoid unnecessary bit-rot > >* Have message_ring print PNN for clearer output and update patterns > in test script to suit. > >* Drop quantitative percentage check since this is hard to predict > when under extreme load. To compensate, tighten up expectations for > the total number of messages in each direction: at least 10 messages > are required over 10 seconds. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit e7a220377ec14090435f448c9a900f8f8e852a77) >--- > ctdb/tests/simple/51_ctdb_bench.sh | 92 ------------------------------------ > ctdb/tests/simple/51_message_ring.sh | 66 ++++++++++++++++++++++++++ > ctdb/tests/src/message_ring.c | 5 +- > 3 files changed, 69 insertions(+), 94 deletions(-) > delete mode 100755 ctdb/tests/simple/51_ctdb_bench.sh > create mode 100755 ctdb/tests/simple/51_message_ring.sh > >diff --git a/ctdb/tests/simple/51_ctdb_bench.sh b/ctdb/tests/simple/51_ctdb_bench.sh >deleted file mode 100755 >index b8d6e5a..0000000 >--- a/ctdb/tests/simple/51_ctdb_bench.sh >+++ /dev/null >@@ -1,92 +0,0 @@ >-#!/bin/bash >- >-test_info() >-{ >- cat <<EOF >-Run the ctdb_bench test and sanity check the output. >- >-This doesn't test for performance regressions or similarly anything >-useful. Only vague sanity checking of results is done. >- >-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 ctdb_bench on all nodes with default options. >-3. Ensure that the number of +ve and -ive messages are within 1% of >- each other. >-4. Ensure that the number of messages per second is greater than 10. >- >-Expected results: >- >-* ctdb_bench runs without error and prints reasonable results. >-EOF >-} >- >-. "${TEST_SCRIPTS_DIR}/integration.bash" >- >-ctdb_test_init "$@" >- >-set -e >- >-cluster_is_healthy >- >-try_command_on_node 0 "$CTDB listnodes" >-num_nodes=$(echo "$out" | wc -l) >- >-echo "Running ctdb_bench on all $num_nodes nodes." >-try_command_on_node -v -p all $CTDB_TEST_WRAPPER $VALGRIND message_ring -n $num_nodes >- >-# Get the last line of output. >-while read line ; do >- prev=$line >-done <<<"$out" >- >-pat='^(Ring: [[:digit:]]+(\.[[:digit:]]+)? msgs/sec \(\+ve=[[:digit:]]+ -ve=[[:digit:]]+\)[[:space:]]?|Waiting for cluster[[:space:]]?)+$' >-sanity_check_output 1 "$pat" "$out" >- >-# $prev should look like this: >-# Ring: 10670.93 msgs/sec (+ve=53391 -ve=53373) >-stuff="${prev##*Ring: }" >-mps="${stuff% msgs/sec*}" >- >-if [ ${mps%.*} -ge 10 ] ; then >- echo "OK: $mps msgs/sec >= 10 msgs/sec" >-else >- echo "BAD: $mps msgs/sec < 10 msgs/sec" >- exit 1 >-fi >- >-stuff="${stuff#*msgs/sec (+ve=}" >-positive="${stuff%% *}" >- >-if [ $positive -gt 0 ] ; then >- echo "OK: +ive ($positive) > 0" >-else >- echo "BAD: +ive ($positive) = 0" >- exit 1 >-fi >- >-stuff="${stuff#*-ve=}" >-negative="${stuff%)}" >- >-if [ $negative -gt 0 ] ; then >- echo "OK: -ive ($negative) > 0" >-else >- echo "BAD: -ive ($negative) = 0" >- exit 1 >-fi >- >-perc_diff=$(( ($positive - $negative) * 100 / $positive )) >-perc_diff=${perc_diff#-} >- >-check_percent=5 >-if [ $perc_diff -le $check_percent ] ; then >- echo "OK: percentage difference between +ive and -ive ($perc_diff%) <= $check_percent%" >-else >- echo "BAD: percentage difference between +ive and -ive ($perc_diff%) > $check_percent%" >- exit 1 >-fi >diff --git a/ctdb/tests/simple/51_message_ring.sh b/ctdb/tests/simple/51_message_ring.sh >new file mode 100755 >index 0000000..e1bdab3 >--- /dev/null >+++ b/ctdb/tests/simple/51_message_ring.sh >@@ -0,0 +1,66 @@ >+#!/bin/bash >+ >+test_info() >+{ >+ cat <<EOF >+Run the message_ring test and sanity check the output. >+ >+Prerequisites: >+ >+* An active CTDB cluster with at least 2 active nodes. >+EOF >+} >+ >+. "${TEST_SCRIPTS_DIR}/integration.bash" >+ >+ctdb_test_init "$@" >+ >+set -e >+ >+cluster_is_healthy >+ >+try_command_on_node 0 "$CTDB listnodes" >+num_nodes=$(echo "$out" | wc -l) >+ >+echo "Running message_ring on all $num_nodes nodes." >+try_command_on_node -v -p all $CTDB_TEST_WRAPPER $VALGRIND message_ring -n $num_nodes >+ >+# Get the last line of output. >+while read line ; do >+ prev=$line >+done <<<"$out" >+ >+pat='^(Waiting for cluster|Ring\[[[:digit:]]+\]: [[:digit:]]+(\.[[:digit:]]+)? msgs/sec \(\+ve=[[:digit:]]+ -ve=[[:digit:]]+\))$' >+sanity_check_output 1 "$pat" "$out" >+ >+# $prev should look like this: >+# Ring[1]: 10670.93 msgs/sec (+ve=53391 -ve=53373) >+stuff="${prev##Ring\[*\]: }" >+mps="${stuff% msgs/sec*}" >+ >+if [ ${mps%.*} -ge 10 ] ; then >+ echo "OK: $mps msgs/sec >= 10 msgs/sec" >+else >+ echo "BAD: $mps msgs/sec < 10 msgs/sec" >+ exit 1 >+fi >+ >+stuff="${stuff#*msgs/sec (+ve=}" >+positive="${stuff%% *}" >+ >+if [ $positive -ge 10 ] ; then >+ echo "OK: +ive ($positive) >= 10" >+else >+ echo "BAD: +ive ($positive) < 10" >+ exit 1 >+fi >+ >+stuff="${stuff#*-ve=}" >+negative="${stuff%)}" >+ >+if [ $negative -ge 10 ] ; then >+ echo "OK: -ive ($negative) >= 10" >+else >+ echo "BAD: -ive ($negative) < 10" >+ exit 1 >+fi >diff --git a/ctdb/tests/src/message_ring.c b/ctdb/tests/src/message_ring.c >index 2c8aa50..dabae65 100644 >--- a/ctdb/tests/src/message_ring.c >+++ b/ctdb/tests/src/message_ring.c >@@ -290,8 +290,9 @@ static void message_ring_finish(struct tevent_req *subreq) > > t = timeval_elapsed(&state->start_time); > >- printf("Ring: %.2f msgs/sec (+ve=%d -ve=%d)\n", >- state->msg_count / t, state->msg_plus, state->msg_minus); >+ printf("Ring[%u]: %.2f msgs/sec (+ve=%d -ve=%d)\n", >+ ctdb_client_pnn(state->client), state->msg_count / t, >+ state->msg_plus, state->msg_minus); > > tevent_req_done(req); > } >-- >2.8.1 > > >From 93e57406b72008777e150e4c48a04eb5c010d26a Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 2 Aug 2016 14:36:45 +1000 >Subject: [PATCH 05/10] ctdb-tests: Implement --interactive/-i option in fetch > ring > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 82cffc2f5759fb73bba37e45fc20b24b30ab0438) >--- > ctdb/tests/src/fetch_ring.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > >diff --git a/ctdb/tests/src/fetch_ring.c b/ctdb/tests/src/fetch_ring.c >index b5a63df..c875aed 100644 >--- a/ctdb/tests/src/fetch_ring.c >+++ b/ctdb/tests/src/fetch_ring.c >@@ -43,6 +43,7 @@ struct fetch_ring_state { > struct ctdb_db_context *ctdb_db; > int num_nodes; > int timelimit; >+ int interactive; > TDB_DATA key; > int msg_count; > struct timeval start_time; >@@ -61,7 +62,8 @@ static struct tevent_req *fetch_ring_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct ctdb_client_context *client, > struct ctdb_db_context *ctdb_db, >- int num_nodes, int timelimit) >+ int num_nodes, int timelimit, >+ int interactive) > { > struct tevent_req *req, *subreq; > struct fetch_ring_state *state; >@@ -76,6 +78,7 @@ static struct tevent_req *fetch_ring_send(TALLOC_CTX *mem_ctx, > state->ctdb_db = ctdb_db; > state->num_nodes = num_nodes; > state->timelimit = timelimit; >+ state->interactive = interactive; > state->key.dptr = discard_const(TESTKEY); > state->key.dsize = strlen(TESTKEY); > >@@ -294,7 +297,9 @@ static void fetch_ring_final_read(struct tevent_req *subreq) > return; > } > >- printf("DATA:\n%s\n", (char *)data.dptr); >+ if (state->interactive == 1) { >+ printf("DATA:\n%s\n", (char *)data.dptr); >+ } > talloc_free(data.dptr); > talloc_free(h); > >@@ -361,7 +366,8 @@ int main(int argc, const char *argv[]) > } > > req = fetch_ring_send(mem_ctx, ev, client, ctdb_db, >- opts->num_nodes, opts->timelimit); >+ opts->num_nodes, opts->timelimit, >+ opts->interactive); > if (req == NULL) { > fprintf(stderr, "Memory allocation error\n"); > exit(1); >-- >2.8.1 > > >From 512207cbacff3d846efba9b434d1cfb840ac6091 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 2 Aug 2016 14:42:45 +1000 >Subject: [PATCH 06/10] ctdb-tests: Clean up and rename simple fetch_ring test > >* Rename to clarify purpose of test > >* Simplify test info to avoid unnecessary bit-rot > >* Have fetch_ring print PNN for clearer output and update patterns in > test script to suit > >* Simplify sanity checking pattern due to less data because of > --interactive/-i option > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit c10dcc7b91df62f740a4789763234f8bb2f0a27f) >--- > ctdb/tests/simple/52_ctdb_fetch.sh | 64 -------------------------------------- > ctdb/tests/simple/52_fetch_ring.sh | 46 +++++++++++++++++++++++++++ > ctdb/tests/src/fetch_ring.c | 3 +- > 3 files changed, 48 insertions(+), 65 deletions(-) > delete mode 100755 ctdb/tests/simple/52_ctdb_fetch.sh > create mode 100755 ctdb/tests/simple/52_fetch_ring.sh > >diff --git a/ctdb/tests/simple/52_ctdb_fetch.sh b/ctdb/tests/simple/52_ctdb_fetch.sh >deleted file mode 100755 >index 60beef2..0000000 >--- a/ctdb/tests/simple/52_ctdb_fetch.sh >+++ /dev/null >@@ -1,64 +0,0 @@ >-#!/bin/bash >- >-test_info() >-{ >- cat <<EOF >-Run the ctdb_fetch test and sanity check the output. >- >-This doesn't test for performance regressions or similarly anything >-useful. Only vague sanity checking of results is done. >- >-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 ctdb_fetch on all nodes with default options. >-3. Ensure that the number of +ve and -ive messages are within 1% of >- each other. >-4. Ensure that the number of messages per second is greater than 10. >- >-Expected results: >- >-* ctdb_fetch runs without error and prints reasonable results. >-EOF >-} >- >-. "${TEST_SCRIPTS_DIR}/integration.bash" >- >-ctdb_test_init "$@" >- >-set -e >- >-cluster_is_healthy >- >-try_command_on_node 0 "$CTDB listnodes" >-num_nodes=$(echo "$out" | wc -l) >- >-echo "Running ctdb_fetch on all $num_nodes nodes." >-try_command_on_node -v -p all $CTDB_TEST_WRAPPER $VALGRIND fetch_ring -n $num_nodes >- >-pat='^(Fetch: [[:digit:]]+(\.[[:digit:]]+)? msgs/sec[[:space:]]?|msg_count=[[:digit:]]+ on node [[:digit:]]|Fetching final record|DATA:|Test data|Waiting for cluster[[:space:]]?|.*: Reqid wrap!|Sleeping for [[:digit:]]+ seconds|)+$' >-sanity_check_output 1 "$pat" "$out" >- >-# Filter out the performance figures: >-out_fetch=$(echo "$out" | egrep '^(Fetch: .*)+$') >- >-# Get the last line of output. >-while read line ; do >- prev=$line >-done <<<"$out_fetch" >- >-# $prev should look like this: >-# Fetch: 10670.93 msgs/sec >-stuff="${prev##*Fetch: }" >-mps="${stuff% msgs/sec*}" >- >-if [ ${mps%.*} -ge 10 ] ; then >- echo "OK: $mps msgs/sec >= 10 msgs/sec" >-else >- echo "BAD: $mps msgs/sec < 10 msgs/sec" >- exit 1 >-fi >diff --git a/ctdb/tests/simple/52_fetch_ring.sh b/ctdb/tests/simple/52_fetch_ring.sh >new file mode 100755 >index 0000000..81e6a7a >--- /dev/null >+++ b/ctdb/tests/simple/52_fetch_ring.sh >@@ -0,0 +1,46 @@ >+#!/bin/bash >+ >+test_info() >+{ >+ cat <<EOF >+Run the fetch_ring test and sanity check the output. >+ >+Prerequisites: >+ >+* An active CTDB cluster with at least 2 active nodes. >+EOF >+} >+ >+. "${TEST_SCRIPTS_DIR}/integration.bash" >+ >+ctdb_test_init "$@" >+ >+set -e >+ >+cluster_is_healthy >+ >+try_command_on_node 0 "$CTDB listnodes" >+num_nodes=$(echo "$out" | wc -l) >+ >+echo "Running fetch_ring on all $num_nodes nodes." >+try_command_on_node -v -p all $CTDB_TEST_WRAPPER $VALGRIND fetch_ring -n $num_nodes >+ >+pat='^(Waiting for cluster|Fetch\[[[:digit:]]+\]: [[:digit:]]+(\.[[:digit:]]+)? msgs/sec)$' >+sanity_check_output 1 "$pat" "$out" >+ >+# Get the last line of output. >+while read line ; do >+ prev=$line >+done <<<"$out" >+ >+# $prev should look like this: >+# Fetch[1]: 10670.93 msgs/sec >+stuff="${prev##*Fetch\[*\]: }" >+mps="${stuff% msgs/sec*}" >+ >+if [ ${mps%.*} -ge 10 ] ; then >+ echo "OK: $mps msgs/sec >= 10 msgs/sec" >+else >+ echo "BAD: $mps msgs/sec < 10 msgs/sec" >+ exit 1 >+fi >diff --git a/ctdb/tests/src/fetch_ring.c b/ctdb/tests/src/fetch_ring.c >index c875aed..eb64648 100644 >--- a/ctdb/tests/src/fetch_ring.c >+++ b/ctdb/tests/src/fetch_ring.c >@@ -270,7 +270,8 @@ static void fetch_ring_finish(struct tevent_req *subreq) > > t = timeval_elapsed(&state->start_time); > >- printf("Fetch: %.2f msgs/sec\n", state->msg_count / t); >+ printf("Fetch[%u]: %.2f msgs/sec\n", ctdb_client_pnn(state->client), >+ state->msg_count / t); > > subreq = ctdb_fetch_lock_send(state, state->ev, state->client, > state->ctdb_db, state->key, false); >-- >2.8.1 > > >From 16a1fc3cb4a2206edb5d0ff7aca8c1767c6fd4a2 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 2 Aug 2016 15:00:54 +1000 >Subject: [PATCH 07/10] ctdb-tests: Implement --interactive/-i option in > transaction_loop > >Also add PNNs to output. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 18b41fcb51942ebcd4041fe3e3694712a5a5e43a) >--- > ctdb/tests/src/transaction_loop.c | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) > >diff --git a/ctdb/tests/src/transaction_loop.c b/ctdb/tests/src/transaction_loop.c >index 660270c..3b325fd 100644 >--- a/ctdb/tests/src/transaction_loop.c >+++ b/ctdb/tests/src/transaction_loop.c >@@ -36,6 +36,7 @@ struct transaction_loop_state { > struct ctdb_db_context *ctdb_db; > int num_nodes; > int timelimit; >+ int interactive; > TDB_DATA key; > uint32_t pnn; > struct ctdb_transaction_handle *h; >@@ -55,7 +56,7 @@ static struct tevent_req *transaction_loop_send( > struct tevent_context *ev, > struct ctdb_client_context *client, > struct ctdb_db_context *ctdb_db, >- int num_nodes, int timelimit) >+ int num_nodes, int timelimit, int interactive) > { > struct tevent_req *req, *subreq; > struct transaction_loop_state *state; >@@ -71,6 +72,7 @@ static struct tevent_req *transaction_loop_send( > state->ctdb_db = ctdb_db; > state->num_nodes = num_nodes; > state->timelimit = timelimit; >+ state->interactive = interactive; > state->key.dptr = discard_const(TESTKEY); > state->key.dsize = strlen(TESTKEY); > state->pnn = ctdb_client_pnn(client); >@@ -248,11 +250,14 @@ static void transaction_loop_each_second(struct tevent_req *subreq) > return; > } > >- for (i=0; i<state->num_nodes; i++) { >- printf("%6u ", state->counter[i]); >+ if (state->interactive == 1) { >+ printf("Transaction[%u]: ", ctdb_client_pnn(state->client)); >+ for (i=0; i<state->num_nodes; i++) { >+ printf("%6u ", state->counter[i]); >+ } >+ printf("\n"); >+ fflush(stdout); > } >- printf("\n"); >- fflush(stdout); > > subreq = tevent_wakeup_send(state, state->ev, > tevent_timeval_current_ofs(1, 0)); >@@ -304,6 +309,7 @@ static void transaction_loop_finish(struct tevent_req *subreq) > return; > } > >+ printf("Transaction[%u]: ", ctdb_client_pnn(state->client)); > for (i=0; i<state->num_nodes; i++) { > printf("%6u ", state->counter[i]); > } >@@ -373,7 +379,8 @@ int main(int argc, const char *argv[]) > } > > req = transaction_loop_send(mem_ctx, ev, client, ctdb_db, >- opts->num_nodes, opts->timelimit); >+ opts->num_nodes, opts->timelimit, >+ opts->interactive); > if (req == NULL) { > fprintf(stderr, "Memory allocation error\n"); > exit(1); >-- >2.8.1 > > >From e0f8891053bbbf45f4a44e6c5a11cac433c56844 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 2 Aug 2016 14:50:31 +1000 >Subject: [PATCH 08/10] ctdb-tests: Clean up and rename simple transaction_loop > test > >* Rename to clarify purpose of test > >* Simplify test info to avoid unnecessary bit-rot > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit de04cd578416168290c51f7c4e326b864ab425a4) >--- > ctdb/tests/simple/53_ctdb_transaction.sh | 47 -------------------------------- > ctdb/tests/simple/53_transaction_loop.sh | 36 ++++++++++++++++++++++++ > 2 files changed, 36 insertions(+), 47 deletions(-) > delete mode 100755 ctdb/tests/simple/53_ctdb_transaction.sh > create mode 100755 ctdb/tests/simple/53_transaction_loop.sh > >diff --git a/ctdb/tests/simple/53_ctdb_transaction.sh b/ctdb/tests/simple/53_ctdb_transaction.sh >deleted file mode 100755 >index e48ecc1..0000000 >--- a/ctdb/tests/simple/53_ctdb_transaction.sh >+++ /dev/null >@@ -1,47 +0,0 @@ >-#!/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 >-} >- >-. "${TEST_SCRIPTS_DIR}/integration.bash" >- >-ctdb_test_init "$@" >- >-set -e >- >-cluster_is_healthy >- >-try_command_on_node 0 "$CTDB attach transaction_loop.tdb persistent" >-try_command_on_node 0 "$CTDB wipedb transaction_loop.tdb" >- >-try_command_on_node 0 "$CTDB listnodes" >-num_nodes=$(echo "$out" | wc -l) >- >-if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then >- CTDB_TEST_TIMELIMIT=30 >-fi >- >-t="$CTDB_TEST_WRAPPER $VALGRIND transaction_loop \ >- -n ${num_nodes} -t ${CTDB_TEST_TIMELIMIT}" >- >-echo "Running ctdb_transaction on all $num_nodes nodes." >-try_command_on_node -v -p all "$t" >diff --git a/ctdb/tests/simple/53_transaction_loop.sh b/ctdb/tests/simple/53_transaction_loop.sh >new file mode 100755 >index 0000000..f00fe1e >--- /dev/null >+++ b/ctdb/tests/simple/53_transaction_loop.sh >@@ -0,0 +1,36 @@ >+#!/bin/bash >+ >+test_info() >+{ >+ cat <<EOF >+Verify that the transaction_loop test succeeds. >+ >+Prerequisites: >+ >+* An active CTDB cluster with at least 2 active nodes. >+EOF >+} >+ >+. "${TEST_SCRIPTS_DIR}/integration.bash" >+ >+ctdb_test_init "$@" >+ >+set -e >+ >+cluster_is_healthy >+ >+try_command_on_node 0 "$CTDB attach transaction_loop.tdb persistent" >+try_command_on_node 0 "$CTDB wipedb transaction_loop.tdb" >+ >+try_command_on_node 0 "$CTDB listnodes" >+num_nodes=$(echo "$out" | wc -l) >+ >+if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then >+ CTDB_TEST_TIMELIMIT=30 >+fi >+ >+t="$CTDB_TEST_WRAPPER $VALGRIND transaction_loop \ >+ -n ${num_nodes} -t ${CTDB_TEST_TIMELIMIT}" >+ >+echo "Running transaction_loop on all $num_nodes nodes." >+try_command_on_node -v -p all "$t" >-- >2.8.1 > > >From 5cc4639b2f57418f5661ec75359e740e8f338ca5 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 2 Aug 2016 14:52:14 +1000 >Subject: [PATCH 09/10] ctdb-tests: Clean up and rename simple transaction_loop > recovery test > >* Rename to clarify purpose of test > >* Simplify test info to avoid unnecessary bit-rot > >* Restart after test since test does heavy database manipulation > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 8ce8e1d7f8c05158f0f5f4e673f3d9a40f94f00d) >--- > ctdb/tests/simple/54_ctdb_transaction_recovery.sh | 70 ----------------------- > ctdb/tests/simple/54_transaction_loop_recovery.sh | 60 +++++++++++++++++++ > 2 files changed, 60 insertions(+), 70 deletions(-) > delete mode 100755 ctdb/tests/simple/54_ctdb_transaction_recovery.sh > create mode 100755 ctdb/tests/simple/54_transaction_loop_recovery.sh > >diff --git a/ctdb/tests/simple/54_ctdb_transaction_recovery.sh b/ctdb/tests/simple/54_ctdb_transaction_recovery.sh >deleted file mode 100755 >index 3918c33..0000000 >--- a/ctdb/tests/simple/54_ctdb_transaction_recovery.sh >+++ /dev/null >@@ -1,70 +0,0 @@ >-#!/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 >- try_command_on_node 0 $CTDB recover >- sleep 2 >- COUNT=$((COUNT + 1)) >- done >-} >- >-recovery_loop_start() >-{ >- recovery_loop >/dev/null & >- RECLOOP_PID=$! >- ctdb_test_exit_hook_add "kill $RECLOOP_PID >/dev/null 2>&1" >-} >- >-. "${TEST_SCRIPTS_DIR}/integration.bash" >- >-ctdb_test_init "$@" >- >-set -e >- >-cluster_is_healthy >- >-try_command_on_node 0 "$CTDB attach transaction_loop.tdb persistent" >-try_command_on_node 0 "$CTDB wipedb transaction_loop.tdb" >- >-try_command_on_node 0 "$CTDB listnodes" >-num_nodes=$(echo "$out" | wc -l) >- >-if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then >- CTDB_TEST_TIMELIMIT=30 >-fi >- >-t="$CTDB_TEST_WRAPPER $VALGRIND transaction_loop \ >- -n ${num_nodes} -t ${CTDB_TEST_TIMELIMIT}" >- >-echo "Starting recovery loop" >-recovery_loop_start >- >-echo "Running ctdb_transaction on all $num_nodes nodes." >-try_command_on_node -v -p all "$t" >- >diff --git a/ctdb/tests/simple/54_transaction_loop_recovery.sh b/ctdb/tests/simple/54_transaction_loop_recovery.sh >new file mode 100755 >index 0000000..db70c1b >--- /dev/null >+++ b/ctdb/tests/simple/54_transaction_loop_recovery.sh >@@ -0,0 +1,60 @@ >+#!/bin/bash >+ >+test_info() >+{ >+ cat <<EOF >+Verify that the transaction_loop test succeeds with recoveries. >+ >+Prerequisites: >+ >+* An active CTDB cluster with at least 2 active nodes. >+EOF >+} >+ >+recovery_loop() >+{ >+ local COUNT=1 >+ >+ while true ; do >+ echo Recovery $COUNT >+ try_command_on_node 0 $CTDB recover >+ sleep 2 >+ COUNT=$((COUNT + 1)) >+ done >+} >+ >+recovery_loop_start() >+{ >+ recovery_loop >/dev/null & >+ RECLOOP_PID=$! >+ ctdb_test_exit_hook_add "kill $RECLOOP_PID >/dev/null 2>&1" >+} >+ >+. "${TEST_SCRIPTS_DIR}/integration.bash" >+ >+ctdb_test_init "$@" >+ >+set -e >+ >+cluster_is_healthy >+ >+ctdb_restart_when_done >+ >+try_command_on_node 0 "$CTDB attach transaction_loop.tdb persistent" >+try_command_on_node 0 "$CTDB wipedb transaction_loop.tdb" >+ >+try_command_on_node 0 "$CTDB listnodes" >+num_nodes=$(echo "$out" | wc -l) >+ >+if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then >+ CTDB_TEST_TIMELIMIT=30 >+fi >+ >+t="$CTDB_TEST_WRAPPER $VALGRIND transaction_loop \ >+ -n ${num_nodes} -t ${CTDB_TEST_TIMELIMIT}" >+ >+echo "Starting recovery loop" >+recovery_loop_start >+ >+echo "Running transaction_loop on all $num_nodes nodes." >+try_command_on_node -v -p all "$t" >-- >2.8.1 > > >From 0e99d2e79b2f6d906453fa8dc63f4d9871702161 Mon Sep 17 00:00:00 2001 >From: Amitay Isaacs <amitay@gmail.com> >Date: Thu, 28 Jul 2016 16:21:44 +1000 >Subject: [PATCH 10/10] ctdb-tests: Add explicit wait to the fork_helper() > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109 > >To create a client process that waits after connect(), instead of trying >to do a blocking write(), go to sleep. The parent can then kill the client >process, once testing is done. > >Signed-off-by: Amitay Isaacs <amitay@gmail.com> >Reviewed-by: Martin Schwenke <martin@meltin.net> >(cherry picked from commit 049dd07b909dc56a246799f8a96235989a5a605f) >--- > ctdb/tests/src/porting_tests.c | 17 ++++++----------- > 1 file changed, 6 insertions(+), 11 deletions(-) > >diff --git a/ctdb/tests/src/porting_tests.c b/ctdb/tests/src/porting_tests.c >index c956287..146218f 100644 >--- a/ctdb/tests/src/porting_tests.c >+++ b/ctdb/tests/src/porting_tests.c >@@ -132,16 +132,6 @@ static int socket_client_connect(void) > return client; > } > >-static int socket_client_write(int client) >-{ >- int ret; >- >- ret = sys_write(client, "\0", 1); >- assert(ret == 1); >- >- return 0; >-} >- > static int socket_client_close(int client) > { > int ret; >@@ -164,8 +154,11 @@ static int fork_helper(void) > assert(pid != -1); > > if (pid == 0) { // Child >+ pid = getppid(); > client = socket_client_connect(); >- socket_client_write(client); >+ while (kill(pid, 0) == 0) { >+ sleep(1); >+ } > socket_client_close(client); > exit(0); > } else { >@@ -204,6 +197,8 @@ static int test_ctdb_get_peer_pid(void) > > assert(peer_pid == globals.helper_pid); > >+ kill(peer_pid, SIGTERM); >+ > close(fd); > return 0; > } >-- >2.8.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
amitay
:
review+
Actions:
View
Attachments on
bug 12109
: 12328