1 start_server
{tags
{"repl"}} {
3 test
{First server should have role slave
after SLAVEOF
} {
4 r
-1 slaveof
[srv
0 host
] [srv
0 port
]
9 test
{BRPOPLPUSH replication
, when blocking against empty
list} {
10 set rd
[redis_deferring_client
]
14 assert_equal
[r debug digest
] [r
-1 debug digest
]
17 test
{BRPOPLPUSH replication
, list exists
} {
18 set rd
[redis_deferring_client
]
24 assert_equal
[r debug digest
] [r
-1 debug digest
]
29 start_server
{tags
{"repl"}} {
33 test
{Second server should have role master at first
} {
37 test
{SLAVEOF should start with link status
"down"} {
38 r slaveof
[srv
-1 host
] [srv
-1 port
]
42 test
{The role should immediately be changed to
"slave"} {
47 test
{Sync should have transferred keys from master
} {
51 test
{The link status should be up
} {
55 test
{SET on the master should immediately propagate
} {
57 if {$::valgrind} {after 2000}
61 test
{FLUSHALL should replicate
} {
63 if {$::valgrind} {after 2000}
64 list [r
-1 dbsize
] [r
0 dbsize
]
69 proc start_write_load
{host port seconds
} {
70 exec tclsh8.5 tests
/helpers
/gen_write_load.tcl
$host $port $seconds &
73 proc stop_write_load
{handle
} {
74 catch {exec /bin
/kill
-9 $handle}
77 start_server
{tags
{"repl"}} {
78 set master
[srv
0 client
]
79 set master_host
[srv
0 host
]
80 set master_port
[srv
0 port
]
82 set load_handle0
[start_write_load
$master_host $master_port 20]
83 set load_handle1
[start_write_load
$master_host $master_port 20]
84 set load_handle2
[start_write_load
$master_host $master_port 20]
85 set load_handle3
[start_write_load
$master_host $master_port 20]
86 set load_handle4
[start_write_load
$master_host $master_port 20]
89 lappend slaves
[srv
0 client
]
91 lappend slaves
[srv
0 client
]
93 lappend slaves
[srv
0 client
]
94 test
"Connect multiple slaves at the same time (issue #141)" {
95 [lindex $slaves 0] slaveof
$master_host $master_port
96 [lindex $slaves 1] slaveof
$master_host $master_port
97 [lindex $slaves 2] slaveof
$master_host $master_port
99 # Wait for all the three slaves to reach the "online" state
103 if {[string match
{*slave0
:*,online
*slave1
:*,online
*slave2
:*,online
*} $info]} {
111 error "assertion:Slaves not correctly synchronized"
113 stop_write_load
$load_handle0
114 stop_write_load
$load_handle1
115 stop_write_load
$load_handle2
116 stop_write_load
$load_handle3
117 stop_write_load
$load_handle4
119 while {$retry && ([$master debug digest
] ne
[[lindex $slaves 0] debug digest
])} {
123 set digest
[$master debug digest
]
124 set digest0
[[lindex $slaves 0] debug digest
]
125 set digest1
[[lindex $slaves 1] debug digest
]
126 set digest2
[[lindex $slaves 2] debug digest
]
127 assert
{$digest ne
0000000000000000000000000000000000000000}
128 assert
{$digest eq
$digest0}
129 assert
{$digest eq
$digest1}
130 assert
{$digest eq
$digest2}
131 #puts [$master dbsize]
132 #puts [[lindex $slaves 0] dbsize]
133 #puts [[lindex $slaves 1] dbsize]
134 #puts [[lindex $slaves 2] dbsize]