mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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)
This commit is contained in:
parent
a0e0264986
commit
f49d57c21d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user