You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "the-other-tim-brown (via GitHub)" <gi...@apache.org> on 2025/05/22 20:46:00 UTC

[PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

the-other-tim-brown opened a new pull request, #13347:
URL: https://github.com/apache/hudi/pull/13347

   ### Change Logs
   
   - Previously the log files were associated with the latest base file at the time the commit starts. Since compaction planning or a successful compaction causes a new base file, we need to check for conflicts with compaction for these older table versions. 
   - Starting with table version 8, the log files are associated with a base file based on the completion time so we don't rely on the current state of a file group when creating these log files. That means we no longer need to check compaction for conflicts which in turn allows for smoother operations on MoR tables.
   
   ### Impact
   
   - Allows async compaction to schedule and run without causing disruption to other writers
   
   ### Risk level (write none, low medium or high below)
   
   High, this is a core change to conflict detection. 
   
   ### Documentation Update
   
   _Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none"._
   
   - _The config description must be updated if new configs are added or the default value of the configs are changed_
   - _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
     ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make
     changes to the website._
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Change Logs and Impact were stated clearly
   - [ ] Adequate tests were added if applicable
   - [ ] CI passed
   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2902531347

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 59dc7663f0c989e3023d3a335cfa86e277f077a0 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "vinothchandar (via GitHub)" <gi...@apache.org>.
vinothchandar commented on code in PR #13347:
URL: https://github.com/apache/hudi/pull/13347#discussion_r2114874400


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/SimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -53,12 +55,59 @@ public class SimpleConcurrentFileWritesConflictResolutionStrategy
   @Override
   public Stream<HoodieInstant> getCandidateInstants(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
                                                     Option<HoodieInstant> lastSuccessfulInstant) {
+    if (metaClient.getTableConfig().getTableVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT)) {
+      return getCandidateInstantsV8AndAbove(metaClient, currentInstant, lastSuccessfulInstant);
+    } else {
+      return getCandidateInstantsPreV8(metaClient, currentInstant, lastSuccessfulInstant);
+    }
+  }
+
+  /**
+   * To find which instants are conflicting for table versions 8 and above, we apply the following logic:
+   * <ul>
+   *   <li>Get completed instants timeline only for commits that have happened since the last successful write.</li>
+   *   <li>Get any completed replace commit that happened since the last successful write and any pending replace commit.</li>
+   * </ul>
+   * @param metaClient table meta client
+   * @param currentInstant the instant for the write this client is attempting to commit
+   * @param lastSuccessfulInstant the last successful write before this commit started
+   * @return a stream of instants that are candidates for conflict resolution
+   */
+  private Stream<HoodieInstant> getCandidateInstantsV8AndAbove(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
+                                                               Option<HoodieInstant> lastSuccessfulInstant) {
+    HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
+    boolean isMoRTable = metaClient.getTableType() == HoodieTableType.MERGE_ON_READ;
+    Stream<HoodieInstant> completedCommitsInstantStream = activeTimeline
+        .getCommitsTimeline()
+        .filterCompletedInstants()
+        .filter(instant -> !isMoRTable || !instant.getAction().equals(HoodieTimeline.COMMIT_ACTION))
+        .findInstantsAfter(lastSuccessfulInstant.isPresent() ? lastSuccessfulInstant.get().requestedTime() : HoodieTimeline.INIT_INSTANT_TS)
+        .getInstantsAsStream();
+
+    Stream<HoodieInstant> clusteringAndReplaceCommitInstants = activeTimeline

Review Comment:
   okay realize the difference `filterPendingReplaceOrClusteringTimeline` vs `filterPendingReplaceClusteringAndCompactionTimeline` . So okay to leave it as is or try and consolidate so the filter differences are obvious



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2920817183

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659",
       "triggerID" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "triggerType" : "PUSH"
     }, {
       "hash" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5665",
       "triggerID" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "fe0d198904f1e4a182fed07e3865e20712229e80",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "fe0d198904f1e4a182fed07e3865e20712229e80",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 65eb9f9b026b24b46a1c783387b6f9ab416a207b Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5665) 
   * fe0d198904f1e4a182fed07e3865e20712229e80 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2902535298

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 59dc7663f0c989e3023d3a335cfa86e277f077a0 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2921098094

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659",
       "triggerID" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "triggerType" : "PUSH"
     }, {
       "hash" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5665",
       "triggerID" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "fe0d198904f1e4a182fed07e3865e20712229e80",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5868",
       "triggerID" : "fe0d198904f1e4a182fed07e3865e20712229e80",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fe0d198904f1e4a182fed07e3865e20712229e80 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5868) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "vinothchandar (via GitHub)" <gi...@apache.org>.
