Rev 227: added a hopcount in ctdb_call in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Tue May 1 03:25:03 GMT 2007


------------------------------------------------------------
revno: 227
revision-id: tridge at samba.org-20070501032502-6fk64ptyeqjybf45
parent: tridge at samba.org-20070430203455-hz83ozsdn4cp1krv
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Tue 2007-05-01 13:25:02 +1000
message:
  added a hopcount in ctdb_call
modified:
  common/ctdb_call.c             ctdb_call.c-20061128065342-to93h6eejj5kon81-1
  common/ctdb_client.c           ctdb_client.c-20070411010216-3kd8v37k61steeya-1
  common/ctdb_ltdb.c             ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2
  include/ctdb_private.h         ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
  tcp/tcp_connect.c              tcp_connect.c-20061128004937-x70q1cu5xzg5g2tm-1
  tools/ctdb_control.c           ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1
=== modified file 'common/ctdb_call.c'
--- a/common/ctdb_call.c	2007-04-29 14:19:40 +0000
+++ b/common/ctdb_call.c	2007-05-01 03:25:02 +0000
@@ -170,9 +170,12 @@
 	uint32_t lmaster = ctdb_lmaster(ctdb, &key);
 	if (ctdb->vnn == lmaster) {
 		c->hdr.destnode = header->dmaster;
-	} else {
+	} else if ((c->hopcount % CTDB_MAX_REDIRECT_COUNT) == 0) {
 		c->hdr.destnode = lmaster;
+	} else {
+		c->hdr.destnode = header->dmaster;
 	}
+	c->hopcount++;
 	ctdb_queue_packet(ctdb, &c->hdr);
 }
 
@@ -449,6 +452,10 @@
 		return;
 	}
 
+	if (c->hopcount > ctdb->status.max_hop_count) {
+		ctdb->status.max_hop_count = c->hopcount;
+	}
+
 	/* if this nodes has done enough consecutive calls on the same record
 	   then give them the record
 	   or if the node requested an immediate migration
@@ -704,6 +711,7 @@
 	state->c->flags         = call->flags;
 	state->c->db_id         = ctdb_db->db_id;
 	state->c->callid        = call->call_id;
+	state->c->hopcount      = 0;
 	state->c->keylen        = call->key.dsize;
 	state->c->calldatalen   = call->call_data.dsize;
 	memcpy(&state->c->data[0], call->key.dptr, call->key.dsize);

=== modified file 'common/ctdb_client.c'
--- a/common/ctdb_client.c	2007-04-30 13:31:40 +0000
+++ b/common/ctdb_client.c	2007-05-01 03:25:02 +0000
@@ -333,6 +333,7 @@
 	c->flags         = call->flags;
 	c->db_id         = ctdb_db->db_id;
 	c->callid        = call->call_id;
+	c->hopcount      = 0;
 	c->keylen        = call->key.dsize;
 	c->calldatalen   = call->call_data.dsize;
 	memcpy(&c->data[0], call->key.dptr, call->key.dsize);

=== modified file 'common/ctdb_ltdb.c'
--- a/common/ctdb_ltdb.c	2007-04-30 20:34:55 +0000
+++ b/common/ctdb_ltdb.c	2007-05-01 03:25:02 +0000
@@ -372,7 +372,7 @@
 				 CTDB_CONTROL_DB_ATTACH, CTDB_CTRL_FLAG_NOREPLY,
 				 indata, NULL, NULL);
 
-	DEBUG(0,("Attached to database '%s'\n", ctdb_db->db_path));
+	DEBUG(1,("Attached to database '%s'\n", ctdb_db->db_path));
 
 	/* success */
 	return 0;

=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h	2007-04-30 13:31:40 +0000
+++ b/include/ctdb_private.h	2007-05-01 03:25:02 +0000
@@ -35,6 +35,7 @@
 #define CTDB_CURRENT_NODE  0xF0000001
 #define CTDB_BROADCAST_VNN 0xF0000002
 
+#define CTDB_MAX_REDIRECT_COUNT 3
 
 /*
   an installed ctdb remote call
@@ -157,6 +158,7 @@
 	uint32_t lockwait_calls;
 	uint32_t pending_lockwait_calls;
 	uint32_t __last_counter; /* hack for control_status_all */
+	uint32_t max_hop_count;
 	double max_call_latency;
 	double max_lockwait_latency;
 };
@@ -338,6 +340,7 @@
 	uint32_t flags;
 	uint32_t db_id;
 	uint32_t callid;
+	uint32_t hopcount;
 	uint32_t keylen;
 	uint32_t calldatalen;
 	uint8_t data[1]; /* key[] followed by calldata[] */

=== modified file 'tcp/tcp_connect.c'
--- a/tcp/tcp_connect.c	2007-04-30 20:34:55 +0000
+++ b/tcp/tcp_connect.c	2007-05-01 03:25:02 +0000
@@ -262,7 +262,7 @@
 				     ctdb->address.port);
 	ctdb->vnn = ctdb->nodes[i]->vnn;
 	ctdb->nodes[i]->flags |= NODE_FLAGS_CONNECTED;
-	DEBUG(0,("ctdb chose network address %s:%u vnn %u\n", 
+	DEBUG(1,("ctdb chose network address %s:%u vnn %u\n", 
 		 ctdb->address.address, 
 		 ctdb->address.port, 
 		 ctdb->vnn));

=== modified file 'tools/ctdb_control.c'
--- a/tools/ctdb_control.c	2007-04-30 13:54:06 +0000
+++ b/tools/ctdb_control.c	2007-05-01 03:25:02 +0000
@@ -99,6 +99,7 @@
 	printf(" pending_calls           %u\n", s->pending_calls);
 	printf(" lockwait_calls          %u\n", s->lockwait_calls);
 	printf(" pending_lockwait_calls  %u\n", s->pending_lockwait_calls);
+	printf(" max_hop_count           %u\n", s->max_hop_count);
 	printf(" max_call_latency        %.6f sec\n", s->max_call_latency);
 	printf(" max_lockwait_latency    %.6f sec\n", s->max_lockwait_latency);
 }
@@ -133,6 +134,8 @@
 		for (j=0;j<num_ints;j++) {
 			v2[j] += v1[j];
 		}
+		status.max_hop_count = 
+			MAX(status.max_hop_count, s1.max_hop_count);
 		status.max_call_latency = 
 			MAX(status.max_call_latency, s1.max_call_latency);
 		status.max_lockwait_latency = 



More information about the samba-cvs mailing list