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
446f24e6
Commit
446f24e6
authored
Nov 19, 2019
by
antirez
Browse files
Merge branch 'unstable' of github.com:/antirez/redis into unstable
parents
936e01e5
b311a368
Changes
5
Show whitespace changes
Inline
Side-by-side
src/adlist.h
View file @
446f24e6
...
@@ -66,7 +66,7 @@ typedef struct list {
...
@@ -66,7 +66,7 @@ typedef struct list {
#define listSetMatchMethod(l,m) ((l)->match = (m))
#define listSetMatchMethod(l,m) ((l)->match = (m))
#define listGetDupMethod(l) ((l)->dup)
#define listGetDupMethod(l) ((l)->dup)
#define listGetFree(l) ((l)->free)
#define listGetFree
Method
(l) ((l)->free)
#define listGetMatchMethod(l) ((l)->match)
#define listGetMatchMethod(l) ((l)->match)
/* Prototypes */
/* Prototypes */
...
...
src/aof.c
View file @
446f24e6
...
@@ -1766,7 +1766,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
...
@@ -1766,7 +1766,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
server
.
aof_selected_db
=
-
1
;
/* Make sure SELECT is re-issued */
server
.
aof_selected_db
=
-
1
;
/* Make sure SELECT is re-issued */
aofUpdateCurrentSize
();
aofUpdateCurrentSize
();
server
.
aof_rewrite_base_size
=
server
.
aof_current_size
;
server
.
aof_rewrite_base_size
=
server
.
aof_current_size
;
server
.
aof_
current_size
=
server
.
aof_current_size
;
server
.
aof_
fsync_offset
=
server
.
aof_current_size
;
/* Clear regular AOF buffer since its contents was just written to
/* Clear regular AOF buffer since its contents was just written to
* the new AOF from the background rewrite buffer. */
* the new AOF from the background rewrite buffer. */
...
...
src/module.c
View file @
446f24e6
...
@@ -3121,7 +3121,9 @@ fmterr:
...
@@ -3121,7 +3121,9 @@ fmterr:
* On success a RedisModuleCallReply object is returned, otherwise
* On success a RedisModuleCallReply object is returned, otherwise
* NULL is returned and errno is set to the following values:
* NULL is returned and errno is set to the following values:
*
*
* EINVAL: command non existing, wrong arity, wrong format specifier.
* EBADF: wrong format specifier.
* EINVAL: wrong command arity.
* ENOENT: command does not exist.
* EPERM: operation in Cluster instance with key in non local slot.
* EPERM: operation in Cluster instance with key in non local slot.
*
*
* This API is documented here: https://redis.io/topics/modules-intro
* This API is documented here: https://redis.io/topics/modules-intro
...
@@ -3153,7 +3155,7 @@ RedisModuleCallReply *RM_Call(RedisModuleCtx *ctx, const char *cmdname, const ch
...
@@ -3153,7 +3155,7 @@ RedisModuleCallReply *RM_Call(RedisModuleCtx *ctx, const char *cmdname, const ch
/* We handle the above format error only when the client is setup so that
/* We handle the above format error only when the client is setup so that
* we can free it normally. */
* we can free it normally. */
if
(
argv
==
NULL
)
{
if
(
argv
==
NULL
)
{
errno
=
E
INVAL
;
errno
=
E
BADF
;
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -3165,7 +3167,7 @@ RedisModuleCallReply *RM_Call(RedisModuleCtx *ctx, const char *cmdname, const ch
...
@@ -3165,7 +3167,7 @@ RedisModuleCallReply *RM_Call(RedisModuleCtx *ctx, const char *cmdname, const ch
*/
*/
cmd
=
lookupCommand
(
c
->
argv
[
0
]
->
ptr
);
cmd
=
lookupCommand
(
c
->
argv
[
0
]
->
ptr
);
if
(
!
cmd
)
{
if
(
!
cmd
)
{
errno
=
E
INVAL
;
errno
=
E
NOENT
;
goto
cleanup
;
goto
cleanup
;
}
}
c
->
cmd
=
c
->
lastcmd
=
cmd
;
c
->
cmd
=
c
->
lastcmd
=
cmd
;
...
...
tests/modules/testrdb.c
View file @
446f24e6
...
@@ -18,8 +18,11 @@ void *testrdb_type_load(RedisModuleIO *rdb, int encver) {
...
@@ -18,8 +18,11 @@ void *testrdb_type_load(RedisModuleIO *rdb, int encver) {
RedisModuleString
*
str
=
RedisModule_LoadString
(
rdb
);
RedisModuleString
*
str
=
RedisModule_LoadString
(
rdb
);
float
f
=
RedisModule_LoadFloat
(
rdb
);
float
f
=
RedisModule_LoadFloat
(
rdb
);
long
double
ld
=
RedisModule_LoadLongDouble
(
rdb
);
long
double
ld
=
RedisModule_LoadLongDouble
(
rdb
);
if
(
RedisModule_IsIOError
(
rdb
))
if
(
RedisModule_IsIOError
(
rdb
))
{
RedisModuleCtx
*
ctx
=
RedisModule_GetContextFromIO
(
rdb
);
RedisModule_FreeString
(
ctx
,
str
);
return
NULL
;
return
NULL
;
}
/* Using the values only after checking for io errors. */
/* Using the values only after checking for io errors. */
assert
(
count
==
1
);
assert
(
count
==
1
);
assert
(
encver
==
1
);
assert
(
encver
==
1
);
...
...
tests/support/test.tcl
View file @
446f24e6
...
@@ -11,28 +11,55 @@ proc fail {msg} {
...
@@ -11,28 +11,55 @@ proc fail {msg} {
proc assert
{
condition
}
{
proc assert
{
condition
}
{
if
{
!
[
uplevel 1
[
list expr $condition
]]}
{
if
{
!
[
uplevel 1
[
list expr $condition
]]}
{
error
"assertion:Expected condition '
$condition
' to be true (
[
uplevel 1
[
list subst -nocommands $condition
]]
)"
set context
"(context:
[
info frame -1
]
)"
error
"assertion:Expected
[
uplevel 1
[
list subst -nocommands $condition
]]
$context
"
}
}
}
}
proc assert_no_match
{
pattern value
}
{
proc assert_no_match
{
pattern value
}
{
if
{[
string match $pattern $value
]}
{
if
{[
string match $pattern $value
]}
{
error
"assertion:Expected '
$value
' to not match '
$pattern
'"
set context
"(context:
[
info frame -1
]
)"
error
"assertion:Expected '
$value
' to not match '
$pattern
'
$context
"
}
}
}
}
proc assert_match
{
pattern value
}
{
proc assert_match
{
pattern value
}
{
if
{
!
[
string match $pattern $value
]}
{
if
{
!
[
string match $pattern $value
]}
{
error
"assertion:Expected '
$value
' to match '
$pattern
'"
set context
"(context:
[
info frame -1
]
)"
error
"assertion:Expected '
$value
' to match '
$pattern
'
$context
"
}
}
}
}
proc assert_equal
{
expected
value
{
detail
""
}}
{
proc assert_equal
{
value
expected
{
detail
""
}}
{
if
{
$expected
ne $value
}
{
if
{
$expected
ne $value
}
{
if
{
$detail
ne
""
}
{
if
{
$detail
ne
""
}
{
set detail
" (detail:
$detail
)"
set detail
"(detail:
$detail
)"
}
else
{
set detail
"(context:
[
info frame -1
]
)"
}
error
"assertion:Expected '
$value
' to be equal to '
$expected
'
$detail
"
}
}
proc assert_lessthan
{
value expected
{
detail
""
}}
{
if
{
!
(
$value
< $expected
)}
{
if
{
$detail
ne
""
}
{
set detail
"(detail:
$detail
)"
}
else
{
set detail
"(context:
[
info frame -1
]
)"
}
error
"assertion:Expected '
$value
' to be lessthan to '
$expected
'
$detail
"
}
}
proc assert_range
{
value min max
{
detail
""
}}
{
if
{
!
(
$value
<= $max && $value >= $min
)}
{
if
{
$detail
ne
""
}
{
set detail
"(detail:
$detail
)"
}
else
{
set detail
"(context:
[
info frame -1
]
)"
}
}
error
"assertion:Expected '
$value
' to be
equal to '
$expected
'
$detail
"
error
"assertion:Expected '
$value
' to be
between to '
$min
' and '
$max
'
$detail
"
}
}
}
}
...
...
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