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
05ba119f
Commit
05ba119f
authored
Jan 08, 2015
by
Salvatore Sanfilippo
Browse files
Merge pull request #2143 from mattsta/quicklist
Quicklist (linked list + ziplist)
parents
9e718a1f
5870e224
Changes
47
Expand all
Show whitespace changes
Inline
Side-by-side
tests/support/test.tcl
View file @
05ba119f
...
...
@@ -19,9 +19,12 @@ proc assert_match {pattern value} {
}
}
proc assert_equal
{
expected value
}
{
proc assert_equal
{
expected value
{
detail
""
}
}
{
if
{
$expected
ne $value
}
{
error
"assertion:Expected '
$value
' to be equal to '
$expected
'"
if
{
$detail
ne
""
}
{
set detail
" (detail:
$detail
)"
}
error
"assertion:Expected '
$value
' to be equal to '
$expected
'
$detail
"
}
}
...
...
tests/unit/aofrw.tcl
View file @
05ba119f
...
...
@@ -77,10 +77,10 @@ start_server {tags {"aofrw"}} {
}
foreach d
{
string int
}
{
foreach e
{
ziplist linked
list
}
{
foreach e
{
quick
list
}
{
test
"AOF rewrite of list with
$e
encoding,
$d
data"
{
r flushall
if
{
$e
eq
{
ziplist
}}
{
set len 10
}
else
{
set len 1000
}
set len 1000
for
{
set j 0
}
{
$j
< $len
}
{
incr j
}
{
if
{
$d
eq
{
string
}}
{
set data
[
randstring 0 16 alpha
]
...
...
tests/unit/dump.tcl
View file @
05ba119f
...
...
@@ -157,7 +157,7 @@ start_server {tags {"dump"}} {
test
{
MIGRATE can correctly transfer large values
}
{
set first
[
srv 0 client
]
r del key
for
{
set j 0
}
{
$j
<
5
000
}
{
incr j
}
{
for
{
set j 0
}
{
$j
<
40
000
}
{
incr j
}
{
r rpush key 1 2 3 4 5 6 7 8 9 10
r rpush key
"item 1"
"item 2"
"item 3"
"item 4"
"item 5"
\
"item 6"
"item 7"
"item 8"
"item 9"
"item 10"
...
...
@@ -175,7 +175,7 @@ start_server {tags {"dump"}} {
assert
{[
$first
exists key
]
== 0
}
assert
{[
$second
exists key
]
== 1
}
assert
{[
$second
ttl key
]
== -1
}
assert
{[
$second
llen key
]
==
5
000*20
}
assert
{[
$second
llen key
]
==
40
000*20
}
}
}
...
...
tests/unit/sort.tcl
View file @
05ba119f
start_server
{
tags
{
"sort"
}
overrides
{
"list-max-ziplist-value"
16
"list-max-ziplist-entries"
32
"list-max-ziplist-size"
32
"set-max-intset-entries"
32
}
}
{
...
...
@@ -36,9 +35,9 @@ start_server {
}
foreach
{
num cmd enc title
}
{
16 lpush
zip
list
"Ziplist"
1000 lpush
linked
list
"Linked list"
10000 lpush
linked
list
"Big Linked list"
16 lpush
quick
list
"
Old
Ziplist"
1000 lpush
quick
list
"
Old
Linked list"
10000 lpush
quick
list
"
Old
Big Linked list"
16 sadd intset
"Intset"
1000 sadd hashtable
"Hash table"
10000 sadd hashtable
"Big Hash table"
...
...
@@ -85,14 +84,14 @@ start_server {
r sort tosort BY weight_* store sort-res
assert_equal $result
[
r lrange sort-res 0 -1
]
assert_equal 16
[
r llen sort-res
]
assert_encoding
zip
list sort-res
assert_encoding
quick
list sort-res
}
test
"SORT BY hash field STORE"
{
r sort tosort BY wobj_*->weight store sort-res
assert_equal $result
[
r lrange sort-res 0 -1
]
assert_equal 16
[
r llen sort-res
]
assert_encoding
zip
list sort-res
assert_encoding
quick
list sort-res
}
test
"SORT extracts STORE correctly"
{
...
...
tests/unit/type/list-2.tcl
View file @
05ba119f
start_server
{
tags
{
"list"
}
overrides
{
"list-max-ziplist-value"
16
"list-max-ziplist-entries"
256
"list-max-ziplist-size"
4
}
}
{
source
"tests/unit/type/list-common.tcl"
...
...
@@ -28,14 +27,18 @@ start_server {
for
{
set i 0
}
{
$i
< 1000
}
{
incr i
}
{
set min
[
expr
{
int
(
rand
()
*$startlen
)}]
set max
[
expr
{
$min
+int
(
rand
()
*$startlen
)}]
set before_len
[
llength $mylist
]
set before_len_r
[
r llen mylist
]
set mylist
[
lrange $mylist $min $max
]
r ltrim mylist $min $max
assert_equal $mylist
[
r lrange mylist 0 -1
]
assert_equal $mylist
[
r lrange mylist 0 -1
]
"failed trim"
set starting
[
r llen mylist
]
for
{
set j
[
r llen mylist
]}
{
$j
< $startlen
}
{
incr j
}
{
set str
[
randomInt 9223372036854775807
]
r rpush mylist $str
lappend mylist $str
assert_equal $mylist
[
r lrange mylist 0 -1
]
"failed append match"
}
}
}
...
...
tests/unit/type/list-3.tcl
View file @
05ba119f
start_server
{
tags
{
list ziplist
}
overrides
{
"list-max-ziplist-value"
200000
"list-max-ziplist-entries"
256
"list-max-ziplist-size"
16
}
}
{
test
{
Explicit regression for a list bug
}
{
...
...
tests/unit/type/list.tcl
View file @
05ba119f
This diff is collapsed.
Click to expand it.
Prev
1
2
3
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