cover some corner cases where the persistent database could become
authorAndrew Tridgell <tridge@samba.org>
Thu, 7 Aug 2008 03:34:18 +0000 (13:34 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 7 Aug 2008 03:34:18 +0000 (13:34 +1000)
inconsistent

client/ctdb_client.c
server/ctdb_persistent.c

index 48eb19d969e6956521d4ed01ecb9631bf68444f5..cec16d1f9b295814e3a2b69cc90a807da6bd316b 100644 (file)
@@ -3235,6 +3235,9 @@ again:
                sleep(1);
                if (ctdb_replay_transaction(h) != 0) {
                        DEBUG(DEBUG_ERR,(__location__ " Failed to replay transaction\n"));
+                       ctdb_control(ctdb, CTDB_CURRENT_NODE, h->ctdb_db->db_id, 
+                                    CTDB_CONTROL_TRANS2_ERROR, CTDB_CTRL_FLAG_NOREPLY, 
+                                    tdb_null, NULL, NULL, NULL, NULL, NULL);           
                        talloc_free(h);
                        return -1;
                }
index 77cff9c6e3211cb4fb15d3d02c53b00008cef79f..6a8a10072c74a83be031433c61e4a1df22fc714a 100644 (file)
@@ -463,6 +463,8 @@ int32_t ctdb_control_trans2_finished(struct ctdb_context *ctdb,
 
        if (client->num_persistent_updates == 0) {
                DEBUG(DEBUG_ERR, (__location__ " ERROR: num_persistent_updates == 0\n"));
+               DEBUG(DEBUG_ERR,(__location__ " Forcing recovery\n"));
+               client->ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
                return -1;
        }
        client->num_persistent_updates--;
@@ -481,9 +483,9 @@ int32_t ctdb_control_trans2_error(struct ctdb_context *ctdb,
        
        if (client->num_persistent_updates == 0) {
                DEBUG(DEBUG_ERR, (__location__ " ERROR: num_persistent_updates == 0\n"));
-               return -1;
+       } else {
+               client->num_persistent_updates--;
        }
-       client->num_persistent_updates--;
 
        DEBUG(DEBUG_ERR,(__location__ " Forcing recovery\n"));
        client->ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;