summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuy Benoish <guy.benoish@redislabs.com>2020-03-30 10:52:59 +0300
committerGuy Benoish <guy.benoish@redislabs.com>2020-03-30 10:53:03 +0300
commit12d7479144c36bea03f7d61f8474e31603eabd84 (patch)
tree182a5097f6ef8a45b5c552f970bbbb8074a21803 /src
parent97f1c808ce522113935bad244a9505a87ba27f9e (diff)
downloadredis-12d7479144c36bea03f7d61f8474e31603eabd84.tar.gz
streamReplyWithRange: Redundant XSETIDs to replica
propagate_last_id is declared outside of the loop but used only from within the loop. Once it's '1' it will never go back to '0' and will replicate XSETID even for IDs that don't actually change the last_id. While not a serious bug (XSETID always used group->last_id so there's no risk), it does causes redundant traffic between master and its replicas
Diffstat (limited to 'src')
-rw-r--r--src/t_stream.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/t_stream.c b/src/t_stream.c
index 557d1d642..00d1cbf1c 100644
--- a/src/t_stream.c
+++ b/src/t_stream.c
@@ -935,7 +935,6 @@ size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end
streamIterator si;
int64_t numfields;
streamID id;
- int propagate_last_id = 0;
/* If the client is asking for some history, we serve it using a
* different function, so that we return entries *solely* from its
@@ -951,6 +950,8 @@ size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end
arraylen_ptr = addReplyDeferredLen(c);
streamIteratorStart(&si,s,start,end,rev);
while(streamIteratorGetID(&si,&id,&numfields)) {
+ int propagate_last_id = 0;
+
/* Update the group last_id if needed. */
if (group && streamCompareID(&id,&group->last_id) > 0) {
group->last_id = id;