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
77a7ec72
Commit
77a7ec72
authored
Jul 23, 2018
by
antirez
Browse files
Merge branch 'unstable' into 5.0 branch
parents
48dfd42d
4ff47a0b
Changes
84
Hide whitespace changes
Inline
Side-by-side
tests/unit/type/stream-cgroups.tcl
View file @
77a7ec72
...
...
@@ -81,4 +81,19 @@ start_server {
# just ID2.
assert
{[
r XACK mystream mygroup $id1 $id2
]
eq 1
}
}
test
{
PEL NACK reassignment after XGROUP SETID event
}
{
r del events
r xadd events * f1 v1
r xadd events * f1 v1
r xadd events * f1 v1
r xadd events * f1 v1
r xgroup create events g1 $
r xadd events * f1 v1
set c
[
llength
[
lindex
[
r xreadgroup group g1 c1 streams events >
]
0 1
]]
assert
{
$c
== 1
}
r xgroup setid events g1 -
set c
[
llength
[
lindex
[
r xreadgroup group g1 c2 streams events >
]
0 1
]]
assert
{
$c
== 5
}
}
}
tests/unit/type/stream.tcl
View file @
77a7ec72
...
...
@@ -234,6 +234,53 @@ start_server {
assert
{[
lindex $res 0 1 1 1
]
eq
{
field two
}}
}
test
{
XDEL basic test
}
{
r del somestream
r xadd somestream * foo value0
set id
[
r xadd somestream * foo value1
]
r xadd somestream * foo value2
r xdel somestream $id
assert
{[
r xlen somestream
]
== 2
}
set result
[
r xrange somestream - +
]
assert
{[
lindex $result 0 1 1
]
eq
{
value0
}}
assert
{[
lindex $result 1 1 1
]
eq
{
value2
}}
}
# Here the idea is to check the consistency of the stream data structure
# as we remove all the elements down to zero elements.
test
{
XDEL fuzz test
}
{
r del somestream
set ids
{}
set x 0
;
# Length of the stream
while 1
{
lappend ids
[
r xadd somestream * item $x
]
incr x
# Add enough elements to have a few radix tree nodes inside the stream.
if
{[
dict get
[
r xinfo stream somestream
]
radix-tree-keys
]
> 20
}
break
}
# Now remove all the elements till we reach an empty stream
# and after every deletion, check that the stream is sane enough
# to report the right number of elements with XRANGE: this will also
# force accessing the whole data structure to check sanity.
assert
{[
r xlen somestream
]
== $x
}
# We want to remove elements in random order to really test the
# implementation in a better way.
set ids
[
lshuffle $ids
]
foreach id $ids
{
assert
{[
r xdel somestream $id
]
== 1
}
incr x -1
assert
{[
r xlen somestream
]
== $x
}
# The test would be too slow calling XRANGE for every iteration.
# Do it every 100 removal.
if
{
$x
% 100 == 0
}
{
set res
[
r xrange somestream - +
]
assert
{[
llength $res
]
== $x
}
}
}
}
test
{
XRANGE fuzzing
}
{
set low_id
[
lindex $items 0 0
]
set high_id
[
lindex $items end 0
]
...
...
tests/unit/type/zset.tcl
View file @
77a7ec72
...
...
@@ -84,7 +84,7 @@ start_server {tags {"zset"}} {
set err
}
{
ERR*
}
test
"ZADD NX with non exis
i
tng key"
{
test
"ZADD NX with non exist
i
ng key"
{
r del ztmp
r zadd ztmp nx 10 x 20 y 30 z
assert
{[
r zcard ztmp
]
== 3
}
...
...
utils/hashtable/README
View file @
77a7ec72
...
...
@@ -5,7 +5,7 @@ rehashing.c
Visually show buckets in the two hash tables between rehashings. Also stress
test getRandomKeys() implementation, that may actually disappear from
Redis soon, however visualiza
i
ton some code is reusable in new bugs
Redis soon, however visualizat
i
on some code is reusable in new bugs
investigation.
Compile with:
...
...
Prev
1
2
3
4
5
Next
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