mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-call: Convert pending calls list to per database list
The pending calls are migration requests received from clients (over unix domain socket) which are under processing. After a recovery is finished, any requests which are under processing will be dropped since they do not belong to the current generation. All the pending call requests are resent with new generation to restart record migrations. This is in preparation for parallel database recovery. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
2116c55b08
commit
6a212d13d0
@ -489,7 +489,6 @@ struct ctdb_context {
|
||||
struct ctdb_vnn_map *vnn_map;
|
||||
uint32_t num_clients;
|
||||
uint32_t recovery_master;
|
||||
struct ctdb_call_state *pending_calls;
|
||||
struct ctdb_client_ip *client_ip_list;
|
||||
bool do_checkpublicip;
|
||||
struct trbt_tree *server_ids;
|
||||
@ -584,6 +583,8 @@ struct ctdb_db_context {
|
||||
struct lock_context *lock_current;
|
||||
struct lock_context *lock_pending;
|
||||
int lock_num_current;
|
||||
|
||||
struct ctdb_call_state *pending_calls;
|
||||
};
|
||||
|
||||
|
||||
@ -1016,6 +1017,7 @@ int32_t ctdb_run_eventscripts(struct ctdb_context *ctdb, struct ctdb_req_control
|
||||
|
||||
|
||||
void ctdb_daemon_cancel_controls(struct ctdb_context *ctdb, struct ctdb_node *node);
|
||||
void ctdb_call_resend_db(struct ctdb_db_context *ctdb);
|
||||
void ctdb_call_resend_all(struct ctdb_context *ctdb);
|
||||
void ctdb_node_dead(struct ctdb_node *node);
|
||||
void ctdb_node_connected(struct ctdb_node *node);
|
||||
|
@ -1301,7 +1301,7 @@ void ctdb_reply_error(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
|
||||
*/
|
||||
static int ctdb_call_destructor(struct ctdb_call_state *state)
|
||||
{
|
||||
DLIST_REMOVE(state->ctdb_db->ctdb->pending_calls, state);
|
||||
DLIST_REMOVE(state->ctdb_db->pending_calls, state);
|
||||
ctdb_reqid_remove(state->ctdb_db->ctdb, state->reqid);
|
||||
return 0;
|
||||
}
|
||||
@ -1334,15 +1334,25 @@ static void ctdb_call_resend(struct ctdb_call_state *state)
|
||||
/*
|
||||
resend all pending calls on recovery
|
||||
*/
|
||||
void ctdb_call_resend_all(struct ctdb_context *ctdb)
|
||||
void ctdb_call_resend_db(struct ctdb_db_context *ctdb_db)
|
||||
{
|
||||
struct ctdb_call_state *state, *next;
|
||||
for (state=ctdb->pending_calls;state;state=next) {
|
||||
|
||||
for (state = ctdb_db->pending_calls; state; state = next) {
|
||||
next = state->next;
|
||||
ctdb_call_resend(state);
|
||||
}
|
||||
}
|
||||
|
||||
void ctdb_call_resend_all(struct ctdb_context *ctdb)
|
||||
{
|
||||
struct ctdb_db_context *ctdb_db;
|
||||
|
||||
for (ctdb_db = ctdb->db_list; ctdb_db; ctdb_db = ctdb_db->next) {
|
||||
ctdb_call_resend_db(ctdb_db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
this allows the caller to setup a async.fn
|
||||
*/
|
||||
@ -1445,7 +1455,7 @@ struct ctdb_call_state *ctdb_daemon_call_send_remote(struct ctdb_db_context *ctd
|
||||
state->state = CTDB_CALL_WAIT;
|
||||
state->generation = ctdb->vnn_map->generation;
|
||||
|
||||
DLIST_ADD(ctdb->pending_calls, state);
|
||||
DLIST_ADD(ctdb_db->pending_calls, state);
|
||||
|
||||
ctdb_queue_packet(ctdb, &state->c->hdr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user