diff options
author | Michael Adam <obnox@samba.org> | 2012-12-29 18:32:39 +0100 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-04-24 18:47:25 +1000 |
commit | f49d57c21d8e44f81eadc824d48a67d634d56415 (patch) | |
tree | 6ff7593d203cb580ab17b1fdda511cdd2b728983 /ctdb/server/ctdb_vacuum.c | |
parent | a0e026498691144ac59a9ab4efa975570b531ea6 (diff) | |
download | samba-f49d57c21d8e44f81eadc824d48a67d634d56415.tar.gz samba-f49d57c21d8e44f81eadc824d48a67d634d56415.tar.xz samba-f49d57c21d8e44f81eadc824d48a67d634d56415.zip |
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 <obnox@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit e3740899c1af6962f93c85ad7d1cb71bddce45c6)
Diffstat (limited to 'ctdb/server/ctdb_vacuum.c')
-rw-r--r-- | ctdb/server/ctdb_vacuum.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c index d659b8eaff8..8f90257db93 100644 --- a/ctdb/server/ctdb_vacuum.c +++ b/ctdb/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; |