kbendick commented on a change in pull request #2109:
URL: https://github.com/apache/iceberg/pull/2109#discussion_r559870212



##########
File path: 
flink/src/main/java/org/apache/iceberg/flink/sink/IcebergFilesCommitter.java
##########
@@ -126,9 +137,16 @@ public void initializeState(StateInitializationContext 
context) throws Exception
     this.manifestOutputFileFactory = 
FlinkManifestUtil.createOutputFileFactory(table, flinkJobId, subTaskId, 
attemptId);
     this.maxCommittedCheckpointId = INITIAL_CHECKPOINT_ID;
 
+    Map<String, String> properties = this.table.properties();
+    this.currentWatermark = PropertyUtil.propertyAsLong(properties, 
CURRENT_WATERMARK, -1L);
+    this.storeWatermark = PropertyUtil.propertyAsBoolean(properties, 
STORE_WATERMARK, false);
+
     this.checkpointsState = 
context.getOperatorStateStore().getListState(STATE_DESCRIPTOR);
     this.jobIdState = 
context.getOperatorStateStore().getListState(JOB_ID_DESCRIPTOR);
+    this.watermarkState = 
context.getOperatorStateStore().getListState(WATERMARK_DESCRIPTOR);
+
     if (context.isRestored()) {
+      watermarkPerCheckpoint.putAll(watermarkState.get().iterator().next());

Review comment:
       Will this be backwards compatible for on going streaming jobs that don't 
have any `watermarkState` when they restore? For example, for on going 
streaming jobs that are upgraded to a version of iceberg that includes this 
patch?
   
   Looking at the Flink `AppendingState` interface, it says that calling 
`.get()` should return `null` if the state is empty. Also, you can see that the 
value of `restoredFlinkJobId` below from calling 
`jobIdState.get().iterator().next()` below is checked for null or empty.




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



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

Reply via email to