[SCM] CTDB repository - branch 1.2-readonly-delegations-test updated - ctdb-1.9.1-471-gfc37710

Ronnie Sahlberg sahlberg at samba.org
Thu Jul 21 00:06:36 MDT 2011


The branch, 1.2-readonly-delegations-test has been updated
       via  fc377108941e8a69aa0ec028fdb8418b080404f3 (commit)
       via  e9e7bb5b07560daa1e6615d1ddcda63ad1fba205 (commit)
      from  92ad3a8265c44e504aee0b44990ff873e5e05c53 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2-readonly-delegations-test


- Log -----------------------------------------------------------------
commit fc377108941e8a69aa0ec028fdb8418b080404f3
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jul 21 15:59:37 2011 +1000

    ReadOnly: When the client wants a readwrite lock but the local node is the dmaster and also have delegations active we must send a CALL to the local daemon to trigger it to revoke the delegations

commit e9e7bb5b07560daa1e6615d1ddcda63ad1fba205
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jul 21 15:58:56 2011 +1000

    ReadOnly: Change the update_record test tool to use the new fetchlock routine that can do either normal or readonly fetchlock

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

Summary of changes:
 client/ctdb_client.c           |   19 +++++++++++++++++++
 tests/src/ctdb_update_record.c |    4 +---
 2 files changed, 20 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index d3b1e80..f1d56d9 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -397,6 +397,10 @@ struct ctdb_client_call_state *ctdb_call_send(struct ctdb_db_context *ctdb_db,
 
 	ret = ctdb_ltdb_fetch(ctdb_db, call->key, &header, ctdb_db, &data);
 
+	if ((call->flags & CTDB_IMMEDIATE_MIGRATION) && (header.flags & CTDB_REC_RO_HAVE_DELEGATIONS)) {
+		ret = -1;
+	}
+
 	if (ret == 0 && header.dmaster == ctdb->pnn) {
 		state = ctdb_client_call_local_send(ctdb_db, call, &header, &data);
 		talloc_free(data.dptr);
@@ -739,6 +743,21 @@ again:
 		goto again;
 	}
 
+	/* if this is a request for read/write and we have delegations
+	   we have to revoke all delegations first
+	*/
+	if ((read_only == 0) 
+	&&  (h->header.dmaster == ctdb_db->ctdb->pnn)
+	&&  (h->header.flags & CTDB_REC_RO_HAVE_DELEGATIONS)) {
+		ctdb_ltdb_unlock(ctdb_db, key);
+		ret = ctdb_client_force_migration(ctdb_db, key);
+		if (ret != 0) {
+			DEBUG(DEBUG_DEBUG,("ctdb_fetch_readonly_lock: force_migration failed\n"));
+			talloc_free(h);
+			return NULL;
+		}
+		goto again;
+	}
 
 	/* if we are dmaster, just return the handle */
 	if (h->header.dmaster == ctdb_db->ctdb->pnn) {
diff --git a/tests/src/ctdb_update_record.c b/tests/src/ctdb_update_record.c
index 823dfa3..5f4b9c1 100644
--- a/tests/src/ctdb_update_record.c
+++ b/tests/src/ctdb_update_record.c
@@ -46,7 +46,7 @@ static void fetch_lock_once(struct ctdb_context *ctdb, struct event_context *ev,
 
 	printf("Trying to fetch lock the record ...\n");
 
-	h = ctdb_fetch_lock(ctdb_db, tmp_ctx, key, &data);
+	h = ctdb_fetch_readonly_lock(ctdb_db, tmp_ctx, key, &data, false);
 	if (h == NULL) {
 		printf("Failed to fetch record '%s' on node %d\n", 
 	       		(const char *)key.dptr, ctdb_get_pnn(ctdb));
@@ -57,8 +57,6 @@ static void fetch_lock_once(struct ctdb_context *ctdb, struct event_context *ev,
 	printf("Record fetchlocked.\n");
 	header = talloc_memdup(tmp_ctx, ctdb_header_from_record_handle(h), sizeof(*header));
        	printf("RSN:%d\n", (int)header->rsn);
-	printf("Press enter to release the record ...\n");
-	(void)getchar();
 	talloc_free(h);
 	printf("Record released.\n");
 


-- 
CTDB repository


More information about the samba-cvs mailing list