[SCM] CTDB repository - branch master updated - ctdb-1.12-53-g6b9d308

Michael Adam obnox at samba.org
Fri Nov 25 16:55:07 MST 2011


The branch, master has been updated
       via  6b9d308985ef2363c62fde6340ad37d56f6d7702 (commit)
       via  88ad1e75c686cd47aec18b0a8eb93c3b125f0e97 (commit)
       via  0f070a65a322bd6d3240ca96a9e5c3633ef647bf (commit)
       via  39a5c0d8cca4ce5e8bc7055739a6377fb2dc36e0 (commit)
       via  4ae564e415560cde7e4cd4c5a1d7699f3d49621b (commit)
       via  057023f5843c91d1cf8512f3675a01a119ea6157 (commit)
      from  66af6659eaffaeafbfa58779162aabe915d1c50f (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6b9d308985ef2363c62fde6340ad37d56f6d7702
Author: Michael Adam <obnox at samba.org>
Date:   Fri Nov 25 13:55:20 2011 +0100

    vacuum: write a big and up-to-date explaining comment for ctdb_vacuum_db()

commit 88ad1e75c686cd47aec18b0a8eb93c3b125f0e97
Author: Michael Adam <obnox at samba.org>
Date:   Fri Nov 25 13:54:48 2011 +0100

    vacuum: fix a comment typo in vacuum_traverse()

commit 0f070a65a322bd6d3240ca96a9e5c3633ef647bf
Author: Michael Adam <obnox at samba.org>
Date:   Fri Nov 25 13:35:05 2011 +0100

    vacuum: fix horrible indentation/whitespacing for ctdb_vacuum_event()

commit 39a5c0d8cca4ce5e8bc7055739a6377fb2dc36e0
Author: Michael Adam <obnox at samba.org>
Date:   Fri Nov 25 13:34:15 2011 +0100

    vacuum: fix a comment typo in vacuum_traverse()

commit 4ae564e415560cde7e4cd4c5a1d7699f3d49621b
Author: Michael Adam <obnox at samba.org>
Date:   Fri Nov 25 13:25:27 2011 +0100

    vacuum: fix an abundance of indentation white spaces in ctdb_vacuum_db()

commit 057023f5843c91d1cf8512f3675a01a119ea6157
Author: Michael Adam <obnox at samba.org>
Date:   Fri Nov 25 13:23:23 2011 +0100

    vacuum: rename "size" to "freelist_size" for clarity

-----------------------------------------------------------------------

Summary of changes:
 server/ctdb_vacuum.c |   65 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 46 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_vacuum.c b/server/ctdb_vacuum.c
index 2be3e4b..e30b6e8 100644
--- a/server/ctdb_vacuum.c
+++ b/server/ctdb_vacuum.c
@@ -206,8 +206,8 @@ static int add_record_to_vacuum_fetch_list(struct vacuum_data *vdata,
 }
 
 
-static void ctdb_vacuum_event(struct event_context *ev, struct timed_event *te, 
-							  struct timeval t, void *private_data);
+static void ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
+			      struct timeval t, void *private_data);
 
 
 /*
@@ -236,7 +236,7 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
 	}
 
 	if (data.dsize != sizeof(struct ctdb_ltdb_header)) {
-		/* its not a deleted record */
+		/* it is not a deleted record */
 		vdata->full_skipped++;
 		return 0;
 	}
@@ -250,7 +250,7 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
 
 	if (lmaster == ctdb->pnn) {
 		/*
-		 * We are both lmaster and dmaster, and the record * is empty.
+		 * We are both lmaster and dmaster, and the record is empty.
 		 * So we should be able to delete it.
 		 */
 		res = add_record_to_delete_tree(vdata, key, hdr);
@@ -435,11 +435,37 @@ done:
 	return 0;
 }
 
