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
93c6ea6c
Commit
93c6ea6c
authored
Jul 10, 2014
by
antirez
Browse files
Test: AOF rewrite during write load.
parent
959667ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/integration/replication.tcl
View file @
93c6ea6c
...
@@ -94,15 +94,6 @@ start_server {tags {"repl"}} {
...
@@ -94,15 +94,6 @@ start_server {tags {"repl"}} {
}
}
}
}
proc start_write_load
{
host port seconds
}
{
set tclsh
[
info nameofexecutable
]
exec $tclsh tests/helpers/gen_write_load.tcl $host $port $seconds &
}
proc stop_write_load
{
handle
}
{
catch
{
exec /bin/kill -9 $handle
}
}
start_server
{
tags
{
"repl"
}}
{
start_server
{
tags
{
"repl"
}}
{
set master
[
srv 0 client
]
set master
[
srv 0 client
]
set master_host
[
srv 0 host
]
set master_host
[
srv 0 host
]
...
...
tests/support/util.tcl
View file @
93c6ea6c
...
@@ -359,3 +359,15 @@ proc colorstr {color str} {
...
@@ -359,3 +359,15 @@ proc colorstr {color str} {
return $str
return $str
}
}
}
}
# Execute a background process writing random data for the specified number
# of seconds to the specified Redis instance.
proc start_write_load
{
host port seconds
}
{
set tclsh
[
info nameofexecutable
]
exec $tclsh tests/helpers/gen_write_load.tcl $host $port $seconds &
}
# Stop a process generating write load executed with start_write_load.
proc stop_write_load
{
handle
}
{
catch
{
exec /bin/kill -9 $handle
}
}
tests/unit/aofrw.tcl
View file @
93c6ea6c
start_server
{
tags
{
"aofrw"
}}
{
start_server
{
tags
{
"aofrw"
}}
{
# Enable the AOF
r config set appendonly yes
r config set auto-aof-rewrite-percentage 0
;
# Disable auto-rewrite.
waitForBgrewriteaof r
test
{
AOF rewrite during write load
}
{
# Start a write load for 10 seconds
set master
[
srv 0 client
]
set master_host
[
srv 0 host
]
set master_port
[
srv 0 port
]
set load_handle0
[
start_write_load $master_host $master_port 10
]
set load_handle1
[
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
]
set load_handle4
[
start_write_load $master_host $master_port 10
]
# Make sure the instance is really receiving data
wait_for_condition 50 100
{
[
r dbsize
]
> 0
}
else
{
fail
"No write load detected."
}
# After 3 seconds, start a rewrite, while the write load is still
# active.
after 3000
r bgrewriteaof
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
# 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
}
}
}
start_server
{
tags
{
"aofrw"
}}
{
test
{
Turning off AOF kills the background writing child if any
}
{
test
{
Turning off AOF kills the background writing child if any
}
{
r config set appendonly yes
r config set appendonly yes
waitForBgrewriteaof r
waitForBgrewriteaof r
...
...
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