vinothchandar merged PR #13347:
URL: https://github.com/apache/hudi/pull/13347


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "TheR1sing3un (via GitHub)" <gi...@apache.org>.
TheR1sing3un commented on code in PR #13347:
URL: https://github.com/apache/hudi/pull/13347#discussion_r2111405579


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/SimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -53,12 +55,59 @@ public class SimpleConcurrentFileWritesConflictResolutionStrategy
   @Override
   public Stream<HoodieInstant> getCandidateInstants(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
                                                     Option<HoodieInstant> lastSuccessfulInstant) {
+    if (metaClient.getTableConfig().getTableVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT)) {
+      return getCandidateInstantsV8AndAbove(metaClient, currentInstant, lastSuccessfulInstant);
+    } else {
+      return getCandidateInstantsPreV8(metaClient, currentInstant, lastSuccessfulInstant);
+    }
+  }
+
+  /**
+   * To find which instants are conflicting for table versions 8 and above, we apply the following logic:
+   * <ul>
+   *   <li>Get completed instants timeline only for commits that have happened since the last successful write.</li>
+   *   <li>Get any completed replace commit that happened since the last successful write and any pending replace commit.</li>
+   * </ul>
+   * @param metaClient table meta client
+   * @param currentInstant the instant for the write this client is attempting to commit
+   * @param lastSuccessfulInstant the last successful write before this commit started
+   * @return a stream of instants that are candidates for conflict resolution
+   */
+  private Stream<HoodieInstant> getCandidateInstantsV8AndAbove(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
+                                                               Option<HoodieInstant> lastSuccessfulInstant) {
+    HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
+    boolean isMoRTable = metaClient.getTableType() == HoodieTableType.MERGE_ON_READ;
+    Stream<HoodieInstant> completedCommitsInstantStream = activeTimeline
+        .getCommitsTimeline()
+        .filterCompletedInstants()
+        .filter(instant -> !isMoRTable || !instant.getAction().equals(HoodieTimeline.COMMIT_ACTION))

Review Comment:
   How about introduce a new method: `HoodieTimeline#getDataCommitsTime` 
   1. for mor: return [`DELTA_COMMIT`, `REPLACE_COMMIT`]
   2. for cow: return [`COMMIT`, `REPLACE_COMMIT`]



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2902837589

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659",
       "triggerID" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 59dc7663f0c989e3023d3a335cfa86e277f077a0 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654) 
   * 0e84fcd4fe42d4f53be29a8ed28a457f33405b51 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2902835422

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 59dc7663f0c989e3023d3a335cfa86e277f077a0 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654) 
   * 0e84fcd4fe42d4f53be29a8ed28a457f33405b51 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #13347:
URL: https://github.com/apache/hudi/pull/13347#discussion_r2103670328


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/SimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -53,24 +56,45 @@ public class SimpleConcurrentFileWritesConflictResolutionStrategy
   @Override
   public Stream<HoodieInstant> getCandidateInstants(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
                                                     Option<HoodieInstant> lastSuccessfulInstant) {
+    boolean usesCompletionTimeOrdering = metaClient.getTableConfig().getTableVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT);
     HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
     // To find which instants are conflicting, we apply the following logic
     // 1. Get completed instants timeline only for commits that have happened since the last successful write.
-    // 2. Get any scheduled or completed compaction that have started and/or finished after the current instant.
+    // 2. For tables with a version lower than 8, get any scheduled or completed compaction that have started and/or finished after the current instant.
+    //    - Note: this is not required for v8 tables which use completion time ordering of log files to build file groups.
     // 3. Get any completed replace commit that happened since the last successful write and any pending replace commit.
     // We need to check for write conflicts since they may have mutated the same files that are being newly created by the current write.
