diff options
author | Michael Adam <obnox@samba.org> | 2011-12-16 10:59:26 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-12-23 17:39:07 +0100 |
commit | dbede3de7e962f6fd2164a19fc429bcdf1f626c5 (patch) | |
tree | 27f75dff6520ab6fbb0708c87065ce6e9e8acc78 | |
parent | 61b336f230902e3a036be9dc0699d025e967dc6e (diff) | |
download | samba-dbede3de7e962f6fd2164a19fc429bcdf1f626c5.tar.gz samba-dbede3de7e962f6fd2164a19fc429bcdf1f626c5.tar.xz samba-dbede3de7e962f6fd2164a19fc429bcdf1f626c5.zip |
vacuum: factor out the fast vacuuming run into ctdb_vacuum_db_fast()
for readability
(This used to be ctdb commit 6596f2c4a6b4783b6498502fbbf50f87d4f59085)
-rw-r--r-- | ctdb/server/ctdb_vacuum.c | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c index 171df29e2e..fe01f57621 100644 --- a/ctdb/server/ctdb_vacuum.c +++ b/ctdb/server/ctdb_vacuum.c @@ -536,6 +536,39 @@ done: } /** + * Fast vacuuming run: + * Traverse the delete_queue. + * This fills the same lists as the database traverse. + */ +static void ctdb_vacuum_db_fast(struct ctdb_db_context *ctdb_db, + struct vacuum_data *vdata) +{ + trbt_traversearray32(ctdb_db->delete_queue, 1, delete_queue_traverse, vdata); + + if (vdata->fast_total > 0) { + DEBUG(DEBUG_INFO, + (__location__ + " fast vacuuming delete_queue traverse statistics: " + "db[%s] " + "total[%u] " + "del[%u] " + "skp[%u] " + "err[%u] " + "adl[%u] " + "avf[%u]\n", + ctdb_db->db_name, + (unsigned)vdata->fast_total, + (unsigned)vdata->fast_deleted, + (unsigned)vdata->fast_skipped, + (unsigned)vdata->fast_error, + (unsigned)vdata->fast_added_to_delete_list, + (unsigned)vdata->fast_added_to_vacuum_fetch_list)); + } + + return; +} + +/** * Vacuum a DB: * - Always do the fast vacuuming run, which traverses * the in-memory delete queue: these records have been @@ -631,31 +664,7 @@ static int ctdb_vacuum_db(struct ctdb_db_context *ctdb_db, vdata->vacuum_fetch_list[i]->db_id = ctdb_db->db_id; } - /* - * Traverse the delete_queue. - * This builds the same lists as the db traverse. - */ - trbt_traversearray32(ctdb_db->delete_queue, 1, delete_queue_traverse, vdata); - - if (vdata->fast_total > 0) { - DEBUG(DEBUG_INFO, - (__location__ - " fast vacuuming delete_queue traverse statistics: " - "db[%s] " - "total[%u] " - "del[%u] " - "skp[%u] " - "err[%u] " - "adl[%u] " - "avf[%u]\n", - ctdb_db->db_name, - (unsigned)vdata->fast_total, - (unsigned)vdata->fast_deleted, - (unsigned)vdata->fast_skipped, - (unsigned)vdata->fast_error, - (unsigned)vdata->fast_added_to_delete_list, - (unsigned)vdata->fast_added_to_vacuum_fetch_list)); - } + ctdb_vacuum_db_fast(ctdb_db, vdata); /* * read-only traverse of the database, looking for records that |