dragonflydb / dragonflydb/dragonfly
HEXPIRE - key is not removed until HGET / HGETALL is called
- Dominant language
- C++
- Stars
- 31.5k
- Forks
- 1.3k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 137
Description
**Describe the bug**
If you set HEXPIRE on key, then it is not removed automatically until HGET / HGETALL is called
**To Reproduce**
Steps to reproduce the behavior:
```
redis-cli
HSET testSet test testValue
HEXPIRE testSet 5 FIELDS 1 test
(integer) 1
HLEN testSet
(integer) 1
HLEN testSet
(integer) 1
HLEN testSet
(integer) 1
... will show 1 infinitely until HGET / HGETALL will called
HGETALL testSet
(empty array)
HLEN testSet
(integer) 0
```
**Expected behavior**
Should automatically remove key when timeout is triggered, after that HLEN should return 0
**Screenshots**
No need, easy to reproduce
**Environment (please complete the following information):**
- OS: Ubuntu 24.04.1 LTS
- Kernel: 6.8.0-48-generic
- Containerized: Bare Metal
- Dragonfly Version: v1.24.0
**Reproducible Code Snippet**
```
# See above
```
**Additional context**
On native Redis server (redis_version:7.4.1) there is no such problem:
```
127.0.0.1:6379> HSET testSet test testValue
(integer) 1
127.0.0.1:6379> HEXPIRE testSet 5 FIELDS 1 test
1) (integer) 1
127.0.0.1:6379> HLEN testSet
(integer) 1
127.0.0.1:6379> HLEN testSet
(integer) 1
127.0.0.1:6379> HLEN testSet
(integer) 1
127.0.0.1:6379> HLEN testSet
(integer) 0
127.0.0.1:6379> HLEN testSet
(integer) 0
```
Contributor guide
Research direction
Start by reproducing the behavior with the HSET, HEXPIRE, HLEN, and HGETALL commands shown in the issue, then compare the result with native Redis 7.4.1. Trace the implementation and tests for HEXPIRE, HLEN, and hash-field expiration; done means HLEN returns 0 after the field timeout without requiring HGET or HGETALL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, redis
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100