svn commit: samba r20918 - in branches/SAMBA_4_0/source/cluster/ctdb/common: .

tridge at samba.org tridge at samba.org
Fri Jan 19 23:17:28 GMT 2007


Author: tridge
Date: 2007-01-19 23:17:28 +0000 (Fri, 19 Jan 2007)
New Revision: 20918

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20918

Log:

a bit more debugging, and remove the hackish /dev/null writes I used
to track down some uninitialised memory (sometimes valgrind gets the
offset wrong, writing to /dev/null 1 byte at a time avoids this)

Modified:
   branches/SAMBA_4_0/source/cluster/ctdb/common/ctdb_call.c
   branches/SAMBA_4_0/source/cluster/ctdb/common/ctdb_ltdb.c


Changeset:
Modified: branches/SAMBA_4_0/source/cluster/ctdb/common/ctdb_call.c
===================================================================
--- branches/SAMBA_4_0/source/cluster/ctdb/common/ctdb_call.c	2007-01-19 23:08:20 UTC (rev 20917)
+++ branches/SAMBA_4_0/source/cluster/ctdb/common/ctdb_call.c	2007-01-19 23:17:28 UTC (rev 20918)
@@ -206,7 +206,7 @@
 	memcpy(&r->data[0], key->dptr, key->dsize);
 	memcpy(&r->data[key->dsize], data->dptr, data->dsize);
 
-	if (r->hdr.destnode == ctdb->vnn && !(ctdb->flags & CTDB_FLAG_SELF_CONNECT)) {
+	if (r->hdr.destnode == ctdb->vnn) {
 		/* we are the lmaster - don't send to ourselves */
 		DEBUG(0,("XXXX local ctdb_req_dmaster\n"));
 		ctdb_request_dmaster(ctdb, &r->hdr);
@@ -243,6 +243,9 @@
 
 	DEBUG(0,("request dmaster reqid=%d\n", hdr->reqid));
 
+	DEBUG(0,("change dmaster: stage 2 - new dmaster will be %d\n",
+		 c->dmaster));
+
 	/* fetch the current record */
 	ret = ctdb_ltdb_fetch(ctdb, key, &header, &data);
 	if (ret != 0) {
@@ -250,14 +253,6 @@
 		return;
 	}
 
-	{
-		int i, fd = open("/dev/null", O_WRONLY);
-		for (i=0;i<data.dsize;i++) {
-			write(fd, &data.dptr[i], 1);
-		}
-		close(fd);
-	}
-
 	/* its a protocol error if the sending node is not the current dmaster */
 	if (header.dmaster != hdr->srcnode) {
 		ctdb_fatal(ctdb, "dmaster request from non-master");
@@ -272,14 +267,6 @@
 		return;
 	}
 
-	{
-		int i, fd = open("/dev/null", O_WRONLY);
-		for (i=0;i<data.dsize;i++) {
-			write(fd, &data.dptr[i], 1);
-		}
-		close(fd);
-	}
-
 	/* send the CTDB_REPLY_DMASTER */
 	r = ctdb->methods->allocate_pkt(ctdb, sizeof(*r) - 1 + data.dsize);
 	CTDB_NO_MEMORY_FATAL(ctdb, r);
@@ -291,24 +278,16 @@
 	r->datalen       = data.dsize;
 	memcpy(&r->data[0], data.dptr, data.dsize);
 
-	{
-		int i, fd = open("/dev/null", O_WRONLY);
-		for (i=0;i<data.dsize;i++) {
-			write(fd, &data.dptr[i], 1);
-		}
-		close(fd);
-	}
-
 	DEBUG(0,("request dmaster reqid=%d %s\n", hdr->reqid, __location__));
 
-	if (0 && r->hdr.destnode == r->hdr.srcnode) {
+	if (r->hdr.destnode == r->hdr.srcnode) {
 		ctdb_reply_dmaster(ctdb, &r->hdr);
 	} else {
 		ctdb_queue_packet(ctdb, &r->hdr);
 		DEBUG(0,("request dmaster reqid=%d %s\n", hdr->reqid, __location__));
-
-		talloc_free(r);
 	}
+
+	talloc_free(r);
 }
 
 
@@ -349,6 +328,8 @@
 	   then give them the record */
 	if (header.laccessor == c->hdr.srcnode &&
 	    header.lacount >= ctdb->max_lacount) {
+		DEBUG(0,("change dmaster: stage 1 - new dmaster will be %d\n",
+			 header.laccessor));
 		ctdb_call_send_dmaster(ctdb, c, &header, &key, &data);
 		talloc_free(data.dptr);
 		return;
@@ -436,6 +417,9 @@
 
 	talloc_steal(state, c);
 
+	DEBUG(0,("change dmaster: stage 3 - new dmaster is %d\n",
+		 ctdb->vnn));
+
 	/* we're now the dmaster - update our local ltdb with new header
 	   and data */
 	state->header.dmaster = ctdb->vnn;

Modified: branches/SAMBA_4_0/source/cluster/ctdb/common/ctdb_ltdb.c
===================================================================
--- branches/SAMBA_4_0/source/cluster/ctdb/common/ctdb_ltdb.c	2007-01-19 23:08:20 UTC (rev 20917)
+++ branches/SAMBA_4_0/source/cluster/ctdb/common/ctdb_ltdb.c	2007-01-19 23:17:28 UTC (rev 20918)
@@ -94,14 +94,6 @@
 	free(rec.dptr);
 	CTDB_NO_MEMORY(ctdb, data->dptr);
 
-	{
-		int i, fd = open("/dev/null", O_WRONLY);
-		for (i=0;i<data->dsize;i++) {
-			write(fd, &data->dptr[i], 1);
-		}
-		close(fd);
-	}
-
 	return 0;
 }
 
@@ -124,14 +116,6 @@
 	memcpy(rec.dptr, header, sizeof(*header));
 	memcpy(rec.dptr + sizeof(*header), data.dptr, data.dsize);
 
-	{
-		int i, fd = open("/dev/null", O_WRONLY);
-		for (i=0;i<rec.dsize;i++) {
-			write(fd, &rec.dptr[i], 1);
-		}
-		close(fd);
-	}
-	
 	ret = tdb_store(ctdb->ltdb, key, rec, TDB_REPLACE);
 	talloc_free(rec.dptr);
 



More information about the samba-cvs mailing list