jad-grepr commented on code in PR #18356:
URL: https://github.com/apache/iceberg/pull/18356#discussion_r4212876826


##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableUpdater.java:
##########
@@ -104,23 +105,37 @@ private void findOrCreateBranch(TableIdentifier 
identifier, String branch) {
     String fromCache = cache.branch(identifier, branch);
     if (fromCache == null) {
       Table table = catalog.loadTable(identifier);
-      try {
-        table.manageSnapshots().createBranch(branch).commit();
-        LOG.info("Branch {} for {} created", branch, identifier);
-      } catch (CommitFailedException e) {
-        table.refresh();
-        if (table.refs().containsKey(branch)) {
-          LOG.debug("Branch {} concurrently created for {}.", branch, 
identifier);
-        } else {
-          LOG.error("Failed to create branch {} for {}.", branch, identifier, 
e);
-          throw e;
-        }
-      }
-
+      maybeCreateBranch(identifier, table, branch);
       cache.update(identifier, table);
     }
   }
 
+  private static void maybeCreateBranch(TableIdentifier identifier, Table 
table, String branch) {

Review Comment:
   Done



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