[SCM] CTDB repository - branch master updated - ctdb-1.0.102-10-g48ac5c7

Ronnie Sahlberg sahlberg at samba.org
Thu Oct 29 16:28:50 MDT 2009


The branch, master has been updated
       via  48ac5c77698ab7a28d24629cc8a6985011c5d14d (commit)
       via  d7b9babda2f7c7f7b95ee19ec75c37200816c6ef (commit)
       via  2febdd23f754a2d4699bed36b941442ab362a376 (commit)
       via  3be446434adb0f3095ac0ef4b7c4a6258780b863 (commit)
       via  11fefd02e6c9531ffb28b9e6acaf42ba39757d87 (commit)
       via  ab9657b5a66d5665e6c5fd1bf8eb4074a3bffeec (commit)
       via  0fb9573d1c838b436ab9be83e197b68f35f94acb (commit)
       via  0df012d58eb83195ea0365be19e0566dbc394a66 (commit)
       via  6b47ea111867c845974aa2687a658ebca2854816 (commit)
       via  cb432e30351d5e5a41e98da3c7b1c2a4d400a3a2 (commit)
      from  4892222ffb255dccd8ced1cb047f199386bb3e98 (commit)

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


- Log -----------------------------------------------------------------
commit 48ac5c77698ab7a28d24629cc8a6985011c5d14d
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 13:48:36 2009 +0100

    server: fix debug message in trans2_commit (refusing persistent store during transaction)
    
    log the right db_id
    also log the client_id
    
    Michael

commit d7b9babda2f7c7f7b95ee19ec75c37200816c6ef
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 13:45:38 2009 +0100

    client: log db_id as 8-digit hex in ctdb_transaction_fetch_start()
    
    Michael

commit 2febdd23f754a2d4699bed36b941442ab362a376
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 13:44:39 2009 +0100

    server: uniformly log db and client ids as 8-digit hex numbers in trans2_commit
    
    Michael

commit 3be446434adb0f3095ac0ef4b7c4a6258780b863
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 13:30:03 2009 +0100

    server: line-wrap a debug statement in trans2_commit
    
    Michael

commit 11fefd02e6c9531ffb28b9e6acaf42ba39757d87
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 13:27:47 2009 +0100

    server: output client_id in some debug messages in trans2_commit
    
    Michael

commit ab9657b5a66d5665e6c5fd1bf8eb4074a3bffeec
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 13:24:19 2009 +0100

    server: fix a debug message in trans2_commit - log the correct db_id
    
    Michael

commit 0fb9573d1c838b436ab9be83e197b68f35f94acb
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 13:54:55 2009 +0100

    server: extend a debug message in ctdb_control_trans2_error()
    
    Michael

commit 0df012d58eb83195ea0365be19e0566dbc394a66
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 13:53:44 2009 +0100

    server: add positive debug statements to trans2_commit and trans2_finished
    
    When the operation completed / started successfully.
    
    Michael

commit 6b47ea111867c845974aa2687a658ebca2854816
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 19:49:10 2009 +0100

    client: improve "control timed out" debug message
    
    * add __location__
    * wrap overly long line
    * print unsigned ints as unsigned (reqid, opcode, destnode)
    
    Michael

commit cb432e30351d5e5a41e98da3c7b1c2a4d400a3a2
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 29 17:08:37 2009 +0100

    server: trans2_active: don't report a transaction active on the node that performs the transaction
    
    Otherwise a node can lock itself out, e.g. when a commit control times out...
    
    Michael

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

Summary of changes:
 client/ctdb_client.c     |    6 +++-
 include/ctdb_private.h   |    1 +
 server/ctdb_control.c    |    2 +-
 server/ctdb_persistent.c |   50 ++++++++++++++++++++++++++++++++++-----------
 4 files changed, 44 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index d47f771..8faa5dd 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -766,7 +766,9 @@ static void control_timeout_func(struct event_context *ev, struct timed_event *t
 {
 	struct ctdb_client_control_state *state = talloc_get_type(private_data, struct ctdb_client_control_state);
 
-	DEBUG(DEBUG_ERR,("control timed out. reqid:%d opcode:%d dstnode:%d\n", state->reqid, state->c->opcode, state->c->hdr.destnode));
+	DEBUG(DEBUG_ERR,(__location__ " control timed out. reqid:%u opcode:%u "
+			 "dstnode:%u\n", state->reqid, state->c->opcode,
+			 state->c->hdr.destnode));
 
 	state->state = CTDB_CONTROL_TIMEOUT;
 
@@ -3216,7 +3218,7 @@ again:
 					      ctdb_db->db_id);
 	if (status == 1) {
 		DEBUG(DEBUG_NOTICE, (__location__ " transaction is active "
-				     "on db_id[%u]. waiting for 1 second\n",
+				     "on db_id[0x%08x]. waiting for 1 second\n",
 				     ctdb_db->db_id));
 		sleep(1);
 		goto again;
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 2fabfea..655b336 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1471,6 +1471,7 @@ int32_t ctdb_control_trans2_finished(struct ctdb_context *ctdb,
 int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb, 
 				  struct ctdb_req_control *c);
 int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb,
+				   struct ctdb_req_control *c,
 				   uint32_t db_id);
 
 char *ctdb_addr_to_str(ctdb_sock_addr *addr);
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index b6bad1c..bf82e51 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -426,7 +426,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 
 	case CTDB_CONTROL_TRANS2_ACTIVE:
 		CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
-		return ctdb_control_trans2_active(ctdb, *(uint32_t *)indata.dptr);
+		return ctdb_control_trans2_active(ctdb, c, *(uint32_t *)indata.dptr);
 
 	case CTDB_CONTROL_RECD_PING:
 		CHECK_CONTROL_DATA_SIZE(0);
diff --git a/server/ctdb_persistent.c b/server/ctdb_persistent.c
index 3c51742..02ca7c8 100644
--- a/server/ctdb_persistent.c
+++ b/server/ctdb_persistent.c
@@ -113,7 +113,7 @@ int32_t ctdb_control_trans2_commit(struct ctdb_context *ctdb,
 	ctdb_db = find_ctdb_db(ctdb, m->db_id);
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,(__location__ " ctdb_control_trans2_commit: "
-				 "Unknown database 0x%08x\n", m->db_id));
+				 "Unknown database db_id[0x%08x]\n", m->db_id));
 		return -1;
 	}
 
