Skip to content

fix(hashes): cap field deadlines and round HTTL up - #184

Merged
MohitGoyal09 merged 7 commits into
mainfrom
fix/175-hash-deadline
Nov 18, 2026
Merged

MohitGoyal09 merged 7 commits into
mainfrom
fix/175-hash-deadline

Conversation

@MohitGoyal09

@MohitGoyal09 MohitGoyal09 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #175

Redis reference: https://redis.io/docs/latest/commands/hexpire/

Hash field TTLs accepted deadlines far beyond Redis's range, and HTTL floored the remaining time where Redis rounds up.

  • Field deadlines are capped at 2^46 - 1 unix milliseconds, matching Redis; larger values reply invalid expire time in '<cmd>' command for HEXPIRE/HPEXPIRE/HEXPIREAT/HPEXPIREAT/HSETEX/HGETEX.
  • HTTL now returns ceiling seconds of the remaining time.
  • Regression test covers the six overflow texts and HTTL values for 100/999/1499/2500/9999 ms; it fails on main.
  • A differential run against Redis 8.8.0 matches byte-for-byte, including the boundary values.

Verification

cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test

All 40 test binaries pass.

Reject deadlines above Redis's 46-bit millisecond range with the per-command
expire text, and compute HTTL with ceiling seconds.
Clamp out-of-range HPEXPIREAT/HEXPIREAT values during AOF replay so older logs
still load, compute HTTL from the nanosecond remainder, and pin the boundary
and millisecond cases.
@MohitGoyal09
MohitGoyal09 merged commit 21c010e into main Nov 18, 2026
6 checks passed
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.

HGETEX/HEXPIRE huge field deadlines and TTL rounding differ from Redis

1 participant