[server] batch fetch latest bucket snapshots to reduce latency - #3811
Merged
Conversation
Member
Author
|
@luoyuxia @loserwang1024 could you help review this? |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes Fluss server ZooKeeper snapshot lookup during tiering split generation by batching “latest bucket snapshot” reads into two pipelined phases (list children → fetch latest snapshot data), reducing end-to-end latency while keeping the existing result semantics.
Changes:
- Refactored bucket snapshot loading to batch
getChildrenfor all buckets, compute latest snapshot IDs in-memory, then batchgetDatafor only the latest snapshot nodes. - Made
getDataInBackground(...)visible for testing to enable race-condition simulation. - Added/extended ZooKeeperClient tests covering batch snapshot behavior, inflight-limit scenarios, and deletion races between the two batch phases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| fluss-server/src/main/java/org/apache/fluss/server/zk/ZooKeeperClient.java | Batch/pipeline latest-bucket-snapshot reads using existing background request utilities. |
| fluss-server/src/test/java/org/apache/fluss/server/zk/ZooKeeperClientTest.java | Adds tests for batched snapshot fetching, inflight throttling, and deletion race handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
luoyuxia
approved these changes
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
For primary-key tables, tiering split generation fetches the latest KV snapshot for every bucket in each active partition. The previous implementation performed two sequential ZooKeeper reads per bucket: listing all snapshot IDs and then reading the latest snapshot data.
With 13 partitions and 800 buckets, this resulted in up to 20,800 sequential ZooKeeper reads, causing split generation to take around 450–490 seconds. This delay also extended the actual duration of each tiering round.
Brief change log
Change snapshot loading to two pipelined phases:
The implementation reuses the existing background read utilities and respects the configured maximum inflight requests. Missing or concurrently deleted snapshot nodes are handled gracefully, while the existing result semantics and upper-layer interfaces remain unchanged.
Tests
API and Format
Documentation