216 Commits

Author SHA1 Message Date
zhaozhao.zz
000b055b76 Streams: checkType before XGROUP CREATE
Fix issue #5785, in case create group on a key is not stream.
2019-03-13 12:35:10 +01:00
Steve Webster
1293e2a565 Only increment delivery count if JUSTID option is omitted 2019-03-13 11:57:20 +01:00
Steve Webster
3cc4f469bc Increment delivery counter on XCLAIM unless RETRYCOUNT specified
The XCLAIM docs state the XCLAIM increments the delivery counter for
messages. This PR makes the code match the documentation - which seems
like the desired behaviour - whilst still allowing RETRYCOUNT to be
specified manually.

My understanding of the way streamPropagateXCLAIM() works is that this
change will safely propagate to replicas since retry count is pulled
directly from the streamNACK struct.

Fixes #5194
2019-03-13 11:57:15 +01:00
antirez
45123169bc Stream: fix XREADGROUP history reading of deleted messages.
This commit fixes #5570. It is a similar bug to one fixed a few weeks
ago and is due to the range API to be called with NULL as "end ID"
parameter instead of repeating again the start ID, to be sure that we
selectively issue the entry with a given ID, or we get zero returned
(and we know we should emit a NULL reply).
2018-11-20 08:32:47 +01:00
antirez
c7951f4304 Streams: fix XREADGROUP history reading when CG last_id is low.
This fixes the issue reported in #5570.
This was fixed the hard way, that is, propagating more information to
the lower level API about this being a request to read just the history,
so that the code is simpler and less likely to regress.
2018-11-20 08:32:31 +01:00
antirez
a69bc5befe t_stream.c comment resized to 80 cols. 2018-11-20 08:32:31 +01:00
antirez
1ed821e28d Fix XCLAIM missing entry bug.
This bug had a double effect:

1. Sometimes entries may not be emitted, producing broken protocol where
the array length was greater than the emitted entires, blocking the
client waiting for more data.

2. Some other time the right entry was claimed, but a wrong entry was
returned to the client.

