diff options
author | antirez <antirez@gmail.com> | 2017-11-21 22:21:37 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2017-12-01 10:24:25 +0100 |
commit | 115d076d655d265ef534bb0782da8a2ba0d877ac (patch) | |
tree | 7d77db23d4f3d8e6ff428407ca9fd644298dacff | |
parent | 9bb18e54380250f3fb931028952379c3ab2dec29 (diff) | |
download | redis-115d076d655d265ef534bb0782da8a2ba0d877ac.tar.gz |
Streams: fix lp-count field for non-same-fields entries.
-rw-r--r-- | src/t_stream.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/t_stream.c b/src/t_stream.c index 837a812a6..213a46bb1 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -308,8 +308,12 @@ int streamAppendItem(stream *s, robj **argv, int numfields, streamID *added_id, } /* Compute and store the lp-count field. */ int lp_count = numfields; - if (!(flags & STREAM_ITEM_FLAG_SAMEFIELDS)) lp_count *= 2; - lp_count += 3; /* Add the 3 fixed fileds flags + ms-diff + seq-diff. */ + lp_count += 3; /* Add the 3 fixed fields flags + ms-diff + seq-diff. */ + if (!(flags & STREAM_ITEM_FLAG_SAMEFIELDS)) { + /* If the item is not compressed, it also has the fields other than + * the values, and an additional num-fileds field. */ + lp_count += numfields+1; + } lp = lpAppendInteger(lp,lp_count); /* Insert back into the tree in order to update the listpack pointer. */ |