Rev 133: when we get a lmaster request, skip updating the header when we are also the new dmaster in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Tue Apr 17 06:35:28 GMT 2007


------------------------------------------------------------
revno: 133
revision-id: tridge at samba.org-20070417063528-1d3fb576e31269f0
parent: tridge at samba.org-20070417063453-11bf89e87ab63211
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Tue 2007-04-17 16:35:28 +1000
message:
  when we get a lmaster request, skip updating the header when we are also the new dmaster
modified:
  common/ctdb_call.c             ctdb_call.c-20061128065342-to93h6eejj5kon81-1
=== modified file 'common/ctdb_call.c'
--- a/common/ctdb_call.c	2007-04-17 06:20:32 +0000
+++ b/common/ctdb_call.c	2007-04-17 06:35:28 +0000
@@ -266,23 +266,27 @@
 		return;
 	}
 	
-	/* fetch the current record */
-	ret = ctdb_ltdb_fetch(ctdb_db, key, &header, hdr, &data2);
-	if (ret != 0) {
-		ctdb_fatal(ctdb, "ctdb_req_dmaster failed to fetch record");
-		return;
-	}
-
-	/* 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");
-		return;
-	}
-
-	header.dmaster = c->dmaster;
-	if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) {
-		ctdb_fatal(ctdb, "ctdb_req_dmaster unable to update dmaster");
-		return;
+	/* if the new dmaster and the lmaster are the same node, then
+	   we don't need to update the record header now */
+	if (c->dmaster != ctdb->vnn) {
+		/* fetch the current record */
+		ret = ctdb_ltdb_fetch(ctdb_db, key, &header, hdr, &data2);
+		if (ret != 0) {
+			ctdb_fatal(ctdb, "ctdb_req_dmaster failed to fetch record");
+			return;
+		}
+		
+		/* 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");
+			return;
+		}
+
+		header.dmaster = c->dmaster;
+		if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) {
+			ctdb_fatal(ctdb, "ctdb_req_dmaster unable to update dmaster");
+			return;
+		}
 	}
 
 	/* send the CTDB_REPLY_DMASTER */



More information about the samba-cvs mailing list