[SCM] SAMBA-CTDB repository - branch v3-4-ctdb updated - 3.4.2-ctdb-17-2-g85755ea

Michael Adam obnox at samba.org
Wed Jan 13 16:04:46 MST 2010


The branch, v3-4-ctdb has been updated
       via  85755eae6161111f1efaa95719d5c893c801e5de (commit)
       via  af5e8f691c9dbe0da9a30ee413bff40bd689452e (commit)
      from  b2e840b111b43736d14d359e89ee8a17487531f5 (commit)

http://gitweb.samba.org/?p=obnox/samba-ctdb.git;a=shortlog;h=v3-4-ctdb


- Log -----------------------------------------------------------------
commit 85755eae6161111f1efaa95719d5c893c801e5de
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 13 23:53:54 2010 +0100

    s3:dbwrap_ctdb: exit early when nothing has been written in transaction_commit.
    
    This skips update of the __db_sequence_number__ record when nothing else has
    been written. There are transactions that are just openend and then nothing
    is written until transaction_commit is called. This is for instance the case
    with registry initialization routines: They start a transaction and only
    write somthing when the registry has not been initialized yet.
    So this change will skip many db_seqnum bumps and TRANS3_COMMIT roundtrips.
    
    Michael

commit af5e8f691c9dbe0da9a30ee413bff40bd689452e
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 13 23:51:34 2010 +0100

    s3:dbwrap_ctdb: fix brown paperbag bug in ctdb_transaction_commit.
    
    I carefully prepared the return value only to "return 0;" at the bottom. :-(
    This may well have hit us for instance in the nested cancel case
    and produced random errors.
    
    Michael

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

Summary of changes:
 source3/lib/dbwrap_ctdb.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index 4e97d26..79c4c0c 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -763,6 +763,15 @@ static int db_ctdb_transaction_commit(struct db_context *db)
 		return 0;
 	}
 
+	if (h->m_write == NULL) {
+		/*
+		 * No changes were made, so don't change the seqnum,
+		 * don't push to other node, just exit with success.
+		 */
+		ret = 0;
+		goto done;
+	}
+
 	DEBUG(5,(__location__ " Commit transaction on db 0x%08x\n", ctx->db_id));
 
 	/*
@@ -790,11 +799,6 @@ static int db_ctdb_transaction_commit(struct db_context *db)
 	}
 
 again:
-	if (h->m_write == NULL) {
-		/* no changes were made, potentially after a retry */
-		goto done;
-	}
-
 	/* tell ctdbd to commit to the other nodes */
 	rets = ctdbd_control_local(messaging_ctdbd_connection(),
 				   CTDB_CONTROL_TRANS3_COMMIT,
@@ -840,7 +844,7 @@ again:
 done:
 	h->ctx->transaction = NULL;
 	talloc_free(h);
-	return 0;
+	return ret;
 }
 
 


-- 
SAMBA-CTDB repository


More information about the samba-cvs mailing list