Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xread last entry in stream (#7388) #13117

Merged
merged 7 commits into from
Mar 13, 2024

Conversation

ronen-kalish
Copy link
Collaborator

@ronen-kalish ronen-kalish commented Mar 6, 2024

Allow using + as a special ID for last item in stream on XREAD command.

This would allow to iterate on a stream with XREAD starting with the last available message instead of the next one which $ is used for.
I.e. the caller can use BLOCK and + on the first call, and change to $ on the next call.

Closes #7388

when '+' is used as item ID in XREAD command, return the last item in
the stream (provided the stream is not empty). Reduce the stream last
ID by one and start searching from there.
@ronen-kalish ronen-kalish force-pushed the xread-last-entry-in-stream-7388 branch from de9f9cb to a48443b Compare March 6, 2024 16:02
@ronen-kalish ronen-kalish force-pushed the xread-last-entry-in-stream-7388 branch from a48443b to 8f3426a Compare March 6, 2024 16:05
@sundb sundb linked an issue Mar 7, 2024 that may be closed by this pull request
@sundb
Copy link
Collaborator

sundb commented Mar 7, 2024

i guess that your editor formats the file automatically.

@oranagra oranagra requested a review from guybe7 March 7, 2024 14:11
src/t_stream.c Outdated Show resolved Hide resolved
ronen-kalish and others added 3 commits March 7, 2024 16:41
when '+' is used as item ID in XREAD command, return the last item in
the stream (provided the stream is not empty). Reduce the stream last
ID by one and start searching from there.
tests/unit/type/stream.tcl Outdated Show resolved Hide resolved
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. waiting for ack from @guybe7

@oranagra oranagra added state:major-decision Requires core team consensus approval-needed Waiting for core team approval to be merged labels Mar 11, 2024
@oranagra
Copy link
Member

@redis/core-team please approve

src/t_stream.c Show resolved Hide resolved
@oranagra
Copy link
Member

approved in a core-team meeting.
@ronen-kalish can you make a redis-doc PR?

@oranagra oranagra merged commit a8e7451 into redis:unstable Mar 13, 2024
13 checks passed
@oranagra oranagra added release-notes indication that this issue needs to be mentioned in the release notes state:needs-doc-pr requires a PR to redis-doc repository labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval-needed Waiting for core team approval to be merged release-notes indication that this issue needs to be mentioned in the release notes state:major-decision Requires core team consensus state:needs-doc-pr requires a PR to redis-doc repository
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Feature request: XREAD support for reading last message from stream
5 participants