vacuum: improve logging in remove_record_from_delete_queue()
authorMichael Adam <obnox@samba.org>
Fri, 23 Dec 2011 16:23:07 +0000 (17:23 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 12 Jan 2012 07:50:41 +0000 (08:50 +0100)
(cherry picked from commit 809d1f3b8a9232fce0376cb47e4f633b49237529)

server/ctdb_vacuum.c

index 499d8dc4220a88f6615e1d0362ccc31dd0ac4015..38e0c071f7034a748cc36cdf5a3cd3e77f505022 100644 (file)
@@ -1418,7 +1418,8 @@ static void remove_record_from_delete_queue(struct ctdb_db_context *ctdb_db,
        hash = (uint32_t)tdb_jenkins_hash(discard_const(&key));
 
        DEBUG(DEBUG_DEBUG, (__location__
-                           " remove_record_from_delete_queue: db[%s] "
+                           " remove_record_from_delete_queue: "
+                           "db[%s] "
                            "db_id[0x%08x] "
                            "key_hash[0x%08x] "
                            "lmaster[%u] "
@@ -1430,15 +1431,29 @@ static void remove_record_from_delete_queue(struct ctdb_db_context *ctdb_db,
 
        kd = (struct delete_record_data *)trbt_lookup32(ctdb_db->delete_queue, hash);
        if (kd == NULL) {
+               DEBUG(DEBUG_DEBUG, (__location__
+                                   " remove_record_from_delete_queue: "
+                                   "record not in queue (hash[0x%08x])\n.",
+                                   hash));
                return;
        }
-       if (kd->key.dsize != key.dsize) {
-               return;
-       }
-       if (memcmp(kd->key.dptr, key.dptr, key.dsize) != 0) {
+
+       if ((kd->key.dsize != key.dsize) ||
+           (memcmp(kd->key.dptr, key.dptr, key.dsize) != 0))
+       {
+               DEBUG(DEBUG_DEBUG, (__location__
+                                   " remove_record_from_delete_queue: "
+                                   "hash collision for key with hash[0x%08x] "
+                                   "in db[%s] - skipping\n",
+                                   hash, ctdb_db->db_name));
                return;
        }
 
+       DEBUG(DEBUG_DEBUG, (__location__
+                           " remove_record_from_delete_queue: "
+                           "removing key with hash[0x%08x]\n",
+                            hash));
+
        talloc_free(kd);
 
        return;