You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/08/28 07:56:34 UTC

[GitHub] [beam] mxm commented on a change in pull request #12706: [BEAM-6868, BEAM-10670] Add support for bundle finalization to DoFnOperator for non-portable streaming pipelines.

mxm commented on a change in pull request #12706:
URL: https://github.com/apache/beam/pull/12706#discussion_r478904282



##########
File path: runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/DoFnOperator.java
##########
@@ -191,6 +194,17 @@
 
   private final boolean finishBundleBeforeCheckpointing;
 
+  /** Stores new finalizations being gathered. */
+  private transient InMemoryBundleFinalizer bundleFinalizer;
+  /** Pending bundle finalizations which have not been acknowledged yet. */
+  private transient LinkedHashMap<Long, List<InMemoryBundleFinalizer.Finalization>>
+      pendingFinalizations;
+  /**
+   * Keep a maximum of 32 bundle finalizations for {@link
+   * BundleFinalizer.Callback#onBundleSuccess()}.
+   */
+  private static final int MAX_NUMBER_PENDING_BUNDLE_FINALIZATIONS = 32;

Review comment:
       This constant appears to be unused.

##########
File path: runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/DoFnOperator.java
##########
@@ -905,6 +928,19 @@ public final void notifyCheckpointComplete(long checkpointId) throws Exception {
       bufferingDoFnRunner.checkpointCompleted(checkpointId);
     }
 
+    List<InMemoryBundleFinalizer.Finalization> finalizations =
+        pendingFinalizations.get(checkpointId);
+    if (finalizations != null) {
+      // remove old finalizations except for the current one
+      pendingFinalizations.clear();
+      pendingFinalizations.put(checkpointId, finalizations);
+
+      // confirm all finalizations
+      for (InMemoryBundleFinalizer.Finalization finalization : finalizations) {
+        finalization.getCallback().onBundleSuccess();

Review comment:
       Acknowledging the latest bundle finalize will also acknowledge all earlier requests for bundle finalization?

##########
File path: runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/DoFnOperator.java
##########
@@ -905,6 +928,19 @@ public final void notifyCheckpointComplete(long checkpointId) throws Exception {
       bufferingDoFnRunner.checkpointCompleted(checkpointId);
     }
 
+    List<InMemoryBundleFinalizer.Finalization> finalizations =
+        pendingFinalizations.get(checkpointId);
+    if (finalizations != null) {
+      // remove old finalizations except for the current one
+      pendingFinalizations.clear();

Review comment:
       The default is to have just one checkpoint at a given time, but users can configure concurrent checkpointing which can ack checkpoints out of order.

##########
File path: runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/DoFnOperator.java
##########
@@ -905,6 +928,19 @@ public final void notifyCheckpointComplete(long checkpointId) throws Exception {
       bufferingDoFnRunner.checkpointCompleted(checkpointId);
     }
 
+    List<InMemoryBundleFinalizer.Finalization> finalizations =
+        pendingFinalizations.get(checkpointId);
+    if (finalizations != null) {
+      // remove old finalizations except for the current one
+      pendingFinalizations.clear();
+      pendingFinalizations.put(checkpointId, finalizations);

Review comment:
       Why is this one pending when we acknowledge it below?




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

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