[SCM] CTDB repository - branch master updated - ctdb-1.13-193-gac89da4

Ronnie Sahlberg sahlberg at samba.org
Tue May 29 16:45:36 MDT 2012


The branch, master has been updated
       via  ac89da4eea98fa686408c5671a6c44c0fd1d7a58 (commit)
       via  0be452958db95c8253c362a1c08a1966e53a1f99 (commit)
       via  bc55e09fdac9f743d6428bfe0be77840ad0fd1ba (commit)
       via  6e5cbe8fff71985e5a2fc16b7e9f2b868011ff5d (commit)
      from  fd3b73d7e634f16cbb99d7d5a548e12f00d1aadb (commit)

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


- Log -----------------------------------------------------------------
commit ac89da4eea98fa686408c5671a6c44c0fd1d7a58
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri May 25 15:57:14 2012 +1000

    tests: Increment RSN always in ctdb_update_record_persistent test
    
    If the record does not exist in persistent DB, RSN for that record is
    considered 0. To write a record, RSN for that record should be set to 1,
    otherwise the RSN check would fail.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 0be452958db95c8253c362a1c08a1966e53a1f99
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri May 25 11:40:38 2012 +1000

    tests: Fix ctdb_fetch test (parse extra lines of output)
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit bc55e09fdac9f743d6428bfe0be77840ad0fd1ba
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu May 24 16:46:07 2012 +1000

    tests: Fix flakey behavior of ctdb_fetch test
    
    There were two issues with this test:
    
    1. Since the messages are sent from one node to the next, if a node
       does not register for messages before CTDB on that nodes receives
       the message, it will never be seen by ctdb_fetch and it would
       block on receive and would not send any messages to next node.
       The crude solution is to sleep just before the messages are sent,
       so that ctdb_fetch on all nodes have registered for the messages.
    
    2. If ctdb_fetch stops sending messages after timelimit expiry, the
       next node will keep waiting to receive messages in event_loop_once().
       The default timeout is 30 seconds for event_loop_once(). Adding a
       timed event will always set the timeout value to the time remaining
       for the timed event to expire.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 6e5cbe8fff71985e5a2fc16b7e9f2b868011ff5d
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu May 17 16:08:37 2012 +1000

    server: Replace BOOL datatype with bool, True/False with true/false
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 client/ctdb_client.c                      |    8 ++++----
 common/rb_tree.c                          |    6 +++---
 include/includes.h                        |    7 +------
 lib/util/util.c                           |    2 +-
 server/ctdb_call.c                        |    8 ++++----
 server/ctdb_control.c                     |    2 +-
 server/ctdb_daemon.c                      |    4 ++--
 server/ctdb_freeze.c                      |    2 +-
 server/ctdb_takeover.c                    |    2 +-
 server/ctdbd.c                            |    2 +-
 tests/simple/52_ctdb_fetch.sh             |    2 +-
 tests/src/ctdb_fetch.c                    |   17 +++++++++++++++++
 tests/src/ctdb_update_record_persistent.c |    4 ++--
 13 files changed, 39 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 69b0a04..9162a47 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -2023,7 +2023,7 @@ static void traverse_handler(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA
 	if (data.dsize < sizeof(uint32_t) ||
 	    d->length != data.dsize) {
 		DEBUG(DEBUG_ERR,("Bad data size %u in traverse_handler\n", (unsigned)data.dsize));
-		state->done = True;
+		state->done = true;
 		return;
 	}
 
@@ -2034,7 +2034,7 @@ static void traverse_handler(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA
 
 	if (key.dsize == 0 && data.dsize == 0) {
 		/* end of traverse */
-		state->done = True;
+		state->done = true;
 		return;
 	}
 
@@ -2046,7 +2046,7 @@ static void traverse_handler(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA
 	}
 
 	if (state->fn(ctdb, key, data, state->private_data) != 0) {
-		state->done = True;
+		state->done = true;
 	}
 
 	state->count++;
@@ -2071,7 +2071,7 @@ static int ctdb_traverse_ext(struct ctdb_db_context *ctdb_db,
 	uint64_t srvid = (getpid() | 0xFLL<<60);
 	struct traverse_state state;
 
-	state.done = False;
+	state.done = false;
 	state.count = 0;
 	state.private_data = private_data;
 	state.fn = fn;
diff --git a/common/rb_tree.c b/common/rb_tree.c
index bff7c5a..6b131bc 100644
--- a/common/rb_tree.c
+++ b/common/rb_tree.c
@@ -447,7 +447,7 @@ trbt_delete_case1(trbt_node_t *node)
 }
 
 static void
-delete_node(trbt_node_t *node, BOOL from_destructor)
+delete_node(trbt_node_t *node, bool from_destructor)
 {
 	trbt_node_t *parent, *child, dc;
 	trbt_node_t *temp = NULL;
@@ -606,7 +606,7 @@ finished:
  */
 static int node_destructor(trbt_node_t *node)
 {
-	delete_node(node, True);
+	delete_node(node, true);
 
 	return 0;
 }
@@ -746,7 +746,7 @@ trbt_delete32(trbt_tree_t *tree, uint32_t key)
 
 	while(node){
 		if(key==node->key32){
-			delete_node(node, False);
+			delete_node(node, false);
 			return;
 		}
 		if(key<node->key32){
diff --git a/include/includes.h b/include/includes.h
index b565533..e0ce06b 100644
--- a/include/includes.h
+++ b/include/includes.h
@@ -18,11 +18,6 @@
 
 #include "tevent.h"
 
-typedef bool BOOL;
-
-#define True 1
-#define False 0
-
 extern int LogLevel;
 extern int this_log_level;
 
@@ -64,7 +59,7 @@ double timeval_delta(struct timeval *tv2, struct timeval *tv);
 char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx);
 char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len);
 _PUBLIC_ const char **str_list_add(const char **list, const char *s);
-_PUBLIC_ int set_blocking(int fd, BOOL set);
+_PUBLIC_ int set_blocking(int fd, bool set);
 
 #include "lib/util/debug.h"
 #include "lib/util/util.h"
diff --git a/lib/util/util.c b/lib/util/util.c
index e19b2dc..af52805 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -28,7 +28,7 @@
   if BSD use FNDELAY
 **/
 
-_PUBLIC_ int set_blocking(int fd, BOOL set)
+_PUBLIC_ int set_blocking(int fd, bool set)
 {
 	int val;
 #ifdef O_NONBLOCK
diff --git a/server/ctdb_call.c b/server/ctdb_call.c
index fe7e947..b7a4fe3 100644
--- a/server/ctdb_call.c
+++ b/server/ctdb_call.c
@@ -462,7 +462,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
 	
 	/* fetch the current record */
 	ret = ctdb_ltdb_lock_fetch_requeue(ctdb_db, key, &header, hdr, &data2,
-					   ctdb_call_input_pkt, ctdb, False);
+					   ctdb_call_input_pkt, ctdb, false);
 	if (ret == -1) {
 		ctdb_fatal(ctdb, "ctdb_req_dmaster failed to fetch record");
 		return;
@@ -723,7 +723,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 	   if the call will be answered locally */
 
 	ret = ctdb_ltdb_lock_fetch_requeue(ctdb_db, call->key, &header, hdr, &data,
-					   ctdb_call_input_pkt, ctdb, False);
+					   ctdb_call_input_pkt, ctdb, false);
 	if (ret == -1) {
 		ctdb_send_error(ctdb, hdr, ret, "ltdb fetch failed in ctdb_request_call");
 		return;
@@ -977,7 +977,7 @@ void ctdb_reply_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 		key.dsize = state->c->keylen;
 		key.dptr  = state->c->data;
 		ret = ctdb_ltdb_lock_requeue(ctdb_db, key, hdr,
-				     ctdb_call_input_pkt, ctdb, False);
+				     ctdb_call_input_pkt, ctdb, false);
 		if (ret == -2) {
 			return;
 		}
@@ -1063,7 +1063,7 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 	}
 
 	ret = ctdb_ltdb_lock_requeue(ctdb_db, key, hdr,
-				     ctdb_call_input_pkt, ctdb, False);
+				     ctdb_call_input_pkt, ctdb, false);
 	if (ret == -2) {
 		return;
 	}
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index 2a16a23..5c1eedd 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -703,7 +703,7 @@ void ctdb_request_control(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
 	struct ctdb_req_control *c = (struct ctdb_req_control *)hdr;
 	TDB_DATA data, *outdata;
 	int32_t status;
-	bool async_reply = False;
+	bool async_reply = false;
 	const char *errormsg = NULL;
 
 	data.dptr = &c->data[0];
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index 899b3bd..a61e7d3 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -657,7 +657,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
 
 	ret = ctdb_ltdb_lock_fetch_requeue(ctdb_db, key, &header, 
 					   (struct ctdb_req_header *)c, &data,
-					   daemon_incoming_packet_wrap, w, True);
+					   daemon_incoming_packet_wrap, w, true);
 	if (ret == -2) {
 		/* will retry later */
 		CTDB_DECREMENT_STAT(ctdb, pending_calls);
@@ -1068,7 +1068,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 		return 0;
 	}
 
-	tdb_reopen_all(False);
+	tdb_reopen_all(false);
 
 	if (do_fork) {
 		setsid();
diff --git a/server/ctdb_freeze.c b/server/ctdb_freeze.c
index 56dc19c..c8941f2 100644
--- a/server/ctdb_freeze.c
+++ b/server/ctdb_freeze.c
@@ -335,7 +335,7 @@ int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *
 	DLIST_ADD(ctdb->freeze_handles[priority]->waiters, w);
 
 	/* we won't reply till later */
-	*async_reply = True;
+	*async_reply = true;
 	return 0;
 }
 
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index ee6c723..0ba12b1 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -3874,6 +3874,6 @@ int32_t ctdb_control_reload_public_ips(struct ctdb_context *ctdb, struct ctdb_re
 			ctdb_reloadips_timeout_event, h);
 
 	/* we reply later */
-	*async_reply = True;
+	*async_reply = true;
 	return 0;
 }
