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.
This commit is contained in:
antirez 2018-10-02 16:20:40 +02:00
parent 9fe7cd8f14
commit c7c3b23787

View File

@ -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. */