-/* 
- * read-only traverse the database in order to find
- * records that can be deleted and try to delete these
- * records on the other nodes
- * this executes in the child context
+/**
+ * Vacuum a DB:
+ *  - Always do the fast vacuuming run, which traverses
+ *    the in-memory delete queue: these records have been
+ *    scheduled for deletion.
+ *  - Only if explicitly requested, the database is traversed
+ *    in order to use the traditional heuristics on empty records
+ *    to trigger deletion.
+ *    This is done only every VacuumFastPathCount'th vacuuming run.
+ *
+ * The traverse runs fill two lists:
+ *
+ * - The delete_list:
+ *   This is the list of empty records the current
+ *   node is lmaster and dmaster for. These records are later
+ *   deleted first on other nodes and then locally.
+ *
+ *   The fast vacuuming run has a short cut for those records
+ *   that have never been migrated with data: these records
+ *   are immediately deleted locally, since they have left
+ *   no trace on other nodes.
+ *
+ * - The vacuum_fetch lists
+ *   (one for each other lmaster node):
+ *   The records in this list are sent for deletion to
+ *   their lmaster in a bulk VACUUM_FETCH message.
+ *
+ *   The lmaster then migrates all these records to itelf
+ *   so that they can be vacuumed there.
+ *
+ * This executes in the child context.
  */
 static int ctdb_vacuum_db(struct ctdb_db_context *ctdb_db,
 			  struct vacuum_data *vdata,
@@ -488,8 +514,8 @@ static int ctdb_vacuum_db(struct ctdb_db_context *ctdb_db,
 	}
 	for (i = 0; i < ctdb->num_nodes; i++) {
 		vdata->list[i] = (struct ctdb_marshall_buffer *)
-			talloc_zero_size(vdata->list, 
-							 offsetof(struct ctdb_marshall_buffer, data));
+			talloc_zero_size(vdata->list,
+					 offsetof(struct ctdb_marshall_buffer, data));
 		if (vdata->list[i] == NULL) {
 			DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
 			return -1;
@@ -939,11 +965,11 @@ static int ctdb_vacuum_and_repack_db(struct ctdb_db_context *ctdb_db,
 	uint32_t repack_limit = ctdb_db->ctdb->tunable.repack_limit;
 	uint32_t vacuum_limit = ctdb_db->ctdb->tunable.vacuum_limit;
 	const char *name = ctdb_db->db_name;
-	int size;
+	int freelist_size;
 	struct vacuum_data *vdata;
 
-	size = tdb_freelist_size(ctdb_db->ltdb->tdb);
-	if (size == -1) {
+	freelist_size = tdb_freelist_size(ctdb_db->ltdb->tdb);
+	if (freelist_size == -1) {
 		DEBUG(DEBUG_ERR,(__location__ " Failed to get freelist size for '%s'\n", name));
 		return -1;
 	}
@@ -977,25 +1003,26 @@ static int ctdb_vacuum_and_repack_db(struct ctdb_db_context *ctdb_db,
 	/*
 	 * decide if a repack is necessary
 	 */
-	if (size < repack_limit && vdata->delete_count < vacuum_limit) {
-		update_tuning_db(ctdb_db, vdata, size);
+	if (freelist_size < repack_limit && vdata->delete_count < vacuum_limit)
+	{
+		update_tuning_db(ctdb_db, vdata, freelist_size);
 		talloc_free(vdata);
 		return 0;
 	}
 
 	DEBUG(DEBUG_INFO,("Repacking %s with %u freelist entries and %u records to delete\n", 
-			name, size, vdata->delete_count));
+			name, freelist_size, vdata->delete_count));
 
 	/*
 	 * repack and implicitely get rid of the records we can delete
 	 */
 	if (ctdb_repack_tdb(ctdb_db->ltdb->tdb, mem_ctx, vdata) != 0) {
 		DEBUG(DEBUG_ERR,(__location__ " Failed to repack '%s'\n", name));
-		update_tuning_db(ctdb_db, vdata, size);
+		update_tuning_db(ctdb_db, vdata, freelist_size);
 		talloc_free(vdata);
 		return -1;
 	}
-	update_tuning_db(ctdb_db, vdata, size);
+	update_tuning_db(ctdb_db, vdata, freelist_size);
 	talloc_free(vdata);
 
 	return 0;


-- 
CTDB repository


More information about the samba-cvs mailing list