ConeyLiu commented on code in PR #8001:
URL: https://github.com/apache/iceberg/pull/8001#discussion_r1274467145


##########
core/src/main/java/org/apache/iceberg/actions/BaseCommitService.java:
##########
@@ -96,12 +97,37 @@ abstract class BaseCommitService<T> implements Closeable {
   }
 
   /**
-   * Perform a commit operation on the table for the set of file groups, 
should cleanup failed file
-   * groups.
+   * Perform a commit operation on the table for the set of file groups. This 
should not clean up
+   * failed file and will be handled by {@link #doCommitOrClean}.
    *
    * @param batch set of file groups
    */
-  protected abstract void commitOrClean(Set<T> batch);
+  protected abstract void commit(Set<T> batch);
+
+  /**
+   * Perform a commit operation on the table for the set of file groups. And 
also should clean up
+   * failed file groups.
+   *
+   * @param rewriteGroups set of file groups
+   */
+  private void doCommitOrClean(Set<T> rewriteGroups) {
+    try {
+      synchronized (completedRewrites) {
+        // synchronize on completedRewrites to avoid committing conflict by 
multiple threads
+        commit(rewriteGroups);

Review Comment:
   just lock the commit stage



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