+    Predicate<HoodieInstant> compactionInstantFilter = (HoodieInstant instant) -> {

Review Comment:
   Can we add a new strategy class and not mess up the v8 and v6.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "the-other-tim-brown (via GitHub)" <gi...@apache.org>.
the-other-tim-brown commented on code in PR #13347:
URL: https://github.com/apache/hudi/pull/13347#discussion_r2103674769


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/SimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -53,24 +56,45 @@ public class SimpleConcurrentFileWritesConflictResolutionStrategy
   @Override
   public Stream<HoodieInstant> getCandidateInstants(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
                                                     Option<HoodieInstant> lastSuccessfulInstant) {
+    boolean usesCompletionTimeOrdering = metaClient.getTableConfig().getTableVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT);
     HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
     // To find which instants are conflicting, we apply the following logic
     // 1. Get completed instants timeline only for commits that have happened since the last successful write.
-    // 2. Get any scheduled or completed compaction that have started and/or finished after the current instant.
+    // 2. For tables with a version lower than 8, get any scheduled or completed compaction that have started and/or finished after the current instant.
+    //    - Note: this is not required for v8 tables which use completion time ordering of log files to build file groups.
     // 3. Get any completed replace commit that happened since the last successful write and any pending replace commit.
     // We need to check for write conflicts since they may have mutated the same files that are being newly created by the current write.
+    Predicate<HoodieInstant> compactionInstantFilter = (HoodieInstant instant) -> {

Review Comment:
   Do you mean a new implementation of `ConflictResolutionStrategy`? It would allow the user to potentially specify the class that does not map to their table version which can cause issues.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2903098603

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659",
       "triggerID" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "triggerType" : "PUSH"
     }, {
       "hash" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5665",
       "triggerID" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0e84fcd4fe42d4f53be29a8ed28a457f33405b51 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659) 
   * 65eb9f9b026b24b46a1c783387b6f9ab416a207b Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5665) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "vinothchandar (via GitHub)" <gi...@apache.org>.
