Skip to content

[Redis 8.10]Add MAXCOUNT and MAXSIZE options to XREAD and XREADGROUP - #3859

Merged
uglide merged 3 commits into
mainfrom
im/8_10-add-maxcount-and-maxsize
Jul 29, 2026
Merged

uglide merged 3 commits into
mainfrom
im/8_10-add-maxcount-and-maxsize

Conversation

@uglide

@uglide uglide commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

Redis 8.10 adds cumulative reply caps to the stream read commands: MAXCOUNT limits the total number of entries returned across all streams (unlike COUNT, which is per stream), and MAXSIZE applies a soft cap in bytes to the serialized reply.

Expose both as optional XReadArgs settings (maxCount/maxSize) with Builder entry points. When unset, the keywords are omitted from the wire. Response shape, blocking, and consumer-group semantics are unchanged; server-side validation errors propagate as-is.

Covered by wire-encoding unit tests and integration tests (cumulative cap across streams, oversized-first-entry MAXSIZE rule, no-message reply preservation, pending-entry accounting, error propagation), gated on Redis 8.10.


Note

Low Risk
Additive API and protocol keywords only; existing read paths are unchanged when the new args are omitted, with coverage on encoding and Redis 8.10 behavior.

Overview
Adds optional Redis 8.10 reply limits for XREAD and XREADGROUP via XReadArgs: maxCount caps total entries across all streams (unlike per-stream COUNT), and maxSize applies a soft byte budget on the serialized reply. Both are exposed on XReadArgs and Builder; unset values stay off the wire.

CommandKeyword gains MAXCOUNT and MAXSIZE, emitted from XReadArgs.build() alongside existing options. Unit tests assert RESP encoding for XREAD/XREADGROUP; integration tests (gated on Redis 8.10+) cover cross-stream caps, MAXSIZE behavior, group pending accounting, and server validation errors.

Reviewed by Cursor Bugbot for commit 6e94057. Bugbot is set up for automated code reviews on this repo. Configure here.

Redis 8.10 adds cumulative reply caps to the stream read commands:
MAXCOUNT limits the total number of entries returned across all
streams (unlike COUNT, which is per stream), and MAXSIZE applies a
soft cap in bytes to the serialized reply.

Expose both as optional XReadArgs settings (maxCount/maxSize) with
Builder entry points. When unset, the keywords are omitted from the
wire. Response shape, blocking, and consumer-group semantics are
unchanged; server-side validation errors propagate as-is.

Covered by wire-encoding unit tests and integration tests (cumulative
cap across streams, oversized-first-entry MAXSIZE rule, no-message
reply preservation, pending-entry accounting, error propagation),
gated on Redis 8.10.
@uglide
uglide requested a review from a-TODO-rov July 23, 2026 09:58
@uglide uglide changed the title Add MAXCOUNT and MAXSIZE options to XREAD and XREADGROUP [Redis 8.10]Add MAXCOUNT and MAXSIZE options to XREAD and XREADGROUP Jul 28, 2026

@ggivo ggivo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Before merge need to sync since version

* @param maxCount cumulative cap on the number of returned entries across all streams, must be positive.
* @return new {@link XReadArgs} with {@literal MAXCOUNT} set.
* @see XReadArgs#maxCount(long)
* @since 7.7

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sync on the actual version to be used for 8.10 support
Other 8.10 PR's #3858 use 7.8

@uglide
uglide merged commit 3a328b2 into main Jul 29, 2026
8 of 10 checks passed
@uglide
uglide deleted the im/8_10-add-maxcount-and-maxsize branch July 29, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址