You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "luoyuxia (via GitHub)" <gi...@apache.org> on 2026/09/26 02:42:54 UTC

Re: [PR] [tiering] fail tiering job when readers exceed max duration [fluss]

luoyuxia commented on code in PR #3810:
URL: https://github.com/apache/fluss/pull/3810#discussion_r4109909032


##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/enumerator/TieringSourceEnumerator.java:
##########
@@ -355,9 +357,45 @@ protected void handleTableTieringReachMaxDuration(
                 LOG.info("Send {} to reader {}", tieringReachMaxDurationEvent, reader);
                 context.sendEventToSourceReader(reader, tieringReachMaxDurationEvent);
             }
+
+            Duration forceCompleteFinishTimeout =
+                    flussConf.get(TIERING_FORCE_COMPLETE_FINISH_TIMEOUT);
+            if (!forceCompleteFinishTimeout.isZero() && !forceCompleteFinishTimeout.isNegative()) {
+                long completionTimeoutThreshold = forceCompleteFinishTimeout.toMillis();
+                timerService.schedule(
+                        () ->
+                                context.runInCoordinatorThread(
+                                        () ->
+                                                failTieringJobIfNotFinished(
+                                                        tablePath,
+                                                        tableId,
+                                                        tieringEpoch,
+                                                        completionTimeoutThreshold)),
+                        completionTimeoutThreshold,
+                        TimeUnit.MILLISECONDS);
+            }
+        }
+    }
+
+    @VisibleForTesting
+    void failTieringJobIfNotFinished(
+            TablePath tablePath, long tableId, long tieringEpoch, long completionTimeoutThreshold) {
+        Long currentEpoch = tieringTableEpochs.get(tableId);
+        if (currentEpoch != null && currentEpoch.equals(tieringEpoch)) {

Review Comment:
   Could we account for an in-progress snapshot before treating an active epoch as a stuck reader? `TieringSplitReader.fetch()` deliberately lets the current snapshot finish after receiving the max-duration event, and only emits its write result after the whole snapshot has been read. `FinishedTieringEvent` is sent by the committer after all bucket results have been committed.
   
   For example, a single-bucket PK table whose initial snapshot takes 12 minutes to scan will now be restarted after about 8 minutes with the defaults (3-minute freshness + 5-minute completion timeout), even if it is continuously making progress. The source does not checkpoint scan progress, and this bucket has no committed lake offset yet, so the next attempt starts the snapshot again. This can leave initial tiering in a restart loop; previously the snapshot was allowed to finish.
   
   Please distinguish snapshot progress/phase before enabling this deadline by default, or keep the watchdog opt-in for now. A regression test with a snapshot that keeps making progress beyond `freshness + timeout` would help ensure it can still complete.



##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/TieringSourceOptions.java:
##########
@@ -34,4 +34,14 @@ public class TieringSourceOptions {
                     .defaultValue(Duration.ofSeconds(30))
                     .withDescription(
                             "The fixed interval to request tiering table from Fluss cluster, by default 30 seconds.");
+
+    public static final ConfigOption<Duration> TIERING_FORCE_COMPLETE_FINISH_TIMEOUT =
+            key("tiering.force-complete.finish.timeout")

Review Comment:
   Could we define this in the tiering service section of `org.apache.fluss.config.ConfigOptions`, alongside `LAKE_TIERING_AUTO_EXPIRE_SNAPSHOT` and `LAKE_TIERING_IO_TMP_DIRS`, and use the key `lake.tiering.force-complete.finish.timeout`? This controls the tiering job's recovery behavior, so grouping it with the existing user-facing tiering service options would make configuration more consistent.
   
   With that prefix, the option should be read from `lakeTieringConfig` and passed through to the enumerator, since `FlussLakeTiering` routes `lake.tiering.*` arguments into that configuration rather than `flussConfig`. Could we also keep the intended default in the option definition instead of declaring zero here and overriding it to five minutes in `FlussLakeTiering.run()`? That would keep the entrypoint and programmatic builder defaults consistent.



-- 
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