[SCM] CTDB repository - branch master updated - ctdb-2.1-14-g35da9a7

Amitay Isaacs amitay at samba.org
Mon Feb 4 20:43:13 MST 2013


The branch, master has been updated
       via  35da9a7c2a0f5e54e61588c3c3455f06ebc66822 (commit)
      from  a82d3ec12f0fda16d6bfa8442a07595de897c10e (commit)

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


- Log -----------------------------------------------------------------
commit 35da9a7c2a0f5e54e61588c3c3455f06ebc66822
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Jan 22 13:27:20 2013 +1100

    daemon: Make sure all the traverse children are terminated if traverse times out
    
    When traverse times out, callback function is called with key and data set to
    tdb_null.  This is also the way to signal end of traverse.  So if the traverse
    times out, callback function treats it as traverse ended and frees state without
    calling the destructor.
    
    Keep track if the traverse timed out, so callback function can take appropriate
    action for traverse timeout and traverse end.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 server/ctdb_traverse.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_traverse.c b/server/ctdb_traverse.c
index 54ee70f..5b709dc 100644
--- a/server/ctdb_traverse.c
+++ b/server/ctdb_traverse.c
@@ -214,6 +214,7 @@ struct ctdb_traverse_all_handle {
 	ctdb_traverse_fn_t callback;
 	void *private_data;
 	uint32_t null_count;
+	bool timedout;
 };
 
 /*
@@ -243,6 +244,7 @@ static void ctdb_traverse_all_timeout(struct event_context *ev, struct timed_eve
 	DEBUG(DEBUG_ERR,(__location__ " Traverse all timeout on database:%s\n", state->ctdb_db->db_name));
 	CTDB_INCREMENT_STAT(state->ctdb, timeouts.traverse);
 
+	state->timedout = true;
 	state->callback(state->private_data, tdb_null, tdb_null);
 }
 
@@ -288,6 +290,7 @@ static struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_
 	state->callback     = callback;
 	state->private_data = start_state;
 	state->null_count   = 0;
+	state->timedout     = false;
 	
 	talloc_set_destructor(state, ctdb_traverse_all_destructor);
 
@@ -549,9 +552,14 @@ static void traverse_start_callback(void *p, TDB_DATA key, TDB_DATA data)
 
 	ctdb_dispatch_message(state->ctdb, state->srvid, cdata);
 	if (key.dsize == 0 && data.dsize == 0) {
-		/* end of traverse */
-		talloc_set_destructor(state, NULL);
-		talloc_free(state);
+	    	if (state->h->timedout) {
+		    	/* timed out, send TRAVERSE_KILL control */
+			talloc_free(state);
+		} else {
+			/* end of traverse */
+			talloc_set_destructor(state, NULL);
+			talloc_free(state);
+		}
 	}
 }
 


-- 
CTDB repository


More information about the samba-cvs mailing list