[SCM] CTDB repository - branch 2.5 updated - ctdb-2.5.3-123-g8067abc

Amitay Isaacs amitay at samba.org
Thu Aug 14 19:56:42 MDT 2014


The branch, 2.5 has been updated
       via  8067abcf3e1f2585cbfc63d3af978f6abdfe4ba0 (commit)
       via  5a265c87ecf89ffaa5a73409abd70024b97f04b5 (commit)
       via  7964544ef773f122254f5882eb3c9b387228c56f (commit)
      from  f41a9374ef984a5a7f2e1b29577237de3b319a9e (commit)

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


- Log -----------------------------------------------------------------
commit 8067abcf3e1f2585cbfc63d3af978f6abdfe4ba0
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Aug 12 23:58:00 2014 +1000

    readonly: Do not abort if revoke of readonly record fails on a node
    
    Revoking readonly record involves first marking the record on dmaster as
    RO_REVOKING_READONLY.  Then all the other nodes are sent update_record
    control to get rid of RO_DELEGATION.  Once that succeeds, the record
    is marked RO_REVOKING_COMPLETE.
    
    Currently, revoking of readonly delegations on the nodes is tried only
    once.  If a node goes in recovery, it can fail update_record control and
    revoke code will abort ctdb.  Since database recovery would revoke all
    readonly delegations anyway, there is no reason to abort.  Simply undo
    the start of revoke process by resetting RO_REVOKING_READONLY flag.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Wed Aug 13 11:24:09 CEST 2014 on sn-devel-104
    
    (Imported from commit c6d0e8dadcff55ea21973f4f7a89f241180d17e8)

commit 5a265c87ecf89ffaa5a73409abd70024b97f04b5
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Aug 12 23:54:39 2014 +1000

    readonly: Add an early return to simplify code
    
    This patch makes the subsequent logic change small and easier to
    understand.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    (Imported from commit f96f395d853e0181d9ee031c3e3f1d31f5cff35c)

commit 7964544ef773f122254f5882eb3c9b387228c56f
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Aug 10 19:02:42 2014 +1000

    doc: Fix default database directories in ctdbd.1
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Wed Aug 13 07:06:42 CEST 2014 on sn-devel-104
    
    (Imported from commit b8e9f6b015811d7fb162634f85721b5d27ab503b)

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

Summary of changes:
 doc/ctdbd.1.xml    |    6 ++--
 server/ctdb_call.c |   78 +++++++++++++++++++++++++++------------------------
 2 files changed, 44 insertions(+), 40 deletions(-)


Changeset truncated at 500 lines:

diff --git a/doc/ctdbd.1.xml b/doc/ctdbd.1.xml
index 402f083..ab222bc 100644
--- a/doc/ctdbd.1.xml
+++ b/doc/ctdbd.1.xml
@@ -73,7 +73,7 @@
 	    should not be stored on the shared cluster filesystem.
 	  </para>
 	  <para>
-	    This directory would usually be <filename>/var/ctdb</filename>
+	    This directory would usually be <filename>/var/lib/ctdb</filename>
 	  </para>
 	</listitem>
       </varlistentry>
@@ -89,7 +89,7 @@
 	  </para>
 	  <para>
 	    This directory would usually be
-	    <filename>/etc/ctdb/persistent</filename>
+	    <filename>/var/lib/ctdb/persistent</filename>
 	  </para>
 	</listitem>
       </varlistentry>
@@ -104,7 +104,7 @@
 	  </para>
 	  <para>
 	    This directory would usually be
-	    <filename>/var/ctdb/state</filename>
+	    <filename>/var/lib/ctdb/state</filename>
 	  </para>
 	</listitem>
       </varlistentry>
