From: Martin Schwenke Date: Wed, 3 Oct 2018 06:39:16 +0000 (+1000) Subject: ctdb-tests: Shut down transaction_loop clients more cleanly X-Git-Tag: tdb-1.3.17~1425 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d67d8ed44ac9beba7fdec0ceda56136f781fe19b;p=thirdparty%2Fsamba.git ctdb-tests: Shut down transaction_loop clients more cleanly A transaction_loop client can exit with a transaction active when its time limit expires. This causes a recovery and causes problems with the test cleanup, which detects unwanted recoveries and fails. Set a flag when the time limit expires and exit cleanly before the next transaction is started. Pair-programmed-with: Amitay Isaacs Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/src/transaction_loop.c b/ctdb/tests/src/transaction_loop.c index a423d6817fd..c6bf35d963d 100644 --- a/ctdb/tests/src/transaction_loop.c +++ b/ctdb/tests/src/transaction_loop.c @@ -39,6 +39,7 @@ struct transaction_loop_state { struct ctdb_transaction_handle *h; uint32_t *old_counter, *counter; struct tevent_req *subreq; + bool done; }; static void transaction_loop_start(struct tevent_req *subreq); @@ -223,6 +224,20 @@ static void transaction_loop_committed(struct tevent_req *subreq) } } + if (state->done) { + int i; + + printf("Transaction[%u]: ", ctdb_client_pnn(state->client)); + for (i=0; inum_nodes; i++) { + printf("%6u ", state->counter[i]); + } + printf("\n"); + + tevent_req_done(req); + + return; + } + subreq = ctdb_transaction_start_send(state, state->ev, state->client, tevent_timeval_current_ofs( state->timelimit, 0), @@ -299,23 +314,16 @@ static void transaction_loop_finish(struct tevent_req *subreq) struct transaction_loop_state *state = tevent_req_data( req, struct transaction_loop_state); bool status; - int i; status = tevent_wakeup_recv(subreq); TALLOC_FREE(subreq); - TALLOC_FREE(state->subreq); + + state->done = true; + if (! status) { tevent_req_error(req, EIO); return; } - - printf("Transaction[%u]: ", ctdb_client_pnn(state->client)); - for (i=0; inum_nodes; i++) { - printf("%6u ", state->counter[i]); - } - printf("\n"); - - tevent_req_done(req); } static bool transaction_loop_recv(struct tevent_req *req, int *perr)