Skip to content

feat(string): support IFEQ/IFNE/IFDEQ/IFDNE in SET command#3475

Merged
jihuayu merged 2 commits into
apache:unstablefrom
kirito632:test-set-v2
May 6, 2026
Merged

feat(string): support IFEQ/IFNE/IFDEQ/IFDNE in SET command#3475
jihuayu merged 2 commits into
apache:unstablefrom
kirito632:test-set-v2

Conversation

@kirito632
Copy link
Copy Markdown
Contributor

What

Reintroduce conditional options IFEQ / IFNE / IFDEQ / IFDNE for the SET command.

Context

This is a clean, reworked version of the previously closed #3452.
It addresses all previous feedback, reverts the accidental deletion of CommandDelEX, and is fully rebased onto the latest unstable branch.

All CI checks have been successfully run and verified on my personal fork before submission.

Behavior

  • IFEQ / IFNE: case-sensitive value comparison
  • IFDEQ / IFDNE: case-insensitive digest comparison
  • Return WRONGTYPE for non-string keys
  • Mutually exclusive with NX/XX
  • Fix: SET key value NX GET now correctly returns WRONGTYPE for non-string keys (matching Redis 8.x behavior)

Testing

  • C++ unit test: Kept only the IFDEQ empty-string boundary coverage
  • Go integration tests: Syntax, behavior, edge cases (uppercase & malformed digests), and regression coverage

AI-assisted Contribution Disclosure

AI was used for code pattern suggestions, test scaffolding, and debugging assistance.
Core logic, bug fixes, validation, and final implementation were written and verified manually.

@jihuayu PTAL, thanks!

Copy link
Copy Markdown
Member

@jihuayu jihuayu left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

The SET command is critical, as 99% of our users rely on it.
We must ensure that its test cases are both comprehensive and accurate.

Comment thread tests/gocase/unit/type/strings/strings_test.go Outdated
Comment thread tests/gocase/unit/type/strings/strings_test.go Outdated
jihuayu
jihuayu previously approved these changes May 6, 2026
Comment thread src/types/redis_string.cc Outdated
Comment thread src/types/redis_string.cc Outdated
Comment thread src/types/redis_string.cc Outdated
Add IFEQ/IFNE/IFDEQ/IFDNE conditionals to SET command, extending
the existing NX/XX/GET subcommand support. Move conditional SET
tests into testString to inherit txn-context-enabled matrix, and
add non-hex 16-char digest boundary test for IFDEQ/IFDNE.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

@git-hulk git-hulk requested a review from jihuayu May 6, 2026 13:53
@jihuayu jihuayu merged commit 07a67be into apache:unstable May 6, 2026
39 checks passed
@kirito632 kirito632 deleted the test-set-v2 branch May 7, 2026 00:48
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.

4 participants