Skip to content

SET: add IFNE conditional option#3105

Open
arshidkv12 wants to merge 5 commits intovalkey-io:unstablefrom
arshidkv12:ifne
Open

SET: add IFNE conditional option#3105
arshidkv12 wants to merge 5 commits intovalkey-io:unstablefrom
arshidkv12:ifne

Conversation

@arshidkv12
Copy link
Contributor

Adds IFNE option to SET, allowing a conditional set when the value differs. Includes tests.

Signed-off-by: arshidkv12 <[email protected]>
Signed-off-by: arshidkv12 <[email protected]>
Signed-off-by: arshidkv12 <[email protected]>
@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.19%. Comparing base (d8315cf) to head (a5cb18a).
⚠️ Report is 13 commits behind head on unstable.

Files with missing lines Patch % Lines
src/t_string.c 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #3105      +/-   ##
============================================
- Coverage     74.27%   74.19%   -0.08%     
============================================
  Files           129      129              
  Lines         71041    71057      +16     
============================================
- Hits          52764    52720      -44     
- Misses        18277    18337      +60     
Files with missing lines Coverage Δ
src/commands.def 100.00% <ø> (ø)
src/server.c 89.53% <100.00%> (-0.06%) ⬇️
src/server.h 100.00% <ø> (ø)
src/t_string.c 97.62% <85.71%> (-0.19%) ⬇️

... and 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: arshidkv12 <[email protected]>
Signed-off-by: arshidkv12 <[email protected]>
@arshidkv12
Copy link
Contributor Author

arshidkv12 commented Jan 24, 2026

Please check it @zuiderkwast

PingXie added a commit to PingXie/valkey that referenced this pull request Jan 27, 2026
Issue: PR valkey-io#3105 was passing even though it's a subset of Redis #14435.
- Valkey: Adds IFNE option (132 lines, 7 files)
- Redis: Adds IFEQ/IFNE/IFNEQ + xxhash + digest (9843 lines, 18 files)
- Jaccard similarity only 20% due to size difference
- But 90-100% of Valkey tokens exist in Redis (subset relationship)

Fix: Check subset ratio in addition to Jaccard similarity.
- Subset ratio = |Valkey ∩ Redis| / |Valkey|
- Detects when smaller PR cherry-picks from larger PR
- Final similarity = max(weighted_jaccard, subset_ratio)

Per-file analysis of PR valkey-io#3105 vs #14435:
- src/commands.def: 92.9% subset ratio
- src/commands/set.json: 93.8% subset ratio
- src/t_string.c: 95.5% subset ratio
- tests/unit/type/string.tcl: 100% subset ratio

Result:
- PR valkey-io#3105 now correctly detects Redis #14435 match
- PR valkey-io#3088 still works (detects #14243)
- PR valkey-io#1 still passes (no false positives)

Signed-off-by: Ping Xie <[email protected]>
@zuiderkwast
Copy link
Contributor

Hi Arshid.

We are aware of this PR. There are many PRs waiting for review.

Do you have a real use case for this feature? We discussed compare-and-set a long time ago in #1215 and we decided to add only IFEQ, which we said is probably enough for 99% of the cases. Later we added it also for delete (DELIFEQ) because there was a real use case for it.

Do you have a real use case for IFNE? I mean problem that can't be solved using IFEQ.

Just because Redis has it doesn't automatically mean that we want it. We want it only if it solves a real problem.

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