ctdb-vacuum: add consistency check for counts at end of process_delete_list()
authorMichael Adam <obnox@samba.org>
Fri, 14 Feb 2014 21:02:41 +0000 (22:02 +0100)
committerAmitay Isaacs <amitay@gmail.com>
Thu, 6 Mar 2014 00:31:13 +0000 (11:31 +1100)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_vacuum.c

index e69452294e83ad7534185152646d53b9f86b5a93..100377ee8addbe9850e89deea4ca646c0871d6ce 100644 (file)
@@ -849,6 +849,7 @@ static int ctdb_process_delete_list(struct ctdb_db_context *ctdb_db,
        uint32_t *active_nodes;
        int num_active_nodes;
        TALLOC_CTX *tmp_ctx;
+       uint32_t sum;
 
        if (vdata->delete_count == 0) {
                return 0;
@@ -1114,6 +1115,19 @@ success:
                      (unsigned)vdata->delete_left));
        }
 
+       sum = vdata->delete_deleted
+           + vdata->delete_skipped
+           + vdata->delete_remote_error
+           + vdata->delete_local_error
+           + vdata->delete_left;
+
+       if (vdata->delete_count != sum) {
+               DEBUG(DEBUG_ERR, (__location__ " Inconsistency in vacuum "
+                     "delete list counts for db[%s]: total[%u] != sum[%u]\n",
+                     ctdb_db->db_name, (unsigned)vdata->delete_count,
+                     (unsigned)sum));
+       }
+
        if (vdata->delete_count > 0) {
                DEBUG(DEBUG_INFO,
                      (__location__