Commit 13ff7bc3 authored by antirez's avatar antirez
Browse files

CG: fix RDB saving when there are no consumer groups.

parent 267f7f2c
......@@ -894,9 +894,11 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
* type, so serialize every consumer group. */
/* 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;
if (num_cgroups) {
/* Serialize each consumer group. */
raxStart(&ri,s->cgroups);
raxSeek(&ri,"^",NULL,0);
......@@ -904,7 +906,8 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
streamCG *cg = ri.data;
/* 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;
/* Last ID. */
......@@ -922,6 +925,7 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
nwritten += n;
}
raxStop(&ri);
}
} else if (o->type == OBJ_MODULE) {
/* Save a module-specific value. */
RedisModuleIO io;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment