[SCM] CTDB repository - branch master updated - ctdb-1.13-183-g03fa2a5

Ronnie Sahlberg sahlberg at samba.org
Thu May 24 21:26:25 MDT 2012


The branch, master has been updated
       via  03fa2a517247eb2adfba67248e2466f17ea14418 (commit)
       via  1f262deaad0818f159f9c68330f7fec121679023 (commit)
      from  6cf6a9b071bd8dd730717ca033337ff73bf247bb (commit)

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


- Log -----------------------------------------------------------------
commit 03fa2a517247eb2adfba67248e2466f17ea14418
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri May 25 12:31:11 2012 +1000

    RECOVERY: Increase the time we allow before timing out recovery related tasks.
    
    If the system is temporarily taking unusually long to perform these tasks it is better to wait a lot longer and allow the tasks to complete than timing out repeatedly and then becomming banned.

commit 1f262deaad0818f159f9c68330f7fec121679023
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri May 25 12:27:59 2012 +1000

    RECOVER: When we pull databases during recovery, we used to reallocate the databuffer for each entry added. This would normally not be an issue, but for cases where memory is fragmented, this could start to cost significant cpu if we need to reallocate and move to a different region.
    
    Change this to instead preallocate , by default, 10MByte chunks to the data buffer.
    This significantly reduces the number of potential reallocate and move  operations that may be required.
    
    Create a tunable to override/change how much preallocation should be used.

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

Summary of changes:
 include/ctdb_private.h |    1 +
 server/ctdb_recover.c  |    7 ++++++-
 server/ctdb_recoverd.c |    7 ++++++-
 server/ctdb_tunables.c |    5 +++--
 4 files changed, 16 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 0f494b4..7c3fdf0 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -134,6 +134,7 @@ struct ctdb_tunable {
 	uint32_t db_record_count_warn;
 	uint32_t db_record_size_warn;
 	uint32_t db_size_warn;
+	uint32_t pulldb_preallocation_size;
 };
 
 /*
diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c
index 05f72f9..e54312f 100644
--- a/server/ctdb_recover.c
+++ b/server/ctdb_recover.c
@@ -348,6 +348,7 @@ struct pulldb_data {
 	struct ctdb_db_context *ctdb_db;
 	struct ctdb_marshall_buffer *pulldata;
 	uint32_t len;
+	uint32_t allocated_len;
 	bool failed;
 };
 
@@ -364,7 +365,10 @@ static int traverse_pulldb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
 		params->failed = true;
 		return -1;
 	}
-	params->pulldata = talloc_realloc_size(NULL, params->pulldata, rec->length + params->len);
+	if (params->len + rec->length >= params->allocated_len) {
+		params->allocated_len = rec->length + params->len + ctdb->tunable.pulldb_preallocation_size;
+		params->pulldata = talloc_realloc_size(NULL, params->pulldata, params->allocated_len);
+	}
 	if (params->pulldata == NULL) {
 		DEBUG(DEBUG_CRIT,(__location__ " Failed to expand pulldb_data to %u\n", rec->length + params->len));
 		ctdb_fatal(params->ctdb, "failed to allocate memory for recovery. shutting down\n");
@@ -414,6 +418,7 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DAT
 	params.ctdb_db = ctdb_db;
 	params.pulldata = reply;
 	params.len = offsetof(struct ctdb_marshall_buffer, data);
+	params.allocated_len = params.len;
 	params.failed = false;
 
 	if (ctdb_db->unhealthy_reason) {
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index f739900..b380746 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -1178,6 +1178,7 @@ struct recdb_data {
 	struct ctdb_context *ctdb;
 	struct ctdb_marshall_buffer *recdata;
 	uint32_t len;
+	uint32_t allocated_len;
 	bool failed;
 	bool persistent;
 };
@@ -1206,7 +1207,10 @@ static int traverse_recdb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
 		params->failed = true;
 		return -1;
 	}
-	params->recdata = talloc_realloc_size(NULL, params->recdata, rec->length + params->len);
+	if (params->len + rec->length >= params->allocated_len) {
+		params->allocated_len = rec->length + params->len + params->ctdb->tunable.pulldb_preallocation_size;
+		params->recdata = talloc_realloc_size(NULL, params->recdata, params->allocated_len);
+	}
 	if (params->recdata == NULL) {
 		DEBUG(DEBUG_CRIT,(__location__ " Failed to expand recdata to %u (%u records)\n", 
 			 rec->length + params->len, params->recdata->count));
@@ -1245,6 +1249,7 @@ static int push_recdb_database(struct ctdb_context *ctdb, uint32_t dbid,
 	params.ctdb = ctdb;
 	params.recdata = recdata;
 	params.len = offsetof(struct ctdb_marshall_buffer, data);
+	params.allocated_len = params.len;
 	params.failed = false;
 	params.persistent = persistent;
 
diff --git a/server/ctdb_tunables.c b/server/ctdb_tunables.c
index 663c387..57dd1f3 100644
--- a/server/ctdb_tunables.c
+++ b/server/ctdb_tunables.c
@@ -31,7 +31,7 @@ static const struct {
 	{ "TraverseTimeout",     20, offsetof(struct ctdb_tunable, traverse_timeout), false },
 	{ "KeepaliveInterval",    5,  offsetof(struct ctdb_tunable, keepalive_interval), false },
 	{ "KeepaliveLimit",       5,  offsetof(struct ctdb_tunable, keepalive_limit), false },
-	{ "RecoverTimeout",      20,  offsetof(struct ctdb_tunable, recover_timeout), false },
+	{ "RecoverTimeout",     120,  offsetof(struct ctdb_tunable, recover_timeout), false },
 	{ "RecoverInterval",      1,  offsetof(struct ctdb_tunable, recover_interval), false },
 	{ "ElectionTimeout",      3,  offsetof(struct ctdb_tunable, election_timeout), false },
 	{ "TakeoverTimeout",      9,  offsetof(struct ctdb_tunable, takeover_timeout), false },
@@ -82,7 +82,8 @@ static const struct {
 	{ "NoIPTakeover",         0,  offsetof(struct ctdb_tunable, no_ip_takeover), false },
 	{ "DBRecordCountWarn",    100000,  offsetof(struct ctdb_tunable, db_record_count_warn), false },
 	{ "DBRecordSizeWarn",   10000000,  offsetof(struct ctdb_tunable, db_record_size_warn), false },
-	{ "DBSizeWarn",        100000000,  offsetof(struct ctdb_tunable, db_size_warn), false }
+	{ "DBSizeWarn",        100000000,  offsetof(struct ctdb_tunable, db_size_warn), false },
+	{ "PullDBPreallocation", 10*1024*10240,  offsetof(struct ctdb_tunable, pulldb_preallocation_size), false }
 };
 
 /*


-- 
CTDB repository


More information about the samba-cvs mailing list