2021-06-09 08:13:24 -04:00
|
|
|
tags {"external:skip"} {
|
|
|
|
|
2012-01-25 16:26:25 -05:00
|
|
|
# Copy RDB with zipmap encoded hash to server path
|
2012-03-25 04:57:34 -04:00
|
|
|
set server_path [tmpdir "server.convert-zipmap-hash-on-load"]
|
2012-01-25 16:26:25 -05:00
|
|
|
|
2012-03-25 04:57:34 -04:00
|
|
|
exec cp -f tests/assets/hash-zipmap.rdb $server_path
|
2012-01-25 16:26:25 -05:00
|
|
|
start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb"]] {
|
2021-08-10 02:18:49 -04:00
|
|
|
test "RDB load zipmap hash: converts to listpack" {
|
2012-01-25 16:26:25 -05:00
|
|
|
r select 0
|
|
|
|
|
2021-08-10 02:18:49 -04:00
|
|
|
assert_match "*listpack*" [r debug object hash]
|
2012-01-25 16:26:25 -05:00
|
|
|
assert_equal 2 [r hlen hash]
|
|
|
|
assert_match {v1 v2} [r hmget hash f1 f2]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-25 04:57:34 -04:00
|
|
|
exec cp -f tests/assets/hash-zipmap.rdb $server_path
|
2012-01-25 16:26:25 -05:00
|
|
|
start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-entries" 1]] {
|
|
|
|
test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-entries is exceeded" {
|
|
|
|
r select 0
|
|
|
|
|
|
|
|
assert_match "*hashtable*" [r debug object hash]
|
|
|
|
assert_equal 2 [r hlen hash]
|
|
|
|
assert_match {v1 v2} [r hmget hash f1 f2]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-25 04:57:34 -04:00
|
|
|
exec cp -f tests/assets/hash-zipmap.rdb $server_path
|
2012-01-25 16:26:25 -05:00
|
|
|
start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-value" 1]] {
|
|
|
|
test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-value is exceeded" {
|
|
|
|
r select 0
|
|
|
|
|
|
|
|
assert_match "*hashtable*" [r debug object hash]
|
|
|
|
assert_equal 2 [r hlen hash]
|
|
|
|
assert_match {v1 v2} [r hmget hash f1 f2]
|
|
|
|
}
|
|
|
|
}
|
2021-06-09 08:13:24 -04:00
|
|
|
|
|
|
|
}
|