[SCM] CTDB repository - branch master updated - 7ed5fbe7fa3bc3cb729d9b516d2a73d52e28d22d

Andrew Tridgell tridge at samba.org
Fri Aug 8 00:04:00 GMT 2008


The branch, master has been updated
       via  7ed5fbe7fa3bc3cb729d9b516d2a73d52e28d22d (commit)
       via  6915661a460cd589b441ac7cd8695f35c4e83113 (commit)
      from  58e6dc722ad1e2415b71baf1d471885169dde14d (commit)

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


- Log -----------------------------------------------------------------
commit 7ed5fbe7fa3bc3cb729d9b516d2a73d52e28d22d
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Aug 8 10:00:33 2008 +1000

    up release number

commit 6915661a460cd589b441ac7cd8695f35c4e83113
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Aug 8 09:58:49 2008 +1000

    return a more detailed error code from a trans2 commit error

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

Summary of changes:
 include/ctdb_private.h   |   10 ++++++++++
 packaging/RPM/ctdb.spec  |    2 +-
 server/ctdb_persistent.c |   23 +++++++++++++++++++++--
 3 files changed, 32 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index ff4d271..6cc1dc9 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -789,6 +789,16 @@ struct ctdb_req_keepalive {
 	struct ctdb_req_header hdr;
 };
 
+
+/* types of failures possible from TRANS2_COMMIT */
+enum ctdb_trans2_commit_error {
+	CTDB_TRANS2_COMMIT_SUCCESS=0, /* all nodes committed successfully */
+	CTDB_TRANS2_COMMIT_TIMEOUT=1, /* at least one node timed out */
+	CTDB_TRANS2_COMMIT_ALLFAIL=2, /* all nodes failed the commit */
+	CTDB_TRANS2_COMMIT_SOMEFAIL=3 /* some nodes failed the commit, some allowed it */
+};
+
+
 /* internal prototypes */
 void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
 void ctdb_fatal(struct ctdb_context *ctdb, const char *msg);
diff --git a/packaging/RPM/ctdb.spec b/packaging/RPM/ctdb.spec
index fcaf2ee..24e78fe 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
-Release: 53
+Release: 53.transactions2
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
diff --git a/server/ctdb_persistent.c b/server/ctdb_persistent.c
index 5b88b4b..faa6e83 100644
--- a/server/ctdb_persistent.c
+++ b/server/ctdb_persistent.c
@@ -32,9 +32,17 @@ struct ctdb_persistent_state {
 	const char *errormsg;
 	uint32_t num_pending;
 	int32_t status;
+	uint32_t num_failed, num_sent;
 };
 
 /*
+  1) all nodes fail, and all nodes reply
+  2) some nodes fail, all nodes reply
+  3) some nodes timeout
+  4) all nodes succeed
+ */
+
+/*
   called when a node has acknowledged a ctdb_control_update_record call
  */
 static void ctdb_persistent_callback(struct ctdb_context *ctdb,
@@ -50,10 +58,19 @@ static void ctdb_persistent_callback(struct ctdb_context *ctdb,
 			 status, errormsg));
 		state->status = status;
 		state->errormsg = errormsg;
+		state->num_failed++;
 	}
 	state->num_pending--;
 	if (state->num_pending == 0) {
-		ctdb_request_control_reply(state->ctdb, state->c, NULL, state->status, state->errormsg);
+		enum ctdb_trans2_commit_error etype;
+		if (state->num_failed == state->num_sent) {
+			etype = CTDB_TRANS2_COMMIT_ALLFAIL;
+		} else if (state->num_failed != 0) {
+			etype = CTDB_TRANS2_COMMIT_SOMEFAIL;
+		} else {
+			etype = CTDB_TRANS2_COMMIT_SUCCESS;
+		}
+		ctdb_request_control_reply(state->ctdb, state->c, NULL, etype, state->errormsg);
 		talloc_free(state);
 	}
 }
@@ -66,7 +83,8 @@ static void ctdb_persistent_store_timeout(struct event_context *ev, struct timed
 {
 	struct ctdb_persistent_state *state = talloc_get_type(private_data, struct ctdb_persistent_state);
 	
-	ctdb_request_control_reply(state->ctdb, state->c, NULL, -1, "timeout in ctdb_persistent_state");
+	ctdb_request_control_reply(state->ctdb, state->c, NULL, CTDB_TRANS2_COMMIT_TIMEOUT, 
+				   "timeout in ctdb_persistent_state");
 
 	talloc_free(state);
 }
@@ -141,6 +159,7 @@ int32_t ctdb_control_trans2_commit(struct ctdb_context *ctdb,
 		}
 
 		state->num_pending++;
+		state->num_sent++;
 	}
 
 	if (state->num_pending == 0) {


-- 
CTDB repository


More information about the samba-cvs mailing list