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
0ca2f4f8
Commit
0ca2f4f8
authored
May 17, 2020
by
antirez
Browse files
Merge branch 'unstable' of github.com:/antirez/redis into unstable
parents
96bb0c94
08d00dad
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/integration/replication.tcl
View file @
0ca2f4f8
...
...
@@ -637,3 +637,55 @@ start_server {tags {"repl"}} {
}
}
}
test
{
replicaof right after disconnection
}
{
# this is a rare race condition that was reproduced sporadically by the psync2 unit.
# see details in #7205
start_server
{
tags
{
"repl"
}}
{
set replica1
[
srv 0 client
]
set replica1_host
[
srv 0 host
]
set replica1_port
[
srv 0 port
]
set replica1_log
[
srv 0 stdout
]
start_server
{}
{
set replica2
[
srv 0 client
]
set replica2_host
[
srv 0 host
]
set replica2_port
[
srv 0 port
]
set replica2_log
[
srv 0 stdout
]
start_server
{}
{
set master
[
srv 0 client
]
set master_host
[
srv 0 host
]
set master_port
[
srv 0 port
]
$replica1 replicaof $master_host $master_port
$replica2 replicaof $master_host $master_port
wait_for_condition 50 100
{
[
string match
{
*master_link_status:up*
}
[
$replica1
info replication
]]
&&
[
string match
{
*master_link_status:up*
}
[
$replica2
info replication
]]
}
else
{
fail
"Can't turn the instance into a replica"
}
set rd
[
redis_deferring_client -1
]
$rd debug sleep 1
after 100
# when replica2 will wake up from the sleep it will find both disconnection
# from it's master and also a replicaof command at the same event loop
$master client kill type replica
$replica2 replicaof $replica1_host $replica1_port
$rd read
wait_for_condition 50 100
{
[
string match
{
*master_link_status:up*
}
[
$replica2
info replication
]]
}
else
{
fail
"role change failed."
}
# make sure psync succeeded, and there were no unexpected full syncs.
assert_equal
[
status $master sync_full
]
2
assert_equal
[
status $replica1 sync_full
]
0
assert_equal
[
status $replica2 sync_full
]
0
}
}
}
}
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