1
0

convert-zipmap-hash-on-load.tcl 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. tags {"external:skip"} {
  2. # Copy RDB with zipmap encoded hash to server path
  3. set server_path [tmpdir "server.convert-zipmap-hash-on-load"]
  4. exec cp -f tests/assets/hash-zipmap.rdb $server_path
  5. start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb"]] {
  6. test "RDB load zipmap hash: converts to listpack" {
  7. r select 0
  8. assert_match "*listpack*" [r debug object 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-zipmap.rdb $server_path
  14. start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-entries" 1]] {
  15. test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-entries is exceeded" {
  16. r select 0
  17. assert_match "*hashtable*" [r debug object hash]
  18. assert_equal 2 [r hlen hash]
  19. assert_match {v1 v2} [r hmget hash f1 f2]
  20. }
  21. }
  22. exec cp -f tests/assets/hash-zipmap.rdb $server_path
  23. start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-value" 1]] {
  24. test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-value is exceeded" {
  25. r select 0
  26. assert_match "*hashtable*" [r debug object hash]
  27. assert_equal 2 [r hlen hash]
  28. assert_match {v1 v2} [r hmget hash f1 f2]
  29. }
  30. }
  31. }