vinothchandar commented on code in PR #13347:
URL: https://github.com/apache/hudi/pull/13347#discussion_r2114857478


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/SimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -53,12 +55,59 @@ public class SimpleConcurrentFileWritesConflictResolutionStrategy
   @Override
   public Stream<HoodieInstant> getCandidateInstants(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
                                                     Option<HoodieInstant> lastSuccessfulInstant) {
+    if (metaClient.getTableConfig().getTableVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT)) {
+      return getCandidateInstantsV8AndAbove(metaClient, currentInstant, lastSuccessfulInstant);
+    } else {
+      return getCandidateInstantsPreV8(metaClient, currentInstant, lastSuccessfulInstant);
+    }
+  }
+
+  /**
+   * To find which instants are conflicting for table versions 8 and above, we apply the following logic:
+   * <ul>
+   *   <li>Get completed instants timeline only for commits that have happened since the last successful write.</li>
+   *   <li>Get any completed replace commit that happened since the last successful write and any pending replace commit.</li>
+   * </ul>
+   * @param metaClient table meta client
+   * @param currentInstant the instant for the write this client is attempting to commit
+   * @param lastSuccessfulInstant the last successful write before this commit started
+   * @return a stream of instants that are candidates for conflict resolution
+   */
+  private Stream<HoodieInstant> getCandidateInstantsV8AndAbove(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
+                                                               Option<HoodieInstant> lastSuccessfulInstant) {
+    HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
+    boolean isMoRTable = metaClient.getTableType() == HoodieTableType.MERGE_ON_READ;
+    Stream<HoodieInstant> completedCommitsInstantStream = activeTimeline
+        .getCommitsTimeline()
+        .filterCompletedInstants()
+        .filter(instant -> !isMoRTable || !instant.getAction().equals(HoodieTimeline.COMMIT_ACTION))
+        .findInstantsAfter(lastSuccessfulInstant.isPresent() ? lastSuccessfulInstant.get().requestedTime() : HoodieTimeline.INIT_INSTANT_TS)
+        .getInstantsAsStream();
+
+    Stream<HoodieInstant> clusteringAndReplaceCommitInstants = activeTimeline

Review Comment:
   lets pull this into a private method.. called from both places.. ?



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/SimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -53,12 +55,59 @@ public class SimpleConcurrentFileWritesConflictResolutionStrategy
   @Override
   public Stream<HoodieInstant> getCandidateInstants(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
                                                     Option<HoodieInstant> lastSuccessfulInstant) {
+    if (metaClient.getTableConfig().getTableVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT)) {
+      return getCandidateInstantsV8AndAbove(metaClient, currentInstant, lastSuccessfulInstant);
+    } else {
+      return getCandidateInstantsPreV8(metaClient, currentInstant, lastSuccessfulInstant);
+    }
+  }
+
+  /**
+   * To find which instants are conflicting for table versions 8 and above, we apply the following logic:
+   * <ul>
+   *   <li>Get completed instants timeline only for commits that have happened since the last successful write.</li>
+   *   <li>Get any completed replace commit that happened since the last successful write and any pending replace commit.</li>
+   * </ul>
+   * @param metaClient table meta client
+   * @param currentInstant the instant for the write this client is attempting to commit
+   * @param lastSuccessfulInstant the last successful write before this commit started
+   * @return a stream of instants that are candidates for conflict resolution
+   */
+  private Stream<HoodieInstant> getCandidateInstantsV8AndAbove(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
+                                                               Option<HoodieInstant> lastSuccessfulInstant) {
+    HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
+    boolean isMoRTable = metaClient.getTableType() == HoodieTableType.MERGE_ON_READ;
+    Stream<HoodieInstant> completedCommitsInstantStream = activeTimeline
+        .getCommitsTimeline()
+        .filterCompletedInstants()
+        .filter(instant -> !isMoRTable || !instant.getAction().equals(HoodieTimeline.COMMIT_ACTION))
+        .findInstantsAfter(lastSuccessfulInstant.isPresent() ? lastSuccessfulInstant.get().requestedTime() : HoodieTimeline.INIT_INSTANT_TS)

Review Comment:
   lets use `lastSuccessfulInstant.map().orElse()` ? 



##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/client/transaction/TestSimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -224,16 +228,23 @@ public void testConcurrentWritesWithInterleavingScheduledCompaction() throws Exc
     metaClient.reloadActiveTimeline();
     List<HoodieInstant> candidateInstants = strategy.getCandidateInstants(metaClient, currentInstant.get(), lastSuccessfulInstant).collect(
         Collectors.toList());
-    // writer 1 conflicts with scheduled compaction plan 1
-    Assertions.assertEquals(1, candidateInstants.size());
-    ConcurrentOperation thatCommitOperation = new ConcurrentOperation(candidateInstants.get(0), metaClient);
-    ConcurrentOperation thisCommitOperation = new ConcurrentOperation(currentInstant.get(), currentMetadata);
-    Assertions.assertTrue(strategy.hasConflict(thisCommitOperation, thatCommitOperation));
-    Assertions.assertThrows(HoodieWriteConflictException.class, () -> strategy.resolveConflict(null, thisCommitOperation, thatCommitOperation));
+    if (preTableVersion8) {
+      // writer 1 conflicts with scheduled compaction plan 1
+      Assertions.assertEquals(1, candidateInstants.size());
+      ConcurrentOperation thatCommitOperation = new ConcurrentOperation(candidateInstants.get(0), metaClient);
+      ConcurrentOperation thisCommitOperation = new ConcurrentOperation(currentInstant.get(), currentMetadata);
+      Assertions.assertTrue(strategy.hasConflict(thisCommitOperation, thatCommitOperation));
+      Assertions.assertThrows(HoodieWriteConflictException.class, () -> strategy.resolveConflict(null, thisCommitOperation, thatCommitOperation));
+    } else {
+      // writer will not have conflicts with compaction since ordering is now based on completion time to avoid these conflicts
+      Assertions.assertTrue(candidateInstants.isEmpty());
+    }
   }
 
