You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "beryllw (via GitHub)" <gi...@apache.org> on 2026/10/21 13:10:29 UTC
[PR] [flink] Expose the tiering reader waiting ratio [fluss]
beryllw opened a new pull request, #4786:
URL: https://github.com/apache/fluss/pull/4786
<!--
*Thank you very much for contributing to Fluss - we are happy that you want to help us improve Fluss. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
## Contribution Checklist
- Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/fluss/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no issue.
- Name the pull request in the format "[component] Title of the pull request", where *[component]* should be replaced by the name of the component being changed. Typically, this corresponds to the component label assigned to the issue (e.g., [kv], [log], [client], [flink], [rust], [python], [c++], [elixir]). Skip *[component]* if you are unsure about which is the best component.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes.
- Each pull request should address only one issue, not mix up code from multiple issues.
- **Generative AI disclosure:** Indicate whether generative AI tools were used in authoring this PR. If yes, specify the tool below.
- [ ] No generative AI tools used
- [ ] Yes (please specify the tool below)
**(The sections below can be removed for hotfixes or typos)**
-->
<!--
Generated-by: [Tool Name and Version] following [the guidelines](https://github.com/apache/fluss/blob/main/AGENTS.md)
-->
### Purpose
Closes #4782.
Expose the proportion of tiering readers waiting for splits to help identify spare reader capacity.
### Brief change log
Add `waitingReadersRatio` under `fluss.tieringService`, calculated from the existing waiting-reader set and source parallelism.
### Tests
Extend existing scheduling tests to cover assignment, waiting, generation failure, and reader re-registration. All 18 targeted enumerator and metrics tests passed.
### API and Format
No Java API or storage format changes.
### Documentation
Document the metric and its startup, failover, and rescaling semantics.
Generated-by: OpenAI Codex
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [tiering] Expose the tiering reader waiting ratio [fluss]
Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia merged PR #4786:
URL: https://github.com/apache/fluss/pull/4786
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [tiering] Expose the tiering reader waiting ratio [fluss]
Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #4786:
URL: https://github.com/apache/fluss/pull/4786#discussion_r4365692233
##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/enumerator/TieringSourceEnumerator.java:
##########
@@ -189,6 +190,9 @@ public TieringSourceEnumerator(
this.finishedTables = new ConcurrentHashMap<>();
this.failedTableEpochs = new ConcurrentHashMap<>();
this.tieringReachMaxDurationsTables = Collections.synchronizedSet(new TreeSet<>());
+ TieringMetrics.registerWaitingReadersRatio(
+ enumeratorMetricGroup,
+ () -> (double) readersAwaitingSplit.size() / context.currentParallelism());
Review Comment:
Could we also clean up this gauge when the enumerator closes?
On Flink 1.20.3, a global checkpoint restore within the same JobMaster [recreates the coordinator using the same outer context](https://github.com/apache/flink/blob/release-1.20.3/flink-runtime/src/main/java/org/apache/flink/runtime/operators/coordination/RecreateOnResetOperatorCoordinator.java#L126-L158). The metric parent survives: `addGroup()` reuses existing subgroups, and [`addMetric()` retains the old metric on a name collision](https://github.com/apache/flink/blob/release-1.20.3/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java#L420-L449). Neither the current enumerator's `close()` nor `SourceCoordinatorContext.close()` removes this gauge, so registration in the new enumerator is rejected and reporting continues to read the old enumerator's `readersAwaitingSplit`.
For example, if both readers were waiting before recovery, the old gauge reports `2 / 2 = 1.0`. After the new enumerator assigns splits to both readers, the expected value is `0 / 2 = 0.0`, but the reported value remains `1.0`. This would make the proposed autoscaling signal stale after recovery.
Could we retain and close the owned `tieringService` metric subgroup in `finally`, and add a regression test that closes and recreates the enumerator using the same parent metric group? The existing failover test only re-registers readers on the same enumerator, so it does not cover this lifecycle.
##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/enumerator/TieringSourceEnumerator.java:
##########
@@ -189,6 +190,9 @@ public TieringSourceEnumerator(
this.finishedTables = new ConcurrentHashMap<>();
this.failedTableEpochs = new ConcurrentHashMap<>();
this.tieringReachMaxDurationsTables = Collections.synchronizedSet(new TreeSet<>());
+ TieringMetrics.registerWaitingReadersRatio(
+ enumeratorMetricGroup,
+ () -> (double) readersAwaitingSplit.size() / context.currentParallelism());
Review Comment:
Nit: could we name the metric `readersAwaitingSplitRatio` and the helper `registerReadersAwaitingSplitRatio`? This would match the existing `readersAwaitingSplit` field and make it clear that the readers are waiting for split assignment; `waitingReadersRatio` leaves the kind of waiting unspecified.
The calculation itself matches that definition: the number of readers tracked as awaiting a split divided by the current source parallelism.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [tiering] Expose the tiering reader waiting ratio [fluss]
Posted by "beryllw (via GitHub)" <gi...@apache.org>.
beryllw commented on PR #4786:
URL: https://github.com/apache/fluss/pull/4786#issuecomment-6320151509
> Quick question: are we planning to use this metric to drive autoscaling for the Flink tiering job?
Yes, plan to use it alongside tiering latency as an additional autoscaling signal. When latency is high but readers are consistently waiting for splits, adding parallelism may not help. This metric would help the autoscaler avoid unnecessary scale-ups in those cases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org