From c7c3b23787cb403bb17051fe6f805725f3bd1ae4 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 2 Oct 2018 16:20:40 +0200 Subject: [PATCH] streamIteratorRemoveEntry(): set back lp only if pointer changed. Most of the times the pointer will remain the same since integers of similar size don't take more space in listpacks. Related to #5210. --- src/t_stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/t_stream.c b/src/t_stream.c index 3f23b9dc..1279d8fa 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -726,7 +726,8 @@ void streamIteratorRemoveEntry(streamIterator *si, streamID *current) { lp = lpReplaceInteger(lp,&p,aux+1); /* Update the listpack with the new pointer. */ - raxInsert(si->stream->rax,si->ri.key,si->ri.key_len,lp,NULL); + if (si->lp != lp) + raxInsert(si->stream->rax,si->ri.key,si->ri.key_len,lp,NULL); } /* Update the number of entries counter. */