mirror of
https://github.com/samba-team/samba.git
synced 2025-03-12 20:58:37 +03:00
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 <amitay@gmail.com> Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
2aa006a311
commit
d67d8ed44a
@ -39,6 +39,7 @@ struct transaction_loop_state {
|
|||||||
struct ctdb_transaction_handle *h;
|
struct ctdb_transaction_handle *h;
|
||||||
uint32_t *old_counter, *counter;
|
uint32_t *old_counter, *counter;
|
||||||
struct tevent_req *subreq;
|
struct tevent_req *subreq;
|
||||||
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void transaction_loop_start(struct tevent_req *subreq);
|
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; i<state->num_nodes; i++) {
|
||||||
|
printf("%6u ", state->counter[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
tevent_req_done(req);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
subreq = ctdb_transaction_start_send(state, state->ev, state->client,
|
subreq = ctdb_transaction_start_send(state, state->ev, state->client,
|
||||||
tevent_timeval_current_ofs(
|
tevent_timeval_current_ofs(
|
||||||
state->timelimit, 0),
|
state->timelimit, 0),
|
||||||
@ -299,23 +314,16 @@ static void transaction_loop_finish(struct tevent_req *subreq)
|
|||||||
struct transaction_loop_state *state = tevent_req_data(
|
struct transaction_loop_state *state = tevent_req_data(
|
||||||
req, struct transaction_loop_state);
|
req, struct transaction_loop_state);
|
||||||
bool status;
|
bool status;
|
||||||
int i;
|
|
||||||
|
|
||||||
status = tevent_wakeup_recv(subreq);
|
status = tevent_wakeup_recv(subreq);
|
||||||
TALLOC_FREE(subreq);
|
TALLOC_FREE(subreq);
|
||||||
TALLOC_FREE(state->subreq);
|
|
||||||
|
state->done = true;
|
||||||
|
|
||||||
if (! status) {
|
if (! status) {
|
||||||
tevent_req_error(req, EIO);
|
tevent_req_error(req, EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Transaction[%u]: ", ctdb_client_pnn(state->client));
|
|
||||||
for (i=0; i<state->num_nodes; i++) {
|
|
||||||
printf("%6u ", state->counter[i]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
tevent_req_done(req);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool transaction_loop_recv(struct tevent_req *req, int *perr)
|
static bool transaction_loop_recv(struct tevent_req *req, int *perr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user