@@ -138,8 +138,11 @@ int32_t ctdb_control_trans2_commit(struct ctdb_context *ctdb,
 	switch (c->opcode) {
 	case CTDB_CONTROL_PERSISTENT_STORE:
 		if (ctdb_db->transaction_active) {
-			DEBUG(DEBUG_ERR, (__location__ " trans2_commit client db_id[%d] transaction active - refusing persistent store\n",
-				client->db_id));
+			DEBUG(DEBUG_ERR, (__location__ " trans2_commit: a "
+					  "transaction is active on database "
+					  "db_id[0x%08x] - refusing persistent "
+					 " store for client id[0x%08x]\n",
+					  ctdb_db->db_id, client->client_id));
 			return -1;
 		}
 		if (client->num_persistent_updates > 0) {
@@ -148,30 +151,41 @@ int32_t ctdb_control_trans2_commit(struct ctdb_context *ctdb,
 		break;
 	case CTDB_CONTROL_TRANS2_COMMIT:
 		if (ctdb_db->transaction_active) {
-			DEBUG(DEBUG_ERR,(__location__ " trans2_commit: client "
-					 "already has a transaction commit "
-					 "active on db_id[%d]\n",
-					 client->db_id));
+			DEBUG(DEBUG_ERR,(__location__ " trans2_commit: there is"
+					 " already a transaction commit "
+					 "active on db_id[0x%08x] - forbidding "
+					 "client_id[0x%08x] to commit\n",
+					 ctdb_db->db_id, client->client_id));
 			return -1;
 		}
 		if (client->db_id != 0) {
 			DEBUG(DEBUG_ERR,(__location__ " ERROR: trans2_commit: "
-					 "client-db_id[%d] != 0\n",
-					 client->db_id));
+					 "client-db_id[0x%08x] != 0 "
+					 "(client_id[0x%08x])\n",
+					 client->db_id, client->client_id));
 			return -1;
 		}
 		client->num_persistent_updates++;
 		ctdb_db->transaction_active = true;
 		client->db_id = m->db_id;
+		DEBUG(DEBUG_DEBUG, (__location__ " client id[0x%08x] started to"
+				  " commit transaction on db id[0x%08x]\n",
+				  client->client_id, client->db_id));
 		break;
 	case CTDB_CONTROL_TRANS2_COMMIT_RETRY:
 		/* already updated from the first commit */
 		if (client->db_id != m->db_id) {
 			DEBUG(DEBUG_ERR,(__location__ " ERROR: trans2_commit "
-					 "retry: client-db_id[%d] != db_id[%d]"
-					 "\n", client->db_id, m->db_id));
+					 "retry: client-db_id[0x%08x] != "
+					 "db_id[0x%08x] (client_id[0x%08x])\n",
+					 client->db_id,
+					 m->db_id, client->client_id));
 			return -1;
 		}
+		DEBUG(DEBUG_DEBUG, (__location__ " client id[0x%08x] started "
+				    "transaction commit retry on "
+				    "db_id[0x%08x]\n",
+				    client->client_id, client->db_id));
 		break;
 	}
 
@@ -563,6 +577,10 @@ int32_t ctdb_control_trans2_finished(struct ctdb_context *ctdb,
 	}
 	client->num_persistent_updates--;
 
+	DEBUG(DEBUG_DEBUG, (__location__ " client id[0x%08x] finished "
+			    "transaction commit db_id[0x%08x]\n",
+			    client->client_id, ctdb_db->db_id));
+
 	return 0;
 }
 
@@ -598,7 +616,9 @@ int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb,
 		client->num_persistent_updates--;
 	}
 
-	DEBUG(DEBUG_ERR,(__location__ " Forcing recovery\n"));
+	DEBUG(DEBUG_ERR,(__location__ " An error occurred during transaction on"
+			 " db_id[0x%08x] - forcing recovery\n",
+			 ctdb_db->db_id));
 	client->ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
 
 	return 0;
@@ -608,9 +628,11 @@ int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb,
  * Tell whether a transaction is active on this node on the give DB.
  */
 int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb,
+				   struct ctdb_req_control *c,
 				   uint32_t db_id)
 {
 	struct ctdb_db_context *ctdb_db;
+	struct ctdb_client *client = ctdb_reqid_find(ctdb, c->client_id, struct ctdb_client);
 
 	ctdb_db = find_ctdb_db(ctdb, db_id);
 	if (!ctdb_db) {
@@ -618,6 +640,10 @@ int32_t ctdb_control_trans2_active(struct ctdb_context *ctdb,
 		return -1;
 	}
 
+	if (client->db_id == db_id) {
+		return 0;
+	}
+
 	if (ctdb_db->transaction_active) {
 		return 1;
 	} else {


-- 
CTDB repository


More information about the samba-cvs mailing list