pvary commented on code in PR #16011:
URL: https://github.com/apache/iceberg/pull/16011#discussion_r3110398215
##########
flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicWriteResultAggregator.java:
##########
@@ -76,10 +86,29 @@ class DynamicWriteResultAggregator
this.cacheMaximumSize = cacheMaximumSize;
}
+ @Override
+ public void initializeState(StateInitializationContext context) throws
Exception {
+ super.initializeState(context);
+ this.jobIdState =
context.getOperatorStateStore().getListState(JOB_ID_DESCRIPTOR);
+ Iterable<String> restoredJobIds = jobIdState.get();
+ if (restoredJobIds != null && restoredJobIds.iterator().hasNext()) {
+ String restoredJobId = restoredJobIds.iterator().next();
+ if (restoredJobId != null && !restoredJobId.isEmpty()) {
+ this.flinkJobId = restoredJobId;
+ 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.",
+ restoredJobId);
+ }
+ }
+ }
+
@Override
public void open() throws Exception {
- this.flinkJobId =
getContainingTask().getEnvironment().getJobID().toString();
- this.operatorId = getOperatorID().toString();
+ if (this.flinkJobId == null) {
Review Comment:
could we do this in the `initializeState`?
--
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]