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
6146329f
Commit
6146329f
authored
Aug 03, 2010
by
antirez
Browse files
replication test with expires
parent
23d7298b
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/integration/replication.tcl
View file @
6146329f
...
@@ -23,6 +23,24 @@ start_server {tags {"repl"}} {
...
@@ -23,6 +23,24 @@ start_server {tags {"repl"}} {
}
}
assert_equal
[
r debug digest
]
[
r -1 debug digest
]
assert_equal
[
r debug digest
]
[
r -1 debug digest
]
}
}
test
{
MASTER and SLAVE consistency with expire
}
{
createComplexDataset r 50000 useexpire
after 4000
;
# Make sure everything expired before taking the digest
if
{[
r debug digest
]
ne
[
r -1 debug digest
]}
{
set csv1
[
csvdump r
]
set csv2
[
csvdump
{
r -1
}]
set fd
[
open /tmp/repldump1.txt w
]
puts -nonewline $fd $csv1
close $fd
set fd
[
open /tmp/repldump2.txt w
]
puts -nonewline $fd $csv2
close $fd
puts
"Master - Slave inconsistency"
puts
"Run diff -u against /tmp/repldump*.txt for more info"
}
assert_equal
[
r debug digest
]
[
r -1 debug digest
]
}
}
}
}
}
...
...
tests/support/util.tcl
View file @
6146329f
...
@@ -140,12 +140,19 @@ proc findKeyWithType {r type} {
...
@@ -140,12 +140,19 @@ proc findKeyWithType {r type} {
return
{}
return
{}
}
}
proc createComplexDataset
{
r ops
}
{
proc createComplexDataset
{
r ops
{
opt
{}}
}
{
for
{
set j 0
}
{
$j
< $ops
}
{
incr j
}
{
for
{
set j 0
}
{
$j
< $ops
}
{
incr j
}
{
set k
[
randomKey
]
set k
[
randomKey
]
set k2
[
randomKey
]
set k2
[
randomKey
]
set f
[
randomValue
]
set f
[
randomValue
]
set v
[
randomValue
]
set v
[
randomValue
]
if
{[
lsearch -exact $opt useexpire
]
!= -1
}
{
if
{
rand
()
< 0.1
}
{
{*}
$r
expire
[
randomKey
]
[
randomInt 2
]
}
}
randpath
{
randpath
{
set d
[
expr
{
rand
()}]
set d
[
expr
{
rand
()}]
}
{
}
{
...
...
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