Skip to content

Commit

Permalink
ctdb-recovery: Drop unnecessary database push wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Schwenke <[email protected]>
Reviewed-by: Amitay Isaacs <[email protected]>
  • Loading branch information
martin-schwenke authored and Amitay Isaacs committed Sep 11, 2020
1 parent 225a699 commit f4e2206
Showing 1 changed file with 8 additions and 68 deletions.
76 changes: 8 additions & 68 deletions ctdb/server/ctdb_recovery_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,67 +1195,6 @@ static bool push_database_new_recv(struct tevent_req *req, int *perr)
return generic_recv(req, perr);
}

/*
* wrapper for push_database_new
*/

struct push_database_state {
};

static void push_database_new_done(struct tevent_req *subreq);

static struct tevent_req *push_database_send(
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct ctdb_client_context *client,
struct node_list *nlist,
struct ctdb_tunable_list *tun_list,
struct recdb_context *recdb)
{
struct tevent_req *req, *subreq;
struct push_database_state *state;

req = tevent_req_create(mem_ctx, &state, struct push_database_state);
if (req == NULL) {
return NULL;
}

subreq = push_database_new_send(state,
ev,
client,
nlist->pnn_list,
nlist->count,
recdb,
tun_list->rec_buffer_size_limit);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
tevent_req_set_callback(subreq, push_database_new_done, req);

return req;
}

static void push_database_new_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(
subreq, struct tevent_req);
bool status;
int ret;

status = push_database_new_recv(subreq, &ret);
if (! status) {
tevent_req_error(req, ret);
return;
}

tevent_req_done(req);
}

static bool push_database_recv(struct tevent_req *req, int *perr)
{
return generic_recv(req, perr);
}

/*
* Collect databases using highest sequence number
*/
Expand Down Expand Up @@ -1933,12 +1872,13 @@ static void recover_db_wipedb_done(struct tevent_req *subreq)
return;
}

subreq = push_database_send(state,
state->ev,
state->client,
state->nlist,
state->tun_list,
state->recdb);
subreq = push_database_new_send(state,
state->ev,
state->client,
state->nlist->pnn_list,
state->nlist->count,
state->recdb,
state->tun_list->rec_buffer_size_limit);
if (tevent_req_nomem(subreq, req)) {
return;
}
Expand All @@ -1955,7 +1895,7 @@ static void recover_db_pushdb_done(struct tevent_req *subreq)
int ret;
bool status;

status = push_database_recv(subreq, &ret);
status = push_database_new_recv(subreq, &ret);
TALLOC_FREE(subreq);
if (! status) {
tevent_req_error(req, ret);
Expand Down

0 comments on commit f4e2206

Please sign in to comment.