diff --git a/server/ctdb_call.c b/server/ctdb_call.c
index 1830b4a..a4fa03d 100644
--- a/server/ctdb_call.c
+++ b/server/ctdb_call.c
@@ -1539,7 +1539,8 @@ static void ctdb_revoke_timeout_handler(struct event_context *ev, struct timed_e
 static int ctdb_revoke_all_delegations(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db, TDB_DATA tdata, TDB_DATA key, struct ctdb_ltdb_header *header, TDB_DATA data)
 {
 	struct ctdb_revoke_state *state = talloc_zero(ctdb, struct ctdb_revoke_state);
-	int status;
+	struct ctdb_ltdb_header new_header;
+	TDB_DATA new_data;
 
 	state->ctdb_db = ctdb_db;
 	state->key     = key;
@@ -1554,49 +1555,52 @@ static int ctdb_revoke_all_delegations(struct ctdb_context *ctdb, struct ctdb_db
 		event_loop_once(ctdb->ev);
 	}
 
-	status = state->status;
-
-	if (status == 0) {
-		struct ctdb_ltdb_header new_header;
-		TDB_DATA new_data;
+	if (ctdb_ltdb_lock(ctdb_db, key) != 0) {
+		DEBUG(DEBUG_ERR,("Failed to chainlock the database in revokechild\n"));
+		talloc_free(state);
+		return -1;
+	}
+	if (ctdb_ltdb_fetch(ctdb_db, key, &new_header, state, &new_data) != 0) {
+		ctdb_ltdb_unlock(ctdb_db, key);
+		DEBUG(DEBUG_ERR,("Failed for fetch tdb record in revokechild\n"));
+		talloc_free(state);
+		return -1;
+	}
+	header->rsn++;
+	if (new_header.rsn > header->rsn) {
+		ctdb_ltdb_unlock(ctdb_db, key);
+		DEBUG(DEBUG_ERR,("RSN too high in tdb record in revokechild\n"));
+		talloc_free(state);
+		return -1;
+	}
+	if ( (new_header.flags & (CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_HAVE_DELEGATIONS)) != (CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_HAVE_DELEGATIONS) ) {
+		ctdb_ltdb_unlock(ctdb_db, key);
+		DEBUG(DEBUG_ERR,("Flags are wrong in tdb record in revokechild\n"));
+		talloc_free(state);
+		return -1;
+	}
 
-		if (ctdb_ltdb_lock(ctdb_db, key) != 0) {
-			DEBUG(DEBUG_ERR,("Failed to chainlock the database in revokechild\n"));
-			talloc_free(state);
-			return -1;
-		}
-		if (ctdb_ltdb_fetch(ctdb_db, key, &new_header, state, &new_data) != 0) {
-			ctdb_ltdb_unlock(ctdb_db, key);
-			DEBUG(DEBUG_ERR,("Failed for fetch tdb record in revokechild\n"));
-			talloc_free(state);
-			return -1;
-		}
-		header->rsn++;
-		if (new_header.rsn > header->rsn) {
-			ctdb_ltdb_unlock(ctdb_db, key);
-			DEBUG(DEBUG_ERR,("RSN too high in tdb record in revokechild\n"));
-			talloc_free(state);
-			return -1;
-		}
-		if ( (new_header.flags & (CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_HAVE_DELEGATIONS)) != (CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_HAVE_DELEGATIONS) ) {
-			ctdb_ltdb_unlock(ctdb_db, key);
-			DEBUG(DEBUG_ERR,("Flags are wrong in tdb record in revokechild\n"));
-			talloc_free(state);
-			return -1;
-		}
+	/*
+	 * If revoke on all nodes succeed, revoke is complete.  Otherwise,
+	 * remove CTDB_REC_RO_REVOKING_READONLY flag and retry.
+	 */
+	if (state->status == 0) {
 		new_header.rsn++;
 		new_header.flags |= CTDB_REC_RO_REVOKE_COMPLETE;
-		if (ctdb_ltdb_store(ctdb_db, key, &new_header, new_data) != 0) {
-			ctdb_ltdb_unlock(ctdb_db, key);
-			DEBUG(DEBUG_ERR,("Failed to write new record in revokechild\n"));
-			talloc_free(state);
-			return -1;
-		}
+	} else {
+		DEBUG(DEBUG_NOTICE, ("Revoke all delegations failed, retrying.\n"));
+		new_header.flags &= ~CTDB_REC_RO_REVOKING_READONLY;
+	}
+	if (ctdb_ltdb_store(ctdb_db, key, &new_header, new_data) != 0) {
 		ctdb_ltdb_unlock(ctdb_db, key);
+		DEBUG(DEBUG_ERR,("Failed to write new record in revokechild\n"));
+		talloc_free(state);
+		return -1;
 	}
+	ctdb_ltdb_unlock(ctdb_db, key);
 
 	talloc_free(state);
-	return status;
+	return 0;
 }
 
 


-- 
CTDB repository


More information about the samba-cvs mailing list