-  @Test
-  public void testConcurrentWritesWithInterleavingSuccessfulCompaction() throws Exception {
+  @ParameterizedTest
+  @ValueSource(booleans = {false, true})
+  public void testConcurrentWritesWithInterleavingSuccessfulCompaction(boolean preTableVersion8) throws Exception {
+    initMetaClient(preTableVersion8, HoodieTableType.MERGE_ON_READ);

Review Comment:
   I guess there are only two scenarios, that are different. So Parameterizing the entire test class is an overkill



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/SimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -53,12 +55,59 @@ public class SimpleConcurrentFileWritesConflictResolutionStrategy
   @Override
   public Stream<HoodieInstant> getCandidateInstants(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
                                                     Option<HoodieInstant> lastSuccessfulInstant) {
+    if (metaClient.getTableConfig().getTableVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT)) {
+      return getCandidateInstantsV8AndAbove(metaClient, currentInstant, lastSuccessfulInstant);
+    } else {
+      return getCandidateInstantsPreV8(metaClient, currentInstant, lastSuccessfulInstant);
+    }
+  }
+
+  /**
+   * To find which instants are conflicting for table versions 8 and above, we apply the following logic:
+   * <ul>
+   *   <li>Get completed instants timeline only for commits that have happened since the last successful write.</li>
+   *   <li>Get any completed replace commit that happened since the last successful write and any pending replace commit.</li>
+   * </ul>
+   * @param metaClient table meta client
+   * @param currentInstant the instant for the write this client is attempting to commit
+   * @param lastSuccessfulInstant the last successful write before this commit started
+   * @return a stream of instants that are candidates for conflict resolution
+   */
+  private Stream<HoodieInstant> getCandidateInstantsV8AndAbove(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
+                                                               Option<HoodieInstant> lastSuccessfulInstant) {
+    HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
+    boolean isMoRTable = metaClient.getTableType() == HoodieTableType.MERGE_ON_READ;
+    Stream<HoodieInstant> completedCommitsInstantStream = activeTimeline
+        .getCommitsTimeline()
+        .filterCompletedInstants()
+        .filter(instant -> !isMoRTable || !instant.getAction().equals(HoodieTimeline.COMMIT_ACTION))
+        .findInstantsAfter(lastSuccessfulInstant.isPresent() ? lastSuccessfulInstant.get().requestedTime() : HoodieTimeline.INIT_INSTANT_TS)

Review Comment:
   Similar here. the only thing thats different is the extra filter.. so we could pull the rest to a private method shared by both paths. and do the extra filter. 
   



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2920819409

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659",
       "triggerID" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "triggerType" : "PUSH"
     }, {
       "hash" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5665",
       "triggerID" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "fe0d198904f1e4a182fed07e3865e20712229e80",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5868",
       "triggerID" : "fe0d198904f1e4a182fed07e3865e20712229e80",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 65eb9f9b026b24b46a1c783387b6f9ab416a207b Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5665) 
   * fe0d198904f1e4a182fed07e3865e20712229e80 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5868) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "the-other-tim-brown (via GitHub)" <gi...@apache.org>.
the-other-tim-brown commented on code in PR #13347:
URL: https://github.com/apache/hudi/pull/13347#discussion_r2103559865


