added a new control CTDB_CONTROL_TRANS2_COMMIT_RETRY so we can tell
authorAndrew Tridgell <tridge@samba.org>
Fri, 8 Aug 2008 03:11:28 +0000 (13:11 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 8 Aug 2008 03:11:28 +0000 (13:11 +1000)
the difference between a initial commit attempt and a retry, which
allows us to get the persistent updates counter right for retries

include/ctdb_private.h
server/ctdb_control.c
server/ctdb_persistent.c

index 6cc1dc9f9c26439c2b853240bae5dfe0955e1ef5..f44a940a84ee9cff7fb6c88e9c3c8d4a80c1dd5a 100644 (file)
@@ -549,6 +549,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
                    CTDB_CONTROL_TRANS2_COMMIT           = 83,
                    CTDB_CONTROL_TRANS2_FINISHED         = 84,
                    CTDB_CONTROL_TRANS2_ERROR            = 85,
+                   CTDB_CONTROL_TRANS2_COMMIT_RETRY     = 86,
 };     
 
 /*
index 59b0657f8983ae1f28e4409aab260e37f2f0e1a4..edfe344fdb94fe75263683b1bbb4961e6529cdd9 100644 (file)
@@ -397,6 +397,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
                return ctdb_control_cancel_persistent_update(ctdb, c, indata);
 
        case CTDB_CONTROL_TRANS2_COMMIT:
+       case CTDB_CONTROL_TRANS2_COMMIT_RETRY:
                return ctdb_control_trans2_commit(ctdb, c, indata, async_reply);
 
        case CTDB_CONTROL_TRANS2_ERROR:
index faa6e83029b39e507cdb2e4ead8aaad16679ce82..42b148c95bb9e9a7cf45dc820f9ceee49ff12735 100644 (file)
@@ -121,12 +121,18 @@ int32_t ctdb_control_trans2_commit(struct ctdb_context *ctdb,
                then have it decremented in ctdb_control_trans2_error
                or ctdb_control_trans2_finished
        */
-       if (c->opcode == CTDB_CONTROL_PERSISTENT_STORE) {
+       switch (c->opcode) {
+       case CTDB_CONTROL_PERSISTENT_STORE:
                if (client->num_persistent_updates > 0) {
                        client->num_persistent_updates--;
-               }               
-       } else {
+               }
+               break;
+       case CTDB_CONTROL_TRANS2_COMMIT:
                client->num_persistent_updates++;
+               break;
+       case CTDB_CONTROL_TRANS2_COMMIT_RETRY:
+               /* already updated from the first commit */
+               break;
        }
 
        state = talloc_zero(ctdb, struct ctdb_persistent_state);