Skip to content

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

Open
uglide wants to merge 2 commits into
mainfrom
im/8_10-add-maxcount-and-maxsize
Open

[Redis 8.10]Add MAXCOUNT and MAXSIZE options to XREAD and XREADGROUP#3859
uglide wants to merge 2 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 optional arguments on existing stream read APIs with no client-side parsing changes; behavior depends on Redis 8.10+ when the options are used.

Overview
Adds Redis 8.10 cumulative reply limits for stream reads via optional maxCount and maxSize on XReadArgs (including Builder helpers). When set, build() emits MAXCOUNT and MAXSIZE on the wire for both XREAD and XREADGROUP; unset values stay omitted so older servers are unaffected.

MAXCOUNT caps total entries across all streams (unlike per-stream COUNT). MAXSIZE is a soft byte budget on the serialized reply. Response parsing and client semantics are unchanged; invalid combinations surface as normal Redis errors.

Coverage includes RESP encoding unit tests and integration tests (multi-stream cap, soft MAXSIZE, empty reads, group pending counts, validation), gated on Redis 8.10+.

Reviewed by Cursor Bugbot for commit 47894eb. 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

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