pvary commented on code in PR #15042:
URL: https://github.com/apache/iceberg/pull/15042#discussion_r2720625135


##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/TableMaintenance.java:
##########
@@ -71,39 +74,71 @@ private TableMaintenance() {}
    *
    * @param changeStream the table changes
    * @param tableLoader used for accessing the table
-   * @param lockFactory used for preventing concurrent task runs
+   * @param lockFactory used for preventing concurrent task runs, if null, use 
coordination lock.
    * @return builder for the maintenance stream
    */
   @Internal
   public static Builder forChangeStream(
       DataStream<TableChange> changeStream,
       TableLoader tableLoader,
-      TriggerLockFactory lockFactory) {
+      @Nullable TriggerLockFactory lockFactory) {
     Preconditions.checkNotNull(changeStream, "The change stream should not be 
null");
     Preconditions.checkNotNull(tableLoader, "TableLoader should not be null");
-    Preconditions.checkNotNull(lockFactory, "LockFactory should not be null");
 
     return new Builder(null, changeStream, tableLoader, lockFactory);
   }
 
+  /**
+   * Use when the change stream is already provided, like in the {@link
+   * IcebergSink#addPostCommitTopology(DataStream)}.
+   *
+   * @param changeStream the table changes
+   * @param tableLoader used for accessing the table
+   * @return builder for the maintenance stream
+   */
+  @Internal
+  public static Builder forChangeStream(
+      DataStream<TableChange> changeStream, TableLoader tableLoader) {
+    Preconditions.checkNotNull(changeStream, "The change stream should not be 
null");
+    Preconditions.checkNotNull(tableLoader, "TableLoader should not be null");
+
+    return new Builder(null, changeStream, tableLoader, null);
+  }
+
   /**
    * Use this for standalone maintenance job. It creates a monitor source that 
detect table changes
    * and build the maintenance pipelines afterwards.
    *
    * @param env used to register the monitor source
    * @param tableLoader used for accessing the table
-   * @param lockFactory used for preventing concurrent task runs
+   * @param lockFactory used for preventing concurrent task runs. If null, use 
coordination lock.
    * @return builder for the maintenance stream
    */
   public static Builder forTable(

Review Comment:
   Maybe start deprecating these, so we can remove in the next release



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