Skip to content

[kv] Implement KvTablet RocksDB Lazy Open#2914

Open
platinumhamburg wants to merge 1 commit intoapache:mainfrom
platinumhamburg:feature/lazy-open
Open

[kv] Implement KvTablet RocksDB Lazy Open#2914
platinumhamburg wants to merge 1 commit intoapache:mainfrom
platinumhamburg:feature/lazy-open

Conversation

@platinumhamburg
Copy link
Contributor

Defer RocksDB open to first access and auto-release idle tablets to reduce memory usage on tablet servers with many KV buckets.

Key design:

  • Sentinel pattern: lightweight KvTablet shell with RocksDBState hot-swapped via single volatile write
  • 6-state lifecycle (LAZY/OPENING/OPEN/RELEASING/FAILED/CLOSED) with generation+epoch fencing
  • Guard/Pin mechanism: lock-free fast path for OPEN state, blocking slow path triggers on-demand open
  • Idle release: periodic scan releases tablets idle beyond timeout, preserving local SST files for fast reopen
  • Cold-to-hot reopen loads local RocksDB + replays incremental logs, falls back to full snapshot download on failure

Configs: kv.lazy-open.enabled (default false), kv.lazy-open.idle-timeout (default 24h).
Metrics: kvTabletOpenCount, kvTabletLazyCount, kvTabletFailedCount (Gauge).

Purpose

Linked issue: close #2913 2913

Brief change log

Tests

API and Format

Documentation

Defer RocksDB open to first access and auto-release idle tablets to
reduce memory usage on tablet servers with many KV buckets.

Key design:
- Sentinel pattern: lightweight KvTablet shell with RocksDBState
  hot-swapped via single volatile write
- 6-state lifecycle (LAZY/OPENING/OPEN/RELEASING/FAILED/CLOSED)
  with generation+epoch fencing
- Guard/Pin mechanism: lock-free fast path for OPEN state,
  blocking slow path triggers on-demand open
- Idle release: periodic scan releases tablets idle beyond timeout,
  preserving local SST files for fast reopen
- Cold-to-hot reopen loads local RocksDB + replays incremental logs,
  falls back to full snapshot download on failure

Configs: kv.lazy-open.enabled (default false), kv.lazy-open.idle-timeout (default 24h).
Metrics: kvTabletOpenCount, kvTabletLazyCount, kvTabletFailedCount (Gauge).
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.

[kv] Implement KvTablet RocksDB Lazy Open

1 participant