[SCM] CTDB repository - branch master updated - ctdb-1.0.113-69-g59ba5d7

Ronnie Sahlberg sahlberg at samba.org
Wed Feb 3 15:58:48 MST 2010


The branch, master has been updated
       via  59ba5d7f80e0465e5076533374fb9ee862ed7bb6 (commit)
      from  8c89aac20260dc7f3746e29fe99f17422a77cb88 (commit)

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


- Log -----------------------------------------------------------------
commit 59ba5d7f80e0465e5076533374fb9ee862ed7bb6
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Feb 4 09:54:06 2010 +1100

    We only queued up to 1000 packets per queue before we start dropping
    packets, to avoid the queue to grow excessively if smbd has blocked.
    
    This could cause traverse packets to become discarded in case the main
    smbd daemon does a traverse of a database while there is a recovery
    (sending a erconfigured message to smbd, causing an avalanche of unlock
    messages to be sent across the cluster.)
    
    This avalance of messages could cause also the tranversal message to be
    discarded  causing the main smbd process to hang indefinitely waiting
    for the traversal message that will never arrive.
    
    Bump the maximum queue length before starting to discard messages from
    1000 to 1000000 and at the same time rework the queueing slightly so we
    can append messages cheaply to the queue instead of walking the list
    from head to tail every time.

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

Summary of changes:
 common/ctdb_io.c       |   19 ++++++++++++++++++-
 server/ctdb_tunables.c |    2 +-
 2 files changed, 19 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/common/ctdb_io.c b/common/ctdb_io.c
index 28830d5..47681d2 100644
--- a/common/ctdb_io.c
+++ b/common/ctdb_io.c
@@ -46,6 +46,12 @@ struct ctdb_queue {
 	struct ctdb_context *ctdb;
 	struct ctdb_partial partial; /* partial input packet */
 	struct ctdb_queue_pkt *out_queue;
+	/* This field is used to track the last added item so we
+	   can append new items to the end cheaply.
+	   This relies of that items are always appended to the tail
+	   and that when reamoving items we only remove the head.
+	*/
+	struct ctdb_queue_pkt *out_queue_last_added;
 	uint32_t out_queue_length;
 	struct fd_event *fde;
 	int fd;
@@ -294,7 +300,18 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
 		EVENT_FD_WRITEABLE(queue->fde);
 	}
 
-	DLIST_ADD_END(queue->out_queue, pkt, struct ctdb_queue_pkt *);
+	/* This relies on that when adding items to the queue, we always add
+	   them to the tail and that when removing items we only remove
+	   the head of queue item.
+	   The last_added item thus allows non n^2 behaviour when appending to
+	   very long queues.
+	*/
+	if (queue->out_queue == NULL) {
+		DLIST_ADD(queue->out_queue, pkt);
+	} else {
+		DLIST_ADD_END(queue->out_queue_last_added, pkt, struct ctdb_queue_pkt *);
+	}
+	queue->out_queue_last_added = pkt;
 	queue->out_queue_length++;
 
 	if (queue->ctdb->tunable.verbose_memory_names != 0) {
diff --git a/server/ctdb_tunables.c b/server/ctdb_tunables.c
index e75dcbd..cca270b 100644
--- a/server/ctdb_tunables.c
+++ b/server/ctdb_tunables.c
@@ -62,7 +62,7 @@ static const struct {
 	{ "VacuumLimit",       5000,  offsetof(struct ctdb_tunable, vacuum_limit) },
 	{ "VacuumMinInterval",   60,  offsetof(struct ctdb_tunable, vacuum_min_interval) },
 	{ "VacuumMaxInterval",  600,  offsetof(struct ctdb_tunable, vacuum_max_interval) },
-	{ "MaxQueueDropMsg",  1000,  offsetof(struct ctdb_tunable, max_queue_depth_drop_msg) },
+	{ "MaxQueueDropMsg",  1000000, offsetof(struct ctdb_tunable, max_queue_depth_drop_msg) },
 	{ "UseStatusEvents",     0,  offsetof(struct ctdb_tunable, use_status_events_for_monitoring) },
 	{ "AllowUnhealthyDBRead", 0,  offsetof(struct ctdb_tunable, allow_unhealthy_db_read) }
 };


-- 
CTDB repository


More information about the samba-cvs mailing list