diff --git a/server/ctdbd.c b/server/ctdbd.c
index 8eee5f2..ddda8ff 100644
--- a/server/ctdbd.c
+++ b/server/ctdbd.c
@@ -346,5 +346,5 @@ int main(int argc, const char *argv[])
 	}
 
 	/* start the protocol running (as a child) */
-	return ctdb_start_daemon(ctdb, interactive?False:True, options.use_syslog, options.public_address_list);
+	return ctdb_start_daemon(ctdb, interactive?false:true, options.use_syslog, options.public_address_list);
 }
diff --git a/tests/simple/52_ctdb_fetch.sh b/tests/simple/52_ctdb_fetch.sh
index 13b3f1f..54405d0 100755
--- a/tests/simple/52_ctdb_fetch.sh
+++ b/tests/simple/52_ctdb_fetch.sh
@@ -40,7 +40,7 @@ num_nodes=$(echo "$out" | wc -l)
 echo "Running ctdb_fetch on all $num_nodes nodes."
 try_command_on_node -v -pq all $CTDB_TEST_WRAPPER $VALGRIND ctdb_fetch -n $num_nodes
 
-pat='^(Fetch: [[:digit:]]+(\.[[:digit:]]+)? msgs/sec[[:space:]]?|msg_count=[[:digit:]]+ on node [[:digit:]]|Fetching final record|DATA:|Test data|Waiting for cluster[[:space:]]?|.*: Reqid wrap!|)+$'
+pat='^(Fetch: [[:digit:]]+(\.[[:digit:]]+)? msgs/sec[[:space:]]?|msg_count=[[:digit:]]+ on node [[:digit:]]|Fetching final record|DATA:|Test data|Waiting for cluster[[:space:]]?|.*: Reqid wrap!|Sleeping for [[:digit:]]+ seconds|)+$'
 sanity_check_output 1 "$pat" "$out"
 
 # Filter out the performance figures:
