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
c389ad0d
Commit
c389ad0d
authored
Mar 07, 2019
by
artix
Browse files
Redis Benchmark: fix key randomization with zero keyspacelen
parent
0e963e06
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-benchmark.c
View file @
c389ad0d
...
...
@@ -345,7 +345,9 @@ static void randomizeClientKey(client c) {
for
(
i
=
0
;
i
<
c
->
randlen
;
i
++
)
{
char
*
p
=
c
->
randptr
[
i
]
+
11
;
size_t
r
=
random
()
%
config
.
randomkeys_keyspacelen
;
size_t
r
=
0
;
if
(
config
.
randomkeys_keyspacelen
!=
0
)
r
=
random
()
%
config
.
randomkeys_keyspacelen
;
size_t
j
;
for
(
j
=
0
;
j
<
12
;
j
++
)
{
...
...
@@ -1288,6 +1290,11 @@ int parseOptions(int argc, const char **argv) {
if
(
config
.
pipeline
<=
0
)
config
.
pipeline
=
1
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-r"
))
{
if
(
lastarg
)
goto
invalid
;
const
char
*
next
=
argv
[
++
i
],
*
p
=
next
;
if
(
*
p
==
'-'
)
{
p
++
;
if
(
*
p
<
'0'
||
*
p
>
'9'
)
goto
invalid
;
}
config
.
randomkeys
=
1
;
config
.
randomkeys_keyspacelen
=
atoi
(
argv
[
++
i
]);
if
(
config
.
randomkeys_keyspacelen
<
0
)
...
...
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