Skip to content

Fixed - Reactive XADD ignores Spring Data Redis 4.1 options - #7428

Merged
mrniko merged 3 commits into
redisson:masterfrom
wn1331:fix/reactive-xadd-options
Nov 9, 2026
Merged

mrniko merged 3 commits into
redisson:masterfrom
wn1331:fix/reactive-xadd-options

Conversation

@wn1331

@wn1331 wn1331 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Spring Data Redis 4.1 carries the complete XADD configuration in XAddOptions. RedissonReactiveStreamCommands only read the deprecated maxlen property, so NOMKSTREAM, MINID, approximate trimming, LIMIT, and stream deletion policies were ignored.

Ignoring NOMKSTREAM changed command semantics by creating a missing stream. Once NOMKSTREAM is forwarded, Redis returns a null reply for a missing stream, which also required a null-safe adapter command instead of the shared non-null StreamIdConvertor.

This change serializes the Spring Data options in Redis command order:

  • NOMKSTREAM
  • KEEPREF, DELREF, or ACKED
  • MAXLEN or MINID
  • approximate trimming and LIMIT

XADD options are validated before dereferencing them, and deletion-policy and trimming arguments share a single trim-options null guard.

Regression coverage verifies the complete argument order, rejects null options with a clear validation error, and runs NOMKSTREAM against Redis. Before the fix, the integration test created the stream and returned an ID. After the fix, it emits no ID and the stream remains absent.

Validation:

  • mvn -Punit-test -pl redisson-spring/redisson-spring-data/redisson-spring-data-41 -am -Dtest=RedissonReactiveXAddCommandsTest -Dsurefire.failIfNoSpecifiedTests=false test
  • mvn -B -pl redisson-spring/redisson-spring-data/redisson-spring-data-41 -am -DskipTests -Dmaven.test.skip=false verify

All three XADD regression tests pass with JDK 25 and Maven 3.9.16. The null-options test fails with a NullPointerException before the validation change and passes afterward. Both validation commands pass. The verify run reports zero Checkstyle violations and completes PMD, license checks, and packaging.

The failed CodeQL check timed out connecting to archive.apache.org during Maven installation, before analysis began. Both CI workflows now download the pinned Maven distribution from Maven Central, with retries and bounded timeouts, and extract only after the download succeeds.

Signed-off-by: wn1331 <wn1331@gmail.com>
@wn1331
wn1331 force-pushed the fix/reactive-xadd-options branch from 0e1b646 to 989f2de Compare November 6, 2026 05:23
@mrniko mrniko added this to the 4.8.1 milestone Nov 7, 2026
@mrniko mrniko added the bug label Nov 7, 2026

@mrniko mrniko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Correct check errors

}

RedisStreamCommands.TrimOptions trimOptions = options.getTrimOptions();
if (trimOptions != null && trimOptions.hasDeletionPolicy()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please join it with if (trimOptions != null below

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 8bc09c8. The deletion-policy check now sits inside the existing trimOptions != null block, preserving the argument order. All three XADD regression tests and the module reactor verify pass.

params.add("MAXLEN");
params.add(command.getMaxlen());
RedisStreamCommands.XAddOptions options = command.getOptions();
if (options.isNoMkStream()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add Assert.notNull(command.getOptions(), …)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added Assert.notNull(command.getOptions(), "Options must not be null!") in 8bc09c8, alongside the other input checks. A regression test reproduces the previous NullPointerException and verifies the IllegalArgumentException and message after the fix.

Use Maven Central for the pinned distribution, bound download waits,
and extract only after a successful download in both workflows.

Constraint: CodeQL failed connecting to archive.apache.org before analysis
Confidence: high
Scope-risk: narrow
Tested: Maven archive download, SHA-512 comparison, extraction and version; installer shell syntax and workflow YAML parsing
Signed-off-by: wn1331 <wn1331@gmail.com>
Validate options alongside the other command inputs and keep deletion
policy and trimming serialization under one shared null guard.

Constraint: Preserve XADD argument order while addressing review feedback
Confidence: high
Scope-risk: narrow
Tested: Null-options regression failed before the guard; all three XADD tests pass after it; module reactor verify
Signed-off-by: wn1331 <wn1331@gmail.com>
@mrniko
mrniko merged commit c141828 into redisson:master Nov 9, 2026
4 checks passed
@mrniko

mrniko commented Nov 9, 2026

Copy link
Copy Markdown
Member

Thanks for contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants