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

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