Guosmilesmile commented on code in PR #16011:
URL: https://github.com/apache/iceberg/pull/16011#discussion_r3115195903


##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicWriteResultAggregator.java:
##########
@@ -84,15 +94,27 @@ class DynamicWriteResultAggregator
 
   @Override
   public void initializeState(StateInitializationContext context) throws 
Exception {
+    super.initializeState(context);
     context
         .getRestoredCheckpointId()
         .ifPresent(checkpointId -> this.lastCheckpointId = checkpointId);
+    this.jobIdState = 
context.getOperatorStateStore().getUnionListState(JOB_ID_DESCRIPTOR);
+    Iterator<String> restoredJobIds = jobIdState.get().iterator();
+    if (restoredJobIds.hasNext()) {
+      this.flinkJobId = restoredJobIds.next();
+      LOG.info(
+          "Restored aggregator flink job id {} from operator state. Subsequent 
committables will"
+              + " be stamped with this id to keep DynamicCommitter dedup 
stable across restarts.",
+          flinkJobId);
+    }
   }
 
   @Override
   public void open() throws Exception {
-    this.flinkJobId = 
getContainingTask().getEnvironment().getJobID().toString();
-    this.operatorId = getOperatorID().toString();
+    if (this.flinkJobId == null) {
+      this.flinkJobId = 
getContainingTask().getEnvironment().getJobID().toString();
+    }
+    this.operatorId = getRuntimeContext().getOperatorUniqueID();

Review Comment:
   nit: new line



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to