dragonflydb / dragonflydb/dragonfly
P1 — Active expiry never runs for non-default namespaces
- Dominant language
- C++
- Stars
- 31.5k
- Forks
- 1.3k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 137
Description
Heartbeat expiry and eviction scan only the default namespace
(`engine_shard.cc:784-785`, `862-864`), and the post-expiry wake dispatch uses only the
default namespace's `BlockingController` (`engine_shard.cc:959-964`). Keys in ACL
namespaces are never actively expired at all — no deletion, no keyspace notification, no
wake. Only a later tenant command that touches the key expires it lazily.
Scenario:
```text
ACL SETUSER u NAMESPACE:tenant ON >p +@all ~*
# tenant connection 1
XGROUP CREATE s g 0 MKSTREAM
XREADGROUP GROUP g c BLOCK 0 STREAMS s >
# tenant connection 2
PEXPIRE s 100
```
Actual: the blocked tenant client is never woken; with `BLOCK 0` it stays blocked
indefinitely. A later tenant command touching `s` (even `EXISTS s`) lazily expires the key
and only then the reader receives `NOGROUP`. The identical scenario in the default
namespace correctly delivers `NOGROUP` shortly after the TTL elapses.
Contributor guide
Research direction
Start in engine_shard.cc at lines 784-785, 862-864, and 959-964, then reproduce the tenant-namespace scenario with a blocked XREADGROUP and PEXPIRE. Trace the expiry scan and wake dispatch for non-default namespaces. Done means expired tenant keys are deleted, keyspace notifications and blocked-client wakeups occur, and the reader receives NOGROUP without a later tenant command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100