Skip to content

Backport more hfe fixes#3132

Merged
zuiderkwast merged 2 commits into
9.0from
backport-more-hfe-fixes
Jan 30, 2026
Merged

Backport more hfe fixes#3132
zuiderkwast merged 2 commits into
9.0from
backport-more-hfe-fixes

Conversation

@ranshid

@ranshid ranshid commented Jan 29, 2026

Copy link
Copy Markdown
Member

cjx-zar and others added 2 commits January 29, 2026 22:26
The HFE uses EXPIRY_NONE(-1) for fields without a TTL. A bug exists in
`HSETEX` and RDB loading where `expiry > 0` is used to check for an
expiration. This is problematic because `0` might be treated as no
expiry in `import-mode`, instead of an already expired timestamp,
leading to incorrect behavior.

---------

Signed-off-by: cjx-zar <jxchenczar@foxmail.com>
Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
In the original implementation of Hash Field Expiration
(#2089), the HSETEX command was
implemented to report keyspace notifications only for performed changes.
This is mostly aligned with other Hash commands (for example, HDEL will
also not report `hdel` event for items which does not exist)
The HSETEX case is somewhat different and is more like the `HSET` case.
During HSETEX, after the command validations pass, items are ALWAYS
"added" to the object, even though they might not actually be added.
This case is the same for when the hash object is empty or when all the
provided fields do not exist in the object (as reported
[here](#2998))

This PR changes the way `HSETEX` will report keyspace notifications so
that:
1. `hset` notification will ALWAYS be reported if all command
validations pass.
2. `hexpire` will be reported in case the command include an expiration
time (even past time)
3. `hxpired` will be reported in case the provided expiration time is in
the past (or 0)
4. `hdel` will be reported in case the hash exists (or created as part
of the command) and following the command execution it was left empty.
5. we will always return '1' as a return value of tHSETEX command which
passed all validations. Before that we returned 1 only if we applied the
change cross ALL the input fields, so in case some of them did not exist
and a past time was set we would return 0.

---------

Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Co-authored-by: Jacob Murphy <jkmurphy@google.com>
Signed-off-by: Ran Shidlansik <ranshid@amazon.com>

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

Unblocking

@codecov

codecov Bot commented Jan 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.67%. Comparing base (27e76e3) to head (e89d731).
⚠️ Report is 2 commits behind head on 9.0.

Additional details and impacted files
@@            Coverage Diff             @@
##              9.0    #3132      +/-   ##
==========================================
+ Coverage   72.61%   72.67%   +0.05%     
==========================================
  Files         128      128              
  Lines       69970    69972       +2     
==========================================
+ Hits        50812    50851      +39     
+ Misses      19158    19121      -37     
Files with missing lines Coverage Δ
src/rdb.c 77.25% <100.00%> (+0.53%) ⬆️
src/t_hash.c 96.64% <100.00%> (+0.08%) ⬆️

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

@zuiderkwast zuiderkwast merged commit d26a103 into 9.0 Jan 30, 2026
129 of 138 checks passed
@zuiderkwast zuiderkwast deleted the backport-more-hfe-fixes branch February 3, 2026 13:07
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