2
0

pendingquerybuf.tcl 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. proc info_memory {r property} {
  2. if {[regexp "\r\n$property:(.*?)\r\n" [{*}$r info memory] _ value]} {
  3. set _ $value
  4. }
  5. }
  6. proc prepare_value {size} {
  7. set _v "c"
  8. for {set i 1} {$i < $size} {incr i} {
  9. append _v 0
  10. }
  11. return $_v
  12. }
  13. start_server {tags {"wait"}} {
  14. start_server {} {
  15. set slave [srv 0 client]
  16. set slave_host [srv 0 host]
  17. set slave_port [srv 0 port]
  18. set master [srv -1 client]
  19. set master_host [srv -1 host]
  20. set master_port [srv -1 port]
  21. test "pending querybuf: check size of pending_querybuf after set a big value" {
  22. $slave slaveof $master_host $master_port
  23. set _v [prepare_value [expr 32*1024*1024]]
  24. $master set key $_v
  25. after 2000
  26. set m_usedmemory [info_memory $master used_memory]
  27. set s_usedmemory [info_memory $slave used_memory]
  28. if { $s_usedmemory > $m_usedmemory + 10*1024*1024 } {
  29. fail "the used_memory of replica is much larger than master. Master:$m_usedmemory Replica:$s_usedmemory"
  30. }
  31. }
  32. }}