dragonfly icon indicating copy to clipboard operation
dragonfly copied to clipboard

Add tracking for type counts, exposed via debug typez

Open chakaz opened this issue 1 year ago • 0 comments

All types are tracked upon insertion / deletion, except for MODULE.

Example manual testing:

127.0.0.1:6379> debug typez
(empty array)
127.0.0.1:6379> set x 1
OK
127.0.0.1:6379> debug typez
1) "STRING"
2) "1"
127.0.0.1:6379> set y 2
OK
127.0.0.1:6379> debug typez
1) "STRING"
2) "2"
127.0.0.1:6379> hset hash key value
(integer) 1
127.0.0.1:6379> debug typez
1) "HASH"
2) "1"
3) "STRING"
4) "2"
127.0.0.1:6379> xadd stream * key value
"1679434018164-0"
127.0.0.1:6379> debug typez
1) "STREAM"
2) "1"
3) "HASH"
4) "1"
5) "STRING"
6) "2"
127.0.0.1:6379> sadd set u
(integer) 1
127.0.0.1:6379>
127.0.0.1:6379> debug typez
1) "SET"
2) "1"
3) "STREAM"
4) "1"
5) "HASH"
6) "1"
7) "STRING"
8) "2"
127.0.0.1:6379> lpush list 42
(integer) 1
127.0.0.1:6379> debug typez
 1) "SET"
 2) "1"
 3) "STREAM"
 4) "1"
 5) "LIST"
 6) "1"
 7) "HASH"
 8) "1"
 9) "STRING"
10) "2"
127.0.0.1:6379> zadd zset 100 u
(integer) 1
127.0.0.1:6379> debug typez
 1) "SET"
 2) "1"
 3) "STREAM"
 4) "1"
 5) "LIST"
 6) "1"
 7) "ZSET"
 8) "1"
 9) "HASH"
10) "1"
11) "STRING"
12) "2"
127.0.0.1:6379> del x
(integer) 1
127.0.0.1:6379> debug typez
 1) "ZSET"
 2) "1"
 3) "SET"
 4) "1"
 5) "LIST"
 6) "1"
 7) "STREAM"
 8) "1"
 9) "HASH"
10) "1"
11) "STRING"
12) "1"
127.0.0.1:6379> del y
(integer) 1
127.0.0.1:6379> debug typez
 1) "SET"
 2) "1"
 3) "ZSET"
 4) "1"
 5) "LIST"
 6) "1"
 7) "STREAM"
 8) "1"
 9) "HASH"
10) "1"
127.0.0.1:6379> srem set u
(integer) 1
127.0.0.1:6379> debug typez
1) "ZSET"
2) "1"
3) "LIST"
4) "1"
5) "STREAM"
6) "1"
7) "HASH"
8) "1"
127.0.0.1:6379> hdel hash key
(integer) 1
127.0.0.1:6379> debug typez
1) "ZSET"
2) "1"
3) "LIST"
4) "1"
5) "STREAM"
6) "1"
127.0.0.1:6379> zrem zset u
(integer) 1
127.0.0.1:6379> debug typez
1) "LIST"
2) "1"
3) "STREAM"
4) "1"
127.0.0.1:6379> lrem list 1 1
(integer) 0
127.0.0.1:6379> lpop list
"42"
127.0.0.1:6379> debug typez
1) "STREAM"
2) "1"
127.0.0.1:6379> del stream
(integer) 1
127.0.0.1:6379> debug typez
(empty array)

#712

chakaz avatar Mar 21 '23 21:03 chakaz