This fix should correct both the instances.
2018-11-05 17:12:37 +01:00
michael-grunder
b49bcd01d0 Use typedef'd mstime_t instead of time_t
This fixes an overflow on 32-bit systems.
2018-11-05 17:12:37 +01:00
antirez
09d1849ed5 Improve streamReplyWithRange() top comment. 2018-11-05 17:12:37 +01:00
antirez
4fbd7a39f8 Add command fingerprint comment for XSETID. 2018-11-05 17:12:37 +01:00
Itamar Haber
2480db53f1 Plugs a potential underflow 2018-11-05 17:12:37 +01:00
Itamar Haber
e5e4d2ef08 Corrects inline documentation of syntax 2018-11-05 17:12:37 +01:00
antirez
e79ee263cf Fix XRANGE COUNT option for value of 0. 2018-11-05 17:12:37 +01:00
antirez
505cc70ff8 Fix typo in streamReplyWithRange() top comment. 2018-11-05 17:12:37 +01:00
antirez
1eb0994ecc Streams: use bulk replies instead of status replies.
They play better with Lua scripting, otherwise Lua will see status
replies as "ok" = "string" which is very odd, and actually as @oranagra
reasoned in issue #5456 in the rest of the Redis code base there was no
such concern as saving a few bytes when the protocol is emitted.
2018-10-17 17:20:05 +02:00
antirez
bcc0916d08 Fix conditional in XGROUP. 2018-10-17 13:00:55 +02:00
antirez
56c3dfa195 Fix XGROUP CREATE MKSTREAM handling of . 2018-10-17 12:11:48 +02:00
antirez
2687f2283c Process MKSTREAM option of XGROUP CREATE at a later time.
This avoids issues with having to replicate a command that produced
errors.
2018-10-17 12:11:48 +02:00
antirez
4e4099b95d XGROUP CREATE: MKSTREAM option for automatic stream creation. 2018-10-17 11:27:09 +02:00
antirez
fd22e3acae XSETID: accept IDs based on last entry.
Related to #5426.
2018-10-17 11:02:34 +02:00
antirez
dfab3cba2a Streams: XSTREAM SETID -> XSETID.
Keep vanilla stream commands at toplevel, see #5426.
2018-10-17 11:02:34 +02:00
zhaozhao.zz
a3fb28edce Streams: rewrite id in XSTREAM CREATE * 2018-10-17 11:02:34 +02:00
zhaozhao.zz
0edbe953ea Streams: add a new command XTREAM
XSTREAM CREATE <key> <id or *> -- Create a new empty stream.
XSTREAM SETID <key> <id or $>  -- Set the current stream ID.
2018-10-17 11:02:34 +02:00
antirez
eb53f15a3e Make comment about nack->consumer test for minidle more obvious.
Related to #5437.
2018-10-15 13:05:35 +02:00
antirez
a77f836e0d Streams: use propagate_last_id itself as streamPropagateGroupID trigger.
Avoid storing the dirty value. See #5437.
2018-10-15 13:05:35 +02:00
antirez
0f0610eb01 Streams: better naming: lastid_updated -> propagate_last_id.
See #5437 but also I updated a previous usage of the same var name.
2018-10-15 13:05:35 +02:00
zhaozhao.zz
a745e4234d Streams: panic if streamID invalid after check, should not be possible. 2018-10-15 13:05:35 +02:00
zhaozhao.zz
9974be13a4 Streams: propagate lastid in XCLAIM when it has effect 2018-10-15 13:05:35 +02:00
zhaozhao.zz
69a628d0f0 Streams: XCLAIM ignore minidle if NACK is created by FORCE
Because the NACK->consumer is NULL, if idletime < minidle
the NACK does not belong to any consumer, then redis will crash
in XPENDING.
2018-10-15 13:05:35 +02:00
zhaozhao.zz
a04b43c7ea Streams: bugfix XCLAIM should propagate group name not consumer name 2018-10-15 13:05:35 +02:00
antirez
b501fd5d3e Fix propagation of consumer groups last ID.
Issue #5433.
2018-10-15 13:05:17 +02:00
antirez
2007d30c9d Refactoring of XADD / XTRIM MAXLEN rewriting.
See #5141.
2018-10-09 18:30:49 +02:00
zhaozhao.zz
041161b7ce Streams: propagate specified MAXLEN instead of approximated
Slaves and rebooting redis may have different radix tree struct,
by different stream* config options. So propagating approximated
MAXLEN to AOF/slaves may lead to date inconsistency.
2018-10-09 18:30:34 +02:00
zhaozhao.zz
f04d799bb9 Streams: reset approx_maxlen in every maxlen loop 2018-10-09 18:30:34 +02:00
zhaozhao.zz
affd93654f Streams: XTRIM will return an error if MAXLEN with a count < 0 2018-10-09 18:30:34 +02:00
zhaozhao.zz
4c405ad07f Streams: propagate original MAXLEN argument in XADD context
If we rewrite the MAXLEN argument as zero when no trimming
was performed, date between master and slave and aof will
be inconsistent, because `xtrim maxlen 0` means delete all
entries in stream.
2018-10-09 18:30:34 +02:00
antirez
c4ab5a05a7 xclaimCommand(): fix comment typos. 2018-10-09 18:30:13 +02:00
antirez
dc0b628a8e streamAppendItem(): Update the radix tree pointer only if changed. 2018-10-03 11:19:32 +02:00
antirez
260b53a284 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.
2018-10-03 11:19:32 +02:00
zhaozhao.zz
5d12f9d98b Streams: update listpack with new pointer in XDEL 2018-10-03 11:19:32 +02:00
antirez
a996b2a285 Fix XINFO comment for consistency. 2018-10-03 11:19:32 +02:00
Guy Korland
7ded552d6d add missing argument to function doc 2018-10-03 11:18:55 +02:00
Sascha Roland
eea0d3c50a #5299 Fix blocking XREAD for streams that ran dry
The conclusion, that a xread request can be answered syncronously in
case that the stream's last_id is larger than the passed last-received-id
parameter, assumes, that there must be entries present, which could be
returned immediately.
This assumption fails for empty streams that actually contained some
entries which got removed by xdel, ... .

As result, the client is answered synchronously with an empty result,
instead of blocking for new entries to arrive.
An additional check for a non-empty stream is required.
2018-08-29 19:12:29 +02:00
dejun.xdj
b59f04a099 Streams: ID of xclaim command starts from the sixth argument. 2018-08-29 12:28:09 +02:00
shenlongxing
a3f2437bdd Fix stream command paras 2018-08-29 12:28:06 +02:00
antirez
fbbcc6a657 Streams IDs parsing refactoring.
Related to #5184.
2018-08-02 18:34:42 +02:00
dejun.xdj
bd2f3f6bb1 Streams: rearrange the usage of '-' and '+' IDs in stream commands. 2018-08-02 18:34:34 +02:00
dejun.xdj
c0c06b8456 Streams: add mmid_supp argument in streamParseIDOrReply().
If 'mmid_supp' is set to 0, "-" and "+" will be
treated as an invalid ID.
2018-08-02 18:34:34 +02:00
zhaozhao.zz
0c00837669 Streams: fix xdel memory leak 2018-07-30 17:59:43 +02:00
antirez
6bfb4745fa Streams: refactoring of next entry seek in the iterator.
After #5161 the code could be made a bit more obvious for newcomers.
2018-07-24 11:16:25 +02:00