pnowojski commented on code in PR #22670:
URL: https://github.com/apache/flink/pull/22670#discussion_r1209080632


##########
flink-runtime/src/main/java/org/apache/flink/runtime/sink/coordinator/SinkCoordinator.java:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.sink.coordinator;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.annotation.VisibleForTesting;
+import org.apache.flink.runtime.jobgraph.OperatorID;
+import org.apache.flink.runtime.operators.coordination.CoordinatorStore;
+import org.apache.flink.runtime.operators.coordination.OperatorCoordinator;
+import org.apache.flink.runtime.operators.coordination.OperatorEvent;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nullable;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * The default implementation of the {@link OperatorCoordinator} for the {@link
+ * org.apache.flink.api.connector.sink2.Sink}.
+ *
+ * <p>The <code>SinkCoordinator</code> helps trigger an immediate global 
checkpoint when all sink
+ * operators are reaching end of data.
+ */
+@Internal
+public class SinkCoordinator implements OperatorCoordinator {

Review Comment:
   I have a couple of remarks about this construct:
   - What if some parts of a job don't have any sink? 
   - What will happen if Sink has it's own `Coordinator`? Can we have two 
coordinators at the same time?
   - I think this is pretty invasive design. We need to send extra events from 
the operators to JM, we need to expose triggering checkpoints to the 
coordinators, we have to wire everything. This touches, modifies and connects a 
lot of components. Why can not all of this happen purely in the JM, maybe just 
inside `CheckpointCoordinator`? We could add another 
`ExecutionState.WAITING_FOR_FINAL_CHECKPOINT` or maybe simply `FINISHING`, 
similarly how we added `ExecutionState.INITIALIZING` not that long time ago and 
just listen in the JM (or `CheckpointCoordinator`) until all subtasks have 
reached this new state?



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