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
dacb69ed
Commit
dacb69ed
authored
Aug 24, 2016
by
antirez
Browse files
RDB AOF preamble: test it in the aofrw unit.
parent
764cc69e
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/aofrw.tcl
View file @
dacb69ed
...
@@ -4,60 +4,63 @@ start_server {tags {"aofrw"}} {
...
@@ -4,60 +4,63 @@ start_server {tags {"aofrw"}} {
r config set auto-aof-rewrite-percentage 0
;
# Disable auto-rewrite.
r config set auto-aof-rewrite-percentage 0
;
# Disable auto-rewrite.
waitForBgrewriteaof r
waitForBgrewriteaof r
test
{
AOF rewrite during write load
}
{
foreach rdbpre
{
yes no
}
{
# Start a write load for 10 seconds
r config set aof-use-rdb-preamble $rdbpre
set master
[
srv 0 client
]
test
"AOF rewrite during write load: RDB preamble=
$rdbpre
"
{
set master_host
[
srv 0 host
]
# Start a write load for 10 seconds
set master_port
[
srv 0 port
]
set master
[
srv 0 client
]
set load_handle0
[
start_write_load $master_host $master_port 10
]
set master_host
[
srv 0 host
]
set load_handle1
[
start_write_load $master_host $master_port 10
]
set master_port
[
srv 0 port
]
set load_handle2
[
start_write_load $master_host $master_port 10
]
set load_handle0
[
start_write_load $master_host $master_port 10
]
set load_handle3
[
start_write_load $master_host $master_port 10
]
set load_handle1
[
start_write_load $master_host $master_port 10
]
set load_handle4
[
start_write_load $master_host $master_port 10
]
set load_handle2
[
start_write_load $master_host $master_port 10
]
set load_handle3
[
start_write_load $master_host $master_port 10
]
# Make sure the instance is really receiving data
set load_handle4
[
start_write_load $master_host $master_port 10
]
wait_for_condition 50 100
{
[
r dbsize
]
> 0
# Make sure the instance is really receiving data
}
else
{
wait_for_condition 50 100
{
fail
"No write load detected."
[
r dbsize
]
> 0
}
}
else
{
fail
"No write load detected."
}
# After 3 seconds, start a rewrite, while the write load is still
# After 3 seconds, start a rewrite, while the write load is still
# active.
# active.
after 3000
after 3000
r bgrewriteaof
r bgrewriteaof
waitForBgrewriteaof r
waitForBgrewriteaof r
# Let it run a bit more so that we'll append some data to the new
# AOF.
after 1000
# Stop the processes generating the load if they are still active
stop_write_load $load_handle0
stop_write_load $load_handle1
stop_write_load $load_handle2
stop_write_load $load_handle3
stop_write_load $load_handle4
# Make sure that we remain the only connected client.
# This step is needed to make sure there are no pending writes
# that will be processed between the two
"debug digest"
calls.
wait_for_condition 50 100
{
[
llength
[
split
[
string trim
[
r client list
]]
"
\n
"
]]
== 1
}
else
{
puts
[
r client list
]
fail
"Clients generating loads are not disconnecting"
}
# Let it run a bit more so that we'll append some data to the new
# Get the data set digest
# AOF.
set d1
[
r debug digest
]
after 1000
# Stop the processes generating the load if they are still active
# Load the AOF
stop_write_load $load_handle0
r debug loadaof
stop_write_load $load_handle1
set d2
[
r debug digest
]
stop_write_load $load_handle2
stop_write_load $load_handle3
stop_write_load $load_handle4
# Make sure that we remain the only connected client.
# Make sure they are the same
# This step is needed to make sure there are no pending writes
assert
{
$d1
eq $d2
}
# that will be processed between the two
"debug digest"
calls.
wait_for_condition 50 100
{
[
llength
[
split
[
string trim
[
r client list
]]
"
\n
"
]]
== 1
}
else
{
puts
[
r client list
]
fail
"Clients generating loads are not disconnecting"
}
}
# Get the data set digest
set d1
[
r debug digest
]
# Load the AOF
r debug loadaof
set d2
[
r debug digest
]
# Make sure they are the same
assert
{
$d1
eq $d2
}
}
}
}
}
...
...
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