Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
4fd35a28
Commit
4fd35a28
authored
Jun 10, 2014
by
antirez
Browse files
Cluster test: better failover detection in unit 03.
parent
92dcae8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/cluster/tests/03-failover-loop.tcl
View file @
4fd35a28
...
@@ -22,8 +22,19 @@ while {[incr iterations -1]} {
...
@@ -22,8 +22,19 @@ while {[incr iterations -1]} {
set key
[
randstring 20 20 alpha
]
set key
[
randstring 20 20 alpha
]
set val
[
randstring 20 20 alpha
]
set val
[
randstring 20 20 alpha
]
set role
[
RI $tokill role
]
set role
[
RI $tokill role
]
if
{
$role
eq
{
master
}}
{
set current_epoch
[
CI $other cluster_current_epoch
]
set slave
{}
set myid
[
dict get
[
get_myself $tokill
]
id
]
foreach_redis_id id
{
if
{
$id
== $tokill
}
continue
if
{[
dict get
[
get_myself $id
]
slaveof
]
eq $myid
}
{
set slave $id
}
}
if
{
$slave
eq
{}}
{
fail
"Unable to retrieve slave's ID for master #
$tokill
"
}
}
puts
"--- Iteration
$iterations
---"
puts
"--- Iteration
$iterations
---"
...
@@ -35,6 +46,7 @@ while {[incr iterations -1]} {
...
@@ -35,6 +46,7 @@ while {[incr iterations -1]} {
fail
"Slave of node #
$tokill
is not ok"
fail
"Slave of node #
$tokill
is not ok"
}
}
}
}
set slave_config_epoch
[
CI $slave cluster_my_epoch
]
}
}
test
"Killing node #
$tokill
"
{
test
"Killing node #
$tokill
"
{
...
@@ -42,11 +54,11 @@ while {[incr iterations -1]} {
...
@@ -42,11 +54,11 @@ while {[incr iterations -1]} {
}
}
if
{
$role
eq
{
master
}}
{
if
{
$role
eq
{
master
}}
{
test
"Wait failover"
{
test
"Wait failover
by #
$slave
with old epoch
$slave
_config_epoch
"
{
wait_for_condition 1000 50
{
wait_for_condition 1000 50
{
[
CI $
other
cluster_
current
_epoch
]
> $
current
_epoch
[
CI $
slave
cluster_
my
_epoch
]
> $
slave_config
_epoch
}
else
{
}
else
{
fail
"No failover detected"
fail
"No failover detected
, epoch is still
[
CI $slave cluster_my_epoch
]
"
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment