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
a72ab70f
Unverified
Commit
a72ab70f
authored
May 06, 2019
by
Salvatore Sanfilippo
Committed by
GitHub
May 06, 2019
Browse files
Merge pull request #6070 from oranagra/stabilize_repl_tests
make replication tests more stable on slow machines
parents
3d053dbb
ba809f26
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/integration/psync2.tcl
View file @
a72ab70f
...
...
@@ -166,12 +166,15 @@ start_server {} {
# Pick a random slave
set slave_id
[
expr
{(
$master
_id+1
)
%5
}]
set sync_count
[
status $R
(
$master
_id
)
sync_full
]
set sync_partial
[
status $R
(
$master
_id
)
sync_partial_ok
]
catch
{
$R
(
$slave
_id
)
config rewrite
$R
(
$slave
_id
)
debug restart
}
# note: just waiting for connected_slaves==4 has a race condition since
# we might do the check before the master realized that the slave disconnected
wait_for_condition 50 1000
{
[
status $R
(
$master
_id
)
connected_slaves
]
== 4
[
status $R
(
$master
_id
)
sync_partial_ok
]
== $sync_partial + 1
}
else
{
fail
"Replica not reconnecting"
}
...
...
tests/integration/replication-psync.tcl
View file @
a72ab70f
...
...
@@ -79,6 +79,32 @@ proc test_psync {descr duration backlog_size backlog_ttl delay cond diskless rec
stop_bg_complex_data $load_handle0
stop_bg_complex_data $load_handle1
stop_bg_complex_data $load_handle2
# Wait for the slave to reach the
"online"
# state from the POV of the master.
set retry 5000
while
{
$retry
}
{
set info
[
$master
info
]
if
{[
string match
{
*slave0:*state=online*
}
$info
]}
{
break
}
else
{
incr retry -1
after 100
}
}
if
{
$retry
== 0
}
{
error
"assertion:Slave not correctly synchronized"
}
# Wait that slave acknowledge it is online so
# we are sure that DBSIZE and DEBUG DIGEST will not
# fail because of timing issues.
(
-LOADING error
)
wait_for_condition 5000 100
{
[
lindex
[
$slave
role
]
3
]
eq
{
connected
}
}
else
{
fail
"Slave still not connected after some time"
}
set retry 10
while
{
$retry
&&
([
$master
debug digest
]
ne
[
$slave
debug digest
])}
\
{
...
...
tests/unit/maxmemory.tcl
View file @
a72ab70f
...
...
@@ -161,7 +161,7 @@ proc test_slave_buffers {test_name cmd_count payload_len limit_memory pipeline}
}
# make sure master doesn't disconnect slave because of timeout
$master config set repl-timeout
3
00
;
#
5
minutes
$master config set repl-timeout
12
00
;
#
20
minutes
(
for valgrind and slow machines
)
$master config set maxmemory-policy allkeys-random
$master config set client-output-buffer-limit
"replica 100000000 100000000 300"
$master config set repl-backlog-size
[
expr
{
10*1024
}]
...
...
@@ -212,7 +212,8 @@ proc test_slave_buffers {test_name cmd_count payload_len limit_memory pipeline}
assert
{[
$master
dbsize
]
== 100
}
assert
{
$slave
_buf > 2*1024*1024
}
;
# some of the data may have been pushed to the OS buffers
assert
{
$delta
< 50*1024 && $delta > -50*1024
}
;
# 1 byte unaccounted for, with 1M commands will consume some 1MB
set delta_max
[
expr
{
$cmd
_count / 2
}]
;
# 1 byte unaccounted for, with 1M commands will consume some 1MB
assert
{
$delta
< $delta_max && $delta > -$delta_max
}
$master client kill type slave
set killed_used
[
s -1 used_memory
]
...
...
@@ -221,7 +222,7 @@ proc test_slave_buffers {test_name cmd_count payload_len limit_memory pipeline}
set killed_used_no_repl
[
expr
{
$killed
_used - $killed_mem_not_counted_for_evict
}]
set delta_no_repl
[
expr
{
$killed
_used_no_repl - $used_no_repl
}]
assert
{
$killed
_slave_buf == 0
}
assert
{
$delta
_no_repl > -
50*1024
&& $delta_no_repl <
50*1024
}
;
# 1 byte unaccounted for, with 1M commands will consume some 1MB
assert
{
$delta
_no_repl > -
$delta_max
&& $delta_no_repl <
$delta_max
}
}
# unfreeze slave process
(
after the 'test' succeeded or failed, but before we attempt to terminate the server
...
...
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