yunfengzhou-hub commented on code in PR #22931:
URL: https://github.com/apache/flink/pull/22931#discussion_r1267857378


##########
flink-runtime/src/main/java/org/apache/flink/runtime/operators/coordination/OperatorCoordinatorHolder.java:
##########
@@ -164,6 +167,15 @@ public void lazyInitialize(
         context.lazyInitialize(
                 globalFailureHandler, mainThreadExecutor, 
operatorCoordinatorMetricGroup);
 
+        OperatorCoordinator rootCoordinator = coordinator;
+        if (coordinator instanceof RecreateOnResetOperatorCoordinator) {
+            rootCoordinator =
+                    ((RecreateOnResetOperatorCoordinator) 
rootCoordinator).getInternalCoordinator();
+        }
+        if (rootCoordinator instanceof SourceCoordinator) {
+            ((SourceCoordinator<?, ?>) 
rootCoordinator).lazyInitialize(checkpointCoordinator);

Review Comment:
   Below is part of the invocation stack of SourceCoordinatorContext's 
constructor.
   ```
   <init>:142, SourceCoordinatorContext 
(org.apache.flink.runtime.source.coordinator)
   <init>:119, SourceCoordinatorContext 
(org.apache.flink.runtime.source.coordinator)
   getCoordinator:89, SourceCoordinatorProvider 
(org.apache.flink.runtime.source.coordinator)
   createNewInternalCoordinator:337, 
RecreateOnResetOperatorCoordinator$DeferrableCoordinator 
(org.apache.flink.runtime.operators.coordination)
   <init>:60, RecreateOnResetOperatorCoordinator 
(org.apache.flink.runtime.operators.coordination)
   <init>:43, RecreateOnResetOperatorCoordinator 
(org.apache.flink.runtime.operators.coordination)
   create:200, RecreateOnResetOperatorCoordinator$Provider 
(org.apache.flink.runtime.operators.coordination)
   create:194, RecreateOnResetOperatorCoordinator$Provider 
(org.apache.flink.runtime.operators.coordination)
   create:546, OperatorCoordinatorHolder 
(org.apache.flink.runtime.operators.coordination)
   create:509, OperatorCoordinatorHolder 
(org.apache.flink.runtime.operators.coordination)
   createOperatorCoordinatorHolder:286, ExecutionJobVertex 
(org.apache.flink.runtime.executiongraph)
   initialize:223, ExecutionJobVertex (org.apache.flink.runtime.executiongraph)
   initializeJobVertex:888, DefaultExecutionGraph 
(org.apache.flink.runtime.executiongraph)
   initializeJobVertex:218, ExecutionGraph 
(org.apache.flink.runtime.executiongraph)
   initializeJobVertices:870, DefaultExecutionGraph 
(org.apache.flink.runtime.executiongraph)
   attachJobGraph:826, DefaultExecutionGraph 
(org.apache.flink.runtime.executiongraph)
   buildGraph:219, DefaultExecutionGraphBuilder 
(org.apache.flink.runtime.executiongraph)
   createAndRestoreExecutionGraph:163, DefaultExecutionGraphFactory 
(org.apache.flink.runtime.scheduler)
   createAndRestoreExecutionGraph:368, SchedulerBase 
(org.apache.flink.runtime.scheduler)
   <init>:210, SchedulerBase (org.apache.flink.runtime.scheduler)
   <init>:140, DefaultScheduler (org.apache.flink.runtime.scheduler)
   ```
   
   In order to pass `checkpointCoordinator` through this stack to 
SourceCoordinatorContext's constructor, we may need to add a 
`getCheckpointCoordinator` method to `OperatorCoordinator.Context` class. This 
is a public API change that has not been agreed in the FLIP discussion, and I 
also personally think this API will yield too much freedom to 
OperatorCoordinator's developers so should not be introduced. Thus I did not 
choose this path.



-- 
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-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to