diff --git a/tests/src/ctdb_fetch.c b/tests/src/ctdb_fetch.c
index 01a5d76..db84f5d 100644
--- a/tests/src/ctdb_fetch.c
+++ b/tests/src/ctdb_fetch.c
@@ -113,6 +113,15 @@ static void message_handler(struct ctdb_context *ctdb, uint64_t srvid,
 
 
 /*
+ * timeout handler - noop
+ */
+static void timeout_handler(struct event_context *ev, struct timed_event *timer,
+			    struct timeval curtime, void *private_data)
+{
+	return;
+}
+
+/*
   benchmark the following:
 
   fetch a record
@@ -129,6 +138,7 @@ static void bench_fetch(struct ctdb_context *ctdb, struct event_context *ev)
 	}
 	
 	start_timer();
+	event_add_timed(ev, ctdb, timeval_current_ofs(timelimit,0), timeout_handler, NULL);
 
 	while (end_timer() < timelimit) {
 		if (pnn == 0 && msg_count % 100 == 0 && end_timer() > 0) {
@@ -235,6 +245,13 @@ int main(int argc, const char *argv[])
 		event_loop_once(ev);
 	}
 
+	/* This test has a race condition. If CTDB receives the message from previous
+	 * node, before this node has registered for that message, this node will never
+	 * receive that message and will block on receive. Sleeping for some time will
+	 * hopefully ensure that the test program on all the nodes register for messages.
+	 */
+	printf("Sleeping for %d seconds\n", num_nodes);
+	sleep(num_nodes);
 	bench_fetch(ctdb, ev);
 
 	key.dptr = discard_const(TESTKEY);
diff --git a/tests/src/ctdb_update_record_persistent.c b/tests/src/ctdb_update_record_persistent.c
index 18156f8..07b2c48 100644
--- a/tests/src/ctdb_update_record_persistent.c
+++ b/tests/src/ctdb_update_record_persistent.c
@@ -42,8 +42,8 @@ static void update_once(struct ctdb_context *ctdb, struct event_context *ev, str
 	olddata = tdb_fetch(ctdb_db->ltdb->tdb, key);
 	if (olddata.dsize != 0) {
 		memcpy(&header, olddata.dptr, sizeof(header));
-		header.rsn++;
-	}
+	} 
+	header.rsn++;
 
 	if (ctdb_ctrl_updaterecord(ctdb, ctdb, timeval_zero(), CTDB_CURRENT_NODE, ctdb_db, key, &header, data) != 0) {
 		printf("Failed to update record\n");


-- 
CTDB repository


More information about the samba-cvs mailing list