From 25da811d21215c7a2fc7e1dec09fb83891e790f1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2012 18:32:39 +0100 Subject: [PATCH] vacuum: reorder some of ctdb_process_delete_list() more intuitively Now that the nodemap and its talloc children don't hang off of the delete_records_list talloc context, we can build the nodemap and earlier, and move the construction of the delete_records_list to where it is more obvious what it is used for. Signed-off-by: Michael Adam --- server/ctdb_vacuum.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/server/ctdb_vacuum.c b/server/ctdb_vacuum.c index c09ec5f3..fdafd1a4 100644 --- a/server/ctdb_vacuum.c +++ b/server/ctdb_vacuum.c @@ -733,6 +733,27 @@ static int ctdb_process_delete_list(struct ctdb_db_context *ctdb_db, vdata->delete_left = vdata->delete_count; + /* + * now tell all the active nodes to delete all these records + * (if possible) + */ + + ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), + CTDB_CURRENT_NODE, + tmp_ctx, + &nodemap); + if (ret != 0) { + DEBUG(DEBUG_ERR,(__location__ " unable to get node map\n")); + ret = -1; + goto done; + } + + active_nodes = list_of_active_nodes(ctdb, nodemap, + nodemap, /* talloc context */ + false /* include self */); + /* yuck! ;-) */ + num_active_nodes = talloc_get_size(active_nodes)/sizeof(*active_nodes); + recs = talloc_zero(tmp_ctx, struct delete_records_list); if (recs == NULL) { DEBUG(DEBUG_ERR,(__location__ " Out of memory\n")); @@ -759,27 +780,6 @@ static int ctdb_process_delete_list(struct ctdb_db_context *ctdb_db, indata.dsize = talloc_get_size(recs->records); indata.dptr = (void *)recs->records; - /* - * now tell all the active nodes to delete all these records - * (if possible) - */ - - ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), - CTDB_CURRENT_NODE, - tmp_ctx, - &nodemap); - if (ret != 0) { - DEBUG(DEBUG_ERR,(__location__ " unable to get node map\n")); - ret = -1; - goto done; - } - - active_nodes = list_of_active_nodes(ctdb, nodemap, - nodemap, /* talloc context */ - false /* include self */); - /* yuck! ;-) */ - num_active_nodes = talloc_get_size(active_nodes)/sizeof(*active_nodes); - for (i = 0; i < num_active_nodes; i++) { struct ctdb_marshall_buffer *records; struct ctdb_rec_data *rec; -- 2.34.1