2
0

convert-ziplist-hash-on-load.tcl 945 B

12345678910111213141516171819202122232425262728
  1. tags {"external:skip"} {
  2. # Copy RDB with ziplist encoded hash to server path
  3. set server_path [tmpdir "server.convert-ziplist-hash-on-load"]
  4. exec cp -f tests/assets/hash-ziplist.rdb $server_path
  5. start_server [list overrides [list "dir" $server_path "dbfilename" "hash-ziplist.rdb"]] {
  6. test "RDB load ziplist hash: converts to listpack when RDB loading" {
  7. r select 0
  8. assert_encoding listpack hash
  9. assert_equal 2 [r hlen hash]
  10. assert_match {v1 v2} [r hmget hash f1 f2]
  11. }
  12. }
  13. exec cp -f tests/assets/hash-ziplist.rdb $server_path
  14. start_server [list overrides [list "dir" $server_path "dbfilename" "hash-ziplist.rdb" "hash-max-ziplist-entries" 1]] {
  15. test "RDB load ziplist hash: converts to hash table when hash-max-ziplist-entries is exceeded" {
  16. r select 0
  17. assert_encoding hashtable hash
  18. assert_equal 2 [r hlen hash]
  19. assert_match {v1 v2} [r hmget hash f1 f2]
  20. }
  21. }
  22. }