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
13ff7bc3
Commit
13ff7bc3
authored
Feb 18, 2018
by
antirez
Browse files
CG: fix RDB saving when there are no consumer groups.
parent
267f7f2c
Changes
1
Show whitespace changes
Inline
Side-by-side
src/rdb.c
View file @
13ff7bc3
...
@@ -894,9 +894,11 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
...
@@ -894,9 +894,11 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
* type, so serialize every consumer group. */
* type, so serialize every consumer group. */
/* Save the number of groups. */
/* Save the number of groups. */
if
((
n
=
rdbSaveLen
(
rdb
,
raxSize
(
s
->
cgroups
)))
==
-
1
)
return
-
1
;
size_t num_cgroups = s->cgroups ? raxSize(s->cgroups) : 0;
if ((n = rdbSaveLen(rdb,num_cgroups)) == -1) return -1;
nwritten += n;
nwritten += n;
if (num_cgroups) {
/* Serialize each consumer group. */
/* Serialize each consumer group. */
raxStart(&ri,s->cgroups);
raxStart(&ri,s->cgroups);
raxSeek(&ri,"^",NULL,0);
raxSeek(&ri,"^",NULL,0);
...
@@ -904,7 +906,8 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
...
@@ -904,7 +906,8 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
streamCG *cg = ri.data;
streamCG *cg = ri.data;
/* Save the group name. */
/* Save the group name. */
if
((
n
=
rdbSaveRawString
(
rdb
,
ri
.
key
,
ri
.
key_len
))
==
-
1
)
return
-
1
;
if ((n = rdbSaveRawString(rdb,ri.key,ri.key_len)) == -1)
return -1;
nwritten += n;
nwritten += n;
/* Last ID. */
/* Last ID. */
...
@@ -922,6 +925,7 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
...
@@ -922,6 +925,7 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
nwritten += n;
nwritten += n;
}
}
raxStop(&ri);
raxStop(&ri);
}
} else if (o->type == OBJ_MODULE) {
} else if (o->type == OBJ_MODULE) {
/* Save a module-specific value. */
/* Save a module-specific value. */
RedisModuleIO io;
RedisModuleIO io;
...
...
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