client: untangle checks and produce more detailed error messages
authorMichael Adam <obnox@samba.org>
Wed, 2 Dec 2009 23:27:34 +0000 (00:27 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 4 Dec 2009 14:03:16 +0000 (15:03 +0100)
in ctdb_transaction_fetch_start

Michael

client/ctdb_client.c

index d0a0e335f965a26261006c099b127331a9c0fc8d..c73200d0c74e90267642eaa8a0c7d6022097852a 100644 (file)
@@ -3265,13 +3265,25 @@ again:
        }
 
        ret = ctdb_ltdb_fetch(ctdb_db, key, &header, tmp_ctx, &data);
-       if (ret != 0 || header.dmaster != ctdb_db->ctdb->pnn) {
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR,(__location__ " Failed to re-fetch transaction "
+                                "lock record inside transaction\n"));
+               tdb_transaction_cancel(ctdb_db->ltdb->tdb);
+               talloc_free(tmp_ctx);
+               goto again;
+       }
+
+       if (header.dmaster != ctdb_db->ctdb->pnn) {
+               DEBUG(DEBUG_DEBUG,(__location__ " not dmaster any more on "
+                                  "transaction lock record\n"));
                tdb_transaction_cancel(ctdb_db->ltdb->tdb);
                talloc_free(tmp_ctx);
                goto again;
        }
 
        if ((data.dsize != sizeof(pid_t)) || (*(pid_t *)(data.dptr) != pid)) {
+               DEBUG(DEBUG_DEBUG, (__location__ " my pid is not stored in "
+                                   "the transaction lock record\n"));
                tdb_transaction_cancel(ctdb_db->ltdb->tdb);
                talloc_free(tmp_ctx);
                goto again;