Skip to content

[kv] Implement KvTablet RocksDB Lazy Open - #2914

Open
platinumhamburg wants to merge 5 commits into
apache:mainfrom
platinumhamburg:feature/lazy-open
Open

platinumhamburg wants to merge 5 commits into
apache:mainfrom
platinumhamburg:feature/lazy-open

Conversation

@platinumhamburg

Copy link
Copy Markdown
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

@platinumhamburg
platinumhamburg force-pushed the feature/lazy-open branch 20 times, most recently from 92b7e0e to 427232b Compare March 30, 2026 08:48
Keep maintenance guards from refreshing idle access timestamps. Fence closing tablets and wait for open, release, callbacks and candidate cleanup before completing close or drop. Retain bucket ownership until cleanup completes and propagate shutdown failures before releasing shared native resources.

Cover periodic snapshots, fenced opens, slow releases, shutdown and repeated drops with regression tests. Verified 202 related server tests and the Java 8 reactor build.
Merge OSS jar and test-jar goals into one plugin declaration while preserving the multi-release manifest. Remove the duplicate ordinary Flink connector-base dependency and retain its provided and test-jar dependencies.

Validated clean install with JDK 8 and the java8 profile across all 48 reactor modules.
Wait for each replica and its metadata after creating the primary-key table, before the bounded enumerator requests stopping offsets. Table creation can finish before tablet servers are ready to serve ListOffsets.

Validated FlinkSourceEnumeratorTest with Maven verify: all 30 cases passed in both test executions.
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