Rev 706: this fixes the non-dmaster bug that has plagued us for months in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Fri Jan 4 22:34:47 GMT 2008


------------------------------------------------------------
revno: 706
revision-id:tridge at samba.org-20080104223447-2ihv055d3h03macb
parent: tridge at samba.org-20080104223339-gjw04c0b1z5pg2nl
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge.kantana
timestamp: Sat 2008-01-05 09:34:47 +1100
message:
  this fixes the non-dmaster bug that has plagued us for months
modified:
  server/ctdb_recover.c          ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1
=== modified file 'server/ctdb_recover.c'
--- a/server/ctdb_recover.c	2008-01-03 22:19:06 +0000
+++ b/server/ctdb_recover.c	2008-01-04 22:34:47 +0000
@@ -303,7 +303,7 @@
 
 	rec = (struct ctdb_rec_data *)&reply->data[0];
 
-	DEBUG(3,("starting push of %u records for dbid 0x%x\n",
+	DEBUG(1,("starting push of %u records for dbid 0x%x\n",
 		 reply->count, reply->db_id));
 
 	for (i=0;i<reply->count;i++) {
@@ -328,31 +328,16 @@
 			DEBUG(0, (__location__ " Unable to fetch record\n"));
 			goto failed;
 		}
+
 		/* The check for dmaster gives priority to the dmaster
 		   if the rsn values are equal */
-		if (header.rsn < hdr->rsn ||
-		    (header.dmaster != ctdb->pnn && header.rsn == hdr->rsn)) {
-#if 0
-			/* this is a push optimisation - we can skip writing the record if:
-
-			       1) this is not a persistent db
-			   AND 2) we are not the recmaster
-			   AND 3) we don't hold the record currently
-			   AND 4) we won't hold the new record
-			*/
-			if (!ctdb_db->persistent &&
-			    ctdb->recovery_master != ctdb->pnn &&
-			    header.dmaster != ctdb->pnn &&
-			    hdr->dmaster != ctdb->pnn) {
-				DEBUG(5,("Skipping push of record\n"));
-			} else 
-#endif
-{
-				ret = ctdb_ltdb_store(ctdb_db, key, hdr, data);
-				if (ret != 0) {
-					DEBUG(0, (__location__ " Unable to store record\n"));
-					goto failed;
-				}
+		if (ctdb->pnn != ctdb->recovery_master ||
+		    header.rsn < hdr->rsn ||
+		    (header.dmaster != ctdb->recovery_master && header.rsn == hdr->rsn)) {
+			ret = ctdb_ltdb_store(ctdb_db, key, hdr, data);
+			if (ret != 0) {
+				DEBUG(0, (__location__ " Unable to store record\n"));
+				goto failed;
 			}
 		}
 
@@ -389,6 +374,9 @@
 		DEBUG(0,(__location__ " failed to write tdb data back  ret:%d\n",ret));
 		return ret;
 	}
+
+	/* TODO: add error checking here */
+
 	return 0;
 }
 



More information about the samba-cvs mailing list