From 2e2dba8d138c9a2e3bded22808e3557c8c11dd84 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 5 Jun 2015 16:35:48 +1000 Subject: ctdb-recoverd/vacuum: Remove vacuum_info structure For all the records listed in VACUUM_FETCH, migration requests are sent immediately without waiting. This means there can only be a single VACUUM_FETCH processing active at a time. Signed-off-by: Amitay Isaacs Reviewed-by: Michael Adam --- ctdb/server/ctdb_recoverd.c | 79 +++------------------------------------------ 1 file changed, 5 insertions(+), 74 deletions(-) (limited to 'ctdb') diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 002191f6628..57d313729ea 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -233,7 +233,6 @@ struct ctdb_recoverd { uint32_t node_flags; struct timed_event *send_election_te; struct timed_event *election_timeout; - struct vacuum_info *vacuum_info; struct srvid_requests *reallocate_requests; struct ctdb_op_state *takeover_run; struct ctdb_op_state *recovery; @@ -989,16 +988,6 @@ static int update_vnnmap_on_all_nodes(struct ctdb_context *ctdb, struct ctdb_nod } -struct vacuum_info { - struct vacuum_info *next, *prev; - struct ctdb_recoverd *rec; - uint32_t srcnode; - struct ctdb_db_context *ctdb_db; - struct ctdb_marshall_buffer *recs; - struct ctdb_rec_data *r; -}; - - /* called when a vacuum fetch has completed - just free it and do the next one */ @@ -1071,16 +1060,6 @@ static bool vacuum_fetch_process_one(struct ctdb_db_context *ctdb_db, } -/* - destroy a vacuum info structure - */ -static int vacuum_info_destructor(struct vacuum_info *v) -{ - DLIST_REMOVE(v->rec->vacuum_info, v); - return 0; -} - - /* handler for vacuum fetch */ @@ -1096,25 +1075,13 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid, bool persistent = false; struct ctdb_db_context *ctdb_db; struct ctdb_rec_data *r; - uint32_t srcnode; - struct vacuum_info *v; recs = (struct ctdb_marshall_buffer *)data.dptr; - r = (struct ctdb_rec_data *)&recs->data[0]; if (recs->count == 0) { goto done; } - srcnode = r->reqid; - - for (v=rec->vacuum_info;v;v=v->next) { - if (srcnode == v->srcnode && recs->db_id == v->ctdb_db->db_id) { - /* we're already working on records from this node */ - goto done; - } - } - /* work out if the database is persistent */ ret = ctdb_ctrl_getdbmap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &dbmap); if (ret != 0) { @@ -1146,43 +1113,19 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid, goto done; } - v = talloc_zero(rec, struct vacuum_info); - if (v == NULL) { - DEBUG(DEBUG_CRIT,(__location__ " Out of memory\n")); - goto done; - } - - v->rec = rec; - v->srcnode = srcnode; - v->ctdb_db = ctdb_db; - v->recs = talloc_memdup(v, recs, data.dsize); - if (v->recs == NULL) { - DEBUG(DEBUG_CRIT,(__location__ " Out of memory\n")); - talloc_free(v); - goto done; - } - v->r = (struct ctdb_rec_data *)&v->recs->data[0]; - - DLIST_ADD(rec->vacuum_info, v); - - talloc_set_destructor(v, vacuum_info_destructor); - - while (v->recs->count) { + r = (struct ctdb_rec_data *)&recs->data[0]; + while (recs->count) { bool ok; - r = v->r; - - ok = vacuum_fetch_process_one(v->ctdb_db, v->rec->ctdb->pnn, r); + ok = vacuum_fetch_process_one(ctdb_db, rec->ctdb->pnn, r); if (!ok) { break; } - v->r = (struct ctdb_rec_data *)(r->length + (uint8_t *)r); - v->recs->count--; + r = (struct ctdb_rec_data *)(r->length + (uint8_t *)r); + recs->count--; } - talloc_free(v); - done: talloc_free(tmp_ctx); } @@ -1197,7 +1140,6 @@ static void detach_database_handler(struct ctdb_context *ctdb, uint64_t srvid, struct ctdb_recoverd *rec = talloc_get_type(private_data, struct ctdb_recoverd); uint32_t db_id; - struct vacuum_info *v, *vnext; struct ctdb_db_context *ctdb_db; if (data.dsize != sizeof(db_id)) { @@ -1211,17 +1153,6 @@ static void detach_database_handler(struct ctdb_context *ctdb, uint64_t srvid, return; } - /* Stop any active vacuum fetch */ - v = rec->vacuum_info; - while (v != NULL) { - vnext = v->next; - - if (v->ctdb_db->db_id == db_id) { - talloc_free(v); - } - v = vnext; - } - DLIST_REMOVE(ctdb->db_list, ctdb_db); DEBUG(DEBUG_NOTICE, ("Detached from database '%s'\n", -- cgit v1.2.1