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
c53cab5d
Commit
c53cab5d
authored
Oct 30, 2013
by
antirez
Browse files
Test: added a SCAN test trying to trigger HT resize.
parent
ab6f4195
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/unit/scan.tcl
View file @
c53cab5d
...
...
@@ -166,4 +166,33 @@ start_server {tags {"scan"}} {
assert_equal $count
[
llength $keys2
]
}
}
test
"SCAN guarantees check under write load"
{
r flushdb
r debug populate 100
# We start scanning here, so keys from 0 to 99 should all be
# reported at the end of the iteration.
set keys
{}
while 1
{
set res
[
r scan $cur
]
set cur
[
lindex $res 0
]
set k
[
lindex $res 1
]
lappend keys
{*}
$k
if
{
$cur
== 0
}
break
# Write 10 random keys at every SCAN iteration.
for
{
set j 0
}
{
$j
< 10
}
{
incr j
}
{
r set addedkey:
[
randomInt 1000
]
foo
}
}
set keys2
{}
foreach k $keys
{
if
{[
string length $k
]
> 6
}
continue
lappend keys2 $k
}
set keys2
[
lsort -unique $keys2
]
assert_equal 100
[
llength $keys2
]
}
}
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