Repository navigation
[server] Add TableLifecycleThrottler to throttle drops in coordinator queue - #3174
Conversation
8369aee to
af71f36
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #3173 by ensuring auto-partition retention cleanup is evaluated against the actual current time (not the DAY creation jitter), and adds throttling/backpressure to prevent large bursts of partition-drop work from flooding the coordinator event queue during rotation boundaries.
Changes:
- Fix retention cleanup timing by using the real “now” instant for partition drops (decoupled from DAY creation jitter).
- Add adaptive drop throttling: a queue-size backpressure gate plus a per-round shared drop budget (with a starvation guard).
- Expose coordinator event queue size for backpressure, add tests for the new behavior, and document the new configuration options.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/table-design/data-distribution/partitioning.md | Documents cluster-level auto-partition drop throttling/backpressure behavior and new config knobs. |
| website/docs/maintenance/configuration.md | Adds the new auto-partition drop throttling/backpressure configuration options to the config reference. |
| fluss-server/src/test/java/org/apache/fluss/server/coordinator/AutoPartitionManagerTest.java | Adds tests covering “drop not delayed by jitter” and multiple throttle/budget scenarios. |
| fluss-server/src/main/java/org/apache/fluss/server/coordinator/event/CoordinatorEventManager.java | Adds a queue size accessor used for queue-aware backpressure. |
| fluss-server/src/main/java/org/apache/fluss/server/coordinator/CoordinatorServer.java | Wires AutoPartitionManager with a late-bound coordinator queue size probe. |
| fluss-server/src/main/java/org/apache/fluss/server/coordinator/AutoPartitionManager.java | Implements queue-aware backpressure gate, per-round drop budget, and uses real-time “now” for drops. |
| fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java | Introduces new config options controlling drop backpressure threshold and per-round drop budget. |
Comments suppressed due to low confidence (1)
fluss-server/src/main/java/org/apache/fluss/server/coordinator/AutoPartitionManager.java:606
- In the PartitionNotExistException path, the code logs that the partition doesn't exist but then still proceeds as if it was deleted (iterator removal, incrementing dropped/bucketsConsumed, and logging "deleted"). This can incorrectly consume the per-round bucket budget and may stop further legitimate drops in the same round. Consider treating PartitionNotExistException as a no-op: remove it from the in-memory set/map but do not increment bucketsConsumed/dropped and do not log it as deleted.
try {
metadataManager.dropPartition(
tablePath,
ResolvedPartitionSpec.fromPartitionName(partitionKeys, partitionName),
false);
} catch (PartitionNotExistException e) {
LOG.info(
"Auto partitioning skip to delete partition {} for table [{}] as the partition is not exist.",
partitionName,
tablePath);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
platinumhamburg
left a comment
There was a problem hiding this comment.
It seems that the designed mechanism is somewhat complex and has quite a few configuration variables. Could we simplify the implementation so that doAutoPartition() maintains a PendingDeletePartition set, and an asynchronous deletion thread polls this set, following these rules:
Only delete one partition at a time;
Skip whenever CoordinatorEventQueue is not empty;
The thread can poll the event queue every few seconds to look for a deletion opportunity.
af71f36 to
abc8a62
Compare
abc8a62 to
52b7716
Compare
Hi @platinumhamburg. The previous design was a bit complex and not general enough (e.g. it didn't really cover user-submitted batch drops of tables or partitions), so the new PR abstracts a common class as a throttling queue for replica drop events. Mind taking another look when you have a moment? Thanks a lot! |
platinumhamburg
left a comment
There was a problem hiding this comment.
LGTM. The tableBucketCount cache might have a leak, but it is bounded, and its memory usage is not high, so it's acceptable.
52b7716 to
36295be
Compare
luoyuxia
left a comment
There was a problem hiding this comment.
@swuferhong Thanks for the pr.
I feel this design is a bit complex and easy to get wrong. It introduces three new configs, and the semantics of these configs are not very intuitive for users/operators.
Most of the complexity seems to come from the bucket-based budget (coordinator.replica-cleanup.max-buckets-per-batch): we need to resolve bucket counts, track in-flight buckets, release budget on completion, handle timeout/abandonment, and make the resume path go through the same accounting.
Do we really need bucket-level throttling here? The main issue we want to solve is that a large cascading drop can enqueue too many DropTable/DropPartition events into the coordinator event processor. A simpler approach could be to limit the number of drop events admitted into the coordinator event processor per batch/drain. That would still address most event-queue flooding cases, while avoiding bucket-count lookup, bucket-budget accounting, timeout configs, and a lot of the lifecycle complexity.
ea7d8f5 to
352b0b6
Compare
|
Hi @luoyuxia, comments addressed. I still exposed the timeout ms parameter as config option, because ITCases share a single coordinator, and some drop events do return slowly during tests, so the timeout interval needs to be reduced for testing purposes. |
wuchong
left a comment
There was a problem hiding this comment.
Hi @swuferhong , I left some comments.
d720536 to
9a787d4
Compare
9a787d4 to
005220d
Compare
|
@wuchong comments addressed. |
005220d to
13640bd
Compare
wuchong
left a comment
There was a problem hiding this comment.
I appended a commit to improve the code a bit, please take another look.
|
LGTM +1 |
Purpose
Linked issue: close #3173
Cascading
dropTable/dropPartitionused to pushDropPartitionEventandDropTableEventinto the coordinator event queue directly fromTableChangeWatcher(and via TableManager#resumeDeletions on startup).A single drop spanning thousands of partitions / stale tables would flood the queue with drop events and starve unrelated coordinator work.
So this pr introduce
ReplicaCleanupManageruses a FIFO queue with a per-batch bucket budget (coordinator.replica-cleanup.max-buckets-per-batch, default 10000). Drops are admitted as long as the running sumof in-flight buckets stays within budget. A starvation guard ensures that when nothing is in-flight, even an over-budget drop is admitted alone. Completion callbacks from TableManager release the budget and trigger the next batch.
Two submission paths:
onDeletePartition/onDeleteTable directly (bypasses event queue since TableInfo may already be gone)
Brief change log
Tests
API and Format
Documentation