Unverified Commit b164c4de authored by Huang Zw's avatar Huang Zw Committed by GitHub
Browse files

In XADD take deleted items into consideration when switch to new node (#8390)

If we set stream-node-max-bytes = 0, then we insert entry then delete,
do this many times, the last stream node will be very big.
parent f5235b2d
......@@ -512,7 +512,9 @@ int streamAppendItem(stream *s, robj **argv, int64_t numfields, streamID *added_
{
lp = NULL;
} else if (server.stream_node_max_entries) {
int64_t count = lpGetInteger(lpFirst(lp));
unsigned char *lp_ele = lpFirst(lp);
/* Count both live entries and deleted ones. */
int64_t count = lpGetInteger(lp_ele) + lpGetInteger(lpNext(lp,lp_ele));
if (count >= server.stream_node_max_entries) {
/* Shrink extra pre-allocated memory */
lp = lpShrinkToFit(lp);
......
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