[SCM] CTDB repository - branch 1.0.82 updated - ctdb-1.0.82-59-g9708b17

Ronnie Sahlberg sahlberg at samba.org
Wed Oct 28 21:06:21 MDT 2009


The branch, 1.0.82 has been updated
       via  9708b176895b566463d14f6d690821b8305f117b (commit)
       via  a1870a2cd8d8b35774f62afa8ee46538d97ef37e (commit)
       via  4f217e54efb16cfa1f25615c7cfbbfe0b3c1040c (commit)
       via  604294513341383ccb2680ea9be0cfbf67cfb51c (commit)
       via  4352da780c44aa8e17d21f9e355ef143d8cc68b5 (commit)
      from  0bbe9df9ec0805d29dc8e207d1113caa03d8e698 (commit)

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


- Log -----------------------------------------------------------------
commit 9708b176895b566463d14f6d690821b8305f117b
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Oct 29 14:13:49 2009 +1100

    version 1.0.82-15

commit a1870a2cd8d8b35774f62afa8ee46538d97ef37e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Oct 29 14:11:57 2009 +1100

    1.0.82 does nto have the getreclock command, so just use the variable from the sysconfig file

commit 4f217e54efb16cfa1f25615c7cfbbfe0b3c1040c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Oct 29 14:10:09 2009 +1100

    From Wolfgang M
    
    Add stronger tests for valid filenames when opening all persistent databases

commit 604294513341383ccb2680ea9be0cfbf67cfb51c
Author: Wolfgang Mueller-Friedt <wolfmuel at de.ibm.com>
Date:   Wed Oct 28 13:01:27 2009 +0300

    vacuuming needed additional check before getting rid of the record; there is a gap between selecting the records and deleting them, therefore we have to check if the records still can be deleted when we actually are about to delete them

commit 4352da780c44aa8e17d21f9e355ef143d8cc68b5
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Oct 29 13:58:33 2009 +1100

    Revert "From Wolfgang Mueller,"
    
    This reverts commit b74ba9a75db431a59b0e68a4b57c48d8c28221d5.

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

Summary of changes:
 config/events.d/01.reclock |    2 +-
 packaging/RPM/ctdb.spec    |    7 ++++++-
 server/ctdb_call.c         |    8 +-------
 server/ctdb_ltdb_server.c  |   14 ++++++++++++--
 server/ctdb_vacuum.c       |   14 ++++++++++++--
 5 files changed, 32 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/01.reclock b/config/events.d/01.reclock
index 911f7dc..0f866ef 100755
--- a/config/events.d/01.reclock
+++ b/config/events.d/01.reclock
@@ -30,7 +30,7 @@ case $cmd in
 		ctdb shutdown
 	}
 
-	RECLOCKFILE=`ctdb -Y getreclock`
+	RECLOCKFILE=$CTDB_RECOVERY_LOCK
 	[ -z "$RECLOCKFILE" ] && {
 		# we are not using a reclock file
 		echo -n > $RECLOCKCOUNT
diff --git a/packaging/RPM/ctdb.spec b/packaging/RPM/ctdb.spec
index 4af01db..dacee13 100644
--- a/packaging/RPM/ctdb.spec
+++ b/packaging/RPM/ctdb.spec
@@ -5,7 +5,7 @@ Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
 Name: ctdb
 Version: 1.0.82
-Release: 13
+Release: 15
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
@@ -133,6 +133,11 @@ fi
 %{_libdir}/pkgconfig/ctdb.pc
 
 %changelog
+* Thu Oct 29 2009 : Version 1.0.82-15
+ - From wolfgang m: fix a bug int eh vacuuming
+ - revert the previous dmaster bug workaround, was the same bug as above
+ - dont use the getreclock command in the eventscript, we dont support it
+   in this version
 * Wed Oct 14 2009 : Version 1.0.82-13
  - Recover the database instead of shutting down when there is a dmaster error detected - from Wolfgang Mueller.
 * Tue Oct 13 2009 : Version 1.0.82-12
diff --git a/server/ctdb_call.c b/server/ctdb_call.c
index c2591a7..b666a9e 100644
--- a/server/ctdb_call.c
+++ b/server/ctdb_call.c
@@ -343,13 +343,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
 			 (unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid,
 			 (key.dsize >= 4)?(*(uint32_t *)key.dptr):0));
 		if (header.rsn != 0 || header.dmaster != ctdb->pnn) {
-			/*
-			 * we used to exit here with a ctdb_fatal(ctdb, "ctdb_req_dmaster from non-master");
-			 * as long as we haven't found a protocol problem we just initiate recovery
-			 */
-			DEBUG(DEBUG_ALERT,(__location__"real-dmaster problem triggering recovery\n"));
-			ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
-			ctdb_ltdb_unlock(ctdb_db, key);
+			ctdb_fatal(ctdb, "ctdb_req_dmaster from non-master");
 			return;
 		}
 	}
diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index e76a50a..6536ab8 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
@@ -26,6 +26,7 @@
 #include "../include/ctdb_private.h"
 #include "db_wrap.h"
 #include "lib/util/dlinklist.h"
+#include <ctype.h>
 
 /*
   this is the dummy null procedure that all databases support
@@ -385,9 +386,10 @@ int ctdb_attach_persistent(struct ctdb_context *ctdb)
 	}
 
 	while ((de=readdir(d))) {
-		char *p, *s;
+	  char *p, *s, *q;
 		size_t len = strlen(de->d_name);
 		uint32_t node;
+		int invalid_name = 0;
 		
 		s = talloc_strdup(ctdb, de->d_name);
 		CTDB_NO_MEMORY(ctdb, s);
@@ -398,7 +400,15 @@ int ctdb_attach_persistent(struct ctdb_context *ctdb)
 			talloc_free(s);
 			continue;
 		}
-		if (sscanf(p+5, "%u", &node) != 1 || node != ctdb->pnn) {
+		/* only accept names ending with .tdb. and any number of digits */
+		q = p+5;
+		while (*q != 0 && invalid_name == 0) {
+			if (!isdigit(*q++)) {
+				invalid_name = 1;
+			}
+		}
+		if (invalid_name == 1 || sscanf(p+5, "%u", &node) != 1 || node != ctdb->pnn) {
+			DEBUG(DEBUG_ERR,("Ignoring persistent database '%s'\n", de->d_name));
 			talloc_free(s);
 			continue;
 		}
diff --git a/server/ctdb_vacuum.c b/server/ctdb_vacuum.c
index 69991b5..074acbb 100644
--- a/server/ctdb_vacuum.c
+++ b/server/ctdb_vacuum.c
@@ -401,8 +401,18 @@ static int repack_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
 		 * there might be hash collisions so we have to compare the keys here to be sure
 		 */
 		if (kd && kd->key.dsize == key.dsize && memcmp(kd->key.dptr, key.dptr, key.dsize) == 0) {
-			vdata->vacuumed++;
-			return 0;
+			struct ctdb_ltdb_header *hdr = (struct ctdb_ltdb_header *)data.dptr;
+			/*
+			 * we have to check if the record hasn't changed in the meantime in order to
+			 * savely remove it from the database
+			 */
+			if (data.dsize == sizeof(struct ctdb_ltdb_header) &&
+				hdr->dmaster == kd->ctdb->pnn &&
+				ctdb_lmaster(kd->ctdb, &(kd->key)) == kd->ctdb->pnn &&
+				kd->hdr.rsn == hdr->rsn) {
+				vdata->vacuumed++;
+				return 0;
+			}
 		}
 	}
 	if (tdb_store(vdata->dest_db, key, data, TDB_INSERT) != 0) {


-- 
CTDB repository


More information about the samba-cvs mailing list