ctdb: Print key as hex string instead of just the hash in hot record message
authorChristof Schmitt <cs@samba.org>
Thu, 16 Feb 2017 23:23:39 +0000 (16:23 -0700)
committerChristof Schmitt <cs@samba.org>
Mon, 8 May 2017 19:08:23 +0000 (21:08 +0200)
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
ctdb/server/ctdb_call.c

index ed943f91b3cbad9a679a5e6736089b0b4da1103f..3b84e754008454da9e0544ca990f9bb2c43b7a22 100644 (file)
@@ -825,6 +825,7 @@ ctdb_update_db_stat_hot_keys(struct ctdb_db_context *ctdb_db, TDB_DATA key,
                             int count)
 {
        int i, id;
+       char *keystr;
 
        /* smallest value is always at index 0 */
        if (count <= ctdb_db->statistics.hot_keys[0].count) {
@@ -860,9 +861,13 @@ ctdb_update_db_stat_hot_keys(struct ctdb_db_context *ctdb_db, TDB_DATA key,
        ctdb_db->statistics.hot_keys[id].key.dsize = key.dsize;
        ctdb_db->statistics.hot_keys[id].key.dptr  = talloc_memdup(ctdb_db, key.dptr, key.dsize);
        ctdb_db->statistics.hot_keys[id].count = count;
-       DEBUG(DEBUG_NOTICE,
-             ("Updated hot key database=%s key=0x%08x id=%d count=%d\n",
-              ctdb_db->db_name, ctdb_hash(&key), id, count));
+
+       keystr = hex_encode_talloc(ctdb_db,
+                                  (unsigned char *)key.dptr, key.dsize);
+       DEBUG(DEBUG_NOTICE,("Updated hot key database=%s key=%s id=%d "
+                           "count=%d\n", ctdb_db->db_name,
+                           keystr ? keystr : "" , id, count));
+       talloc_free(keystr);
 
 sort_keys:
        for (i = 1; i < MAX_HOT_KEYS; i++) {