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
cbf6614c
Commit
cbf6614c
authored
Oct 15, 2015
by
antirez
Browse files
Regression test for issue #2813.
parent
7cb84810
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/integration/replication.tcl
View file @
cbf6614c
proc log_file_matches
{
log pattern
}
{
set fp
[
open $log r
]
set content
[
read $fp
]
close $fp
string match $pattern $content
}
start_server
{
tags
{
"repl"
}}
{
set slave
[
srv 0 client
]
set slave_host
[
srv 0 host
]
set slave_port
[
srv 0 port
]
set slave_log
[
srv 0 stdout
]
start_server
{}
{
set master
[
srv 0 client
]
set master_host
[
srv 0 host
]
set master_port
[
srv 0 port
]
# Configure the master in order to hang waiting for the BGSAVE
# operation, so that the slave remains in the handshake state.
$master config set repl-diskless-sync yes
$master config set repl-diskless-sync-delay 1000
# Use a short replication timeout on the slave, so that if there
# are no bugs the timeout is triggered in a reasonable amount
# of time.
$slave config set repl-timeout 5
# Start the replication process...
$slave slaveof $master_host $master_port
test
{
Slave enters handshake
}
{
wait_for_condition 50 1000
{
[
string match *handshake*
[
$slave
role
]]
}
else
{
fail
"Slave does not enter handshake state"
}
}
# But make the master unable to send
# the periodic newlines to refresh the connection. The slave
# should detect the timeout.
$master debug sleep 10
test
{
Slave is able to detect timeout during handshake
}
{
wait_for_condition 50 1000
{
[
log_file_matches $slave_log
"*Timeout connecting to the MASTER*"
]
}
else
{
fail
"Slave is not able to detect timeout"
}
}
}
}
start_server
{
tags
{
"repl"
}}
{
set A
[
srv 0 client
]
set A_host
[
srv 0 host
]
...
...
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