Skip to content

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

Open
kirito632 wants to merge 1 commit intoapache:unstablefrom
kirito632:test-set-v2
Open

feat(string): support IFEQ/IFNE/IFDEQ/IFDNE in SET command#3475
kirito632 wants to merge 1 commit intoapache: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.

})
}

func TestSetConditional(t *testing.T) {
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.

The new SET conditions fail to inherit the txn-context-enabled matrix. Existing string tests (lines 40, 49) are executed in both modes.

}
})

// ── Property tests (using testing/quick via subtests) ───────────────────
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.

These aren't property tests; where did you use testing/quick?

Please ensure you've actually read through your code and understand it yourself.

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.

Apologies for the earlier issues in test scaffolding and comments — I’m fixing them now.

While moving tests into testString, I noticed that the configs parameter is currently ignored:

srv := util.StartServer(t, map[string]string{})

So tests are not actually running with txn-context enabled.

Would you prefer me to fix this in this PR, or keep this PR focused and address it separately?

Thanks for your patience!

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.

Before pushing here, I ran the full CI matrix on my personal fork and noticed two new environment-level failures. I did some triage and confirmed they are upstream environment/toolchain issues, completely unrelated to the SET command changes:

ArchLinux Container (jemalloc build failure): The rolling release updated to GCC 16.1.1, which removed the internal std::__throw_bad_alloc() symbol. This breaks jemalloc 5.3.1 during compilation. Jemalloc upstream has fixed this in master, but since 5.4.0 isn't out, it fails the build here.

Ubuntu ARM Clang (Server Startup Failure): The TestReplicationGroupSyncConfig fails exclusively on the ARM64 Clang runner with a connection refused error. The Kvrocks server process seems to exit unexpectedly during startup without generating an "Ooops!" crash log. Since the exact same code passes perfectly on ARM GCC and all x86 runners, this appears to be an ARM64 Clang-specific compiler or environment compatibility issue.

Please let me know your thoughts on how to proceed!

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.

We known and fix will be included into this PR #3478 or separated. Thanks about your investigation

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.

Build in ArchLinux fixed in this PR #3480

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.

@kirito632 All right. Fixed

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.

I have updated the PR to address the two issues you pointed out (matrix inheritance and comments).
I also passed the actual configs parameter into util.StartServer.
I have pre-verified the full CI matrix on my personal fork and it is strictly green.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 4, 2026

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.
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.

3 participants