##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/client/transaction/TestSimpleConcurrentFileWritesConflictResolutionStrategyWithMORTable.java:
##########
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hudi.client.transaction;
-
-import org.apache.hudi.common.model.HoodieCommitMetadata;
-import org.apache.hudi.common.model.HoodieTableType;
-import org.apache.hudi.common.table.timeline.HoodieActiveTimeline;
-import org.apache.hudi.common.table.timeline.HoodieInstant;
-import org.apache.hudi.common.table.timeline.HoodieTimeline;
-import org.apache.hudi.common.testutils.HoodieCommonTestHarness;
-import org.apache.hudi.common.util.Option;
-import org.apache.hudi.exception.HoodieWriteConflictException;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.apache.hudi.client.transaction.TestConflictResolutionStrategyUtil.createCommit;
-import static org.apache.hudi.client.transaction.TestConflictResolutionStrategyUtil.createCommitMetadata;
-import static org.apache.hudi.client.transaction.TestConflictResolutionStrategyUtil.createInflightCommit;
-import static org.apache.hudi.client.transaction.TestConflictResolutionStrategyUtil.createPendingCompaction;
-import static org.apache.hudi.common.testutils.HoodieTestUtils.INSTANT_GENERATOR;
-
-public class TestSimpleConcurrentFileWritesConflictResolutionStrategyWithMORTable extends HoodieCommonTestHarness {
-  @Override
-  protected HoodieTableType getTableType() {
-    return HoodieTableType.MERGE_ON_READ;
-  }
-
-  @BeforeEach
-  public void init() throws IOException {
-    initMetaClient();
-  }
-
-  @Test
-  public void testConcurrentWritesWithInterleavingInflightCompaction() throws Exception {

Review Comment:
   Moved this to the other class to consolidate the tests



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2903096424

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659",
       "triggerID" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "triggerType" : "PUSH"
     }, {
       "hash" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0e84fcd4fe42d4f53be29a8ed28a457f33405b51 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659) 
   * 65eb9f9b026b24b46a1c783387b6f9ab416a207b UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "the-other-tim-brown (via GitHub)" <gi...@apache.org>.
the-other-tim-brown commented on code in PR #13347:
URL: https://github.com/apache/hudi/pull/13347#discussion_r2103683593


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/SimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -53,24 +56,45 @@ public class SimpleConcurrentFileWritesConflictResolutionStrategy
   @Override
   public Stream<HoodieInstant> getCandidateInstants(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
                                                     Option<HoodieInstant> lastSuccessfulInstant) {
+    boolean usesCompletionTimeOrdering = metaClient.getTableConfig().getTableVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT);
     HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
     // To find which instants are conflicting, we apply the following logic
     // 1. Get completed instants timeline only for commits that have happened since the last successful write.
-    // 2. Get any scheduled or completed compaction that have started and/or finished after the current instant.
+    // 2. For tables with a version lower than 8, get any scheduled or completed compaction that have started and/or finished after the current instant.
+    //    - Note: this is not required for v8 tables which use completion time ordering of log files to build file groups.
     // 3. Get any completed replace commit that happened since the last successful write and any pending replace commit.
     // We need to check for write conflicts since they may have mutated the same files that are being newly created by the current write.
+    Predicate<HoodieInstant> compactionInstantFilter = (HoodieInstant instant) -> {

Review Comment:
   One way to make the code cleaner is to have private methods for handling the different versions so this method just checks table version and then delegates to these methods. Then the javadocs per method can also contain the specifics for that table version.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2902955902

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659",
       "triggerID" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0e84fcd4fe42d4f53be29a8ed28a457f33405b51 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "the-other-tim-brown (via GitHub)" <gi...@apache.org>.
the-other-tim-brown commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2920814440

   > I think its safe for v8+ writers to not conflict with scheduled or completed compactions.
   > 
   > Without multi-writer, v6 writers should n't be conflicting with completed compactions (it ll only conflict with scheduled compactions)... With multi-writer, v6 writers will conflict with both scheduled and completed compactions. (the `hasConflict()` just looks for file group id overlap)
   > 
   > Let me know if yours is different. if not, LGTM. Suggest getting another review given Danny has started already..
   
   @vinothchandar that is my understanding as well


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2903179601

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5659",
       "triggerID" : "0e84fcd4fe42d4f53be29a8ed28a457f33405b51",
       "triggerType" : "PUSH"
     }, {
       "hash" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5665",
       "triggerID" : "65eb9f9b026b24b46a1c783387b6f9ab416a207b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 65eb9f9b026b24b46a1c783387b6f9ab416a207b Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5665) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "the-other-tim-brown (via GitHub)" <gi...@apache.org>.
the-other-tim-brown commented on code in PR #13347:
URL: https://github.com/apache/hudi/pull/13347#discussion_r2103694645


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/SimpleConcurrentFileWritesConflictResolutionStrategy.java:
##########
@@ -53,24 +56,45 @@ public class SimpleConcurrentFileWritesConflictResolutionStrategy
   @Override
   public Stream<HoodieInstant> getCandidateInstants(HoodieTableMetaClient metaClient, HoodieInstant currentInstant,
                                                     Option<HoodieInstant> lastSuccessfulInstant) {
+    boolean usesCompletionTimeOrdering = metaClient.getTableConfig().getTableVersion().greaterThanOrEquals(HoodieTableVersion.EIGHT);
     HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
     // To find which instants are conflicting, we apply the following logic
     // 1. Get completed instants timeline only for commits that have happened since the last successful write.
-    // 2. Get any scheduled or completed compaction that have started and/or finished after the current instant.
+    // 2. For tables with a version lower than 8, get any scheduled or completed compaction that have started and/or finished after the current instant.
+    //    - Note: this is not required for v8 tables which use completion time ordering of log files to build file groups.
     // 3. Get any completed replace commit that happened since the last successful write and any pending replace commit.
     // We need to check for write conflicts since they may have mutated the same files that are being newly created by the current write.
+    Predicate<HoodieInstant> compactionInstantFilter = (HoodieInstant instant) -> {

Review Comment:
   I've split this out into two internal methods which seems like the best way to ensure users automatically pick up these improvements if they upgraded to table version 8. The diff is also smaller now so it is more clear what is changing as part of this PR.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9438] Fix conflict handling for compaction instants for v8 tables [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13347:
URL: https://github.com/apache/hudi/pull/13347#issuecomment-2902671620

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654",
       "triggerID" : "59dc7663f0c989e3023d3a335cfa86e277f077a0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 59dc7663f0c989e3023d3a335cfa86e277f077a0 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5654) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org