You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "yihua (via GitHub)" <gi...@apache.org> on 2023/03/11 00:45:08 UTC

[GitHub] [hudi] yihua opened a new pull request, #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

yihua opened a new pull request, #8156:
URL: https://github.com/apache/hudi/pull/8156

   ### Change Logs
   
   In the following scenario, before this fix, the validation job fires a false alarm complaining that the partition list returned by the file system and the metadata table:
   - Commit C1 creates the partition, the partition metadata is written, and C1 fails during writing data files.  Next time, C2 adds new data to the same partition after C1 is rolled back. In this case, the partition metadata still has C1 as the created commit time, since Hudi does not rewrite the partition metadata in C2.
   
   This PR fixes the validation of partition listing in metadata table validator for this case, by checking if the created commit time is the same as or before the latest commit.
   
   ### Impact
   
   Fixes the false validation failure in the scenario where the commit creating the partitions fails and is rolled back later.
   
   ### Risk level
   
   low
   
   ### Documentation Update
   
   N/A
   
   ### 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


[GitHub] [hudi] hudi-bot commented on pull request #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15668",
       "triggerID" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c2494f74ce709a29f512fc165dfe1b12b99aa244 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15668) 
   
   <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


[GitHub] [hudi] hudi-bot commented on pull request #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15668",
       "triggerID" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6042ca5f4d6ce30b78b9c610de372fbf054a7aa1",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15673",
       "triggerID" : "6042ca5f4d6ce30b78b9c610de372fbf054a7aa1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c2494f74ce709a29f512fc165dfe1b12b99aa244 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15668) 
   * 6042ca5f4d6ce30b78b9c610de372fbf054a7aa1 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15673) 
   
   <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


[GitHub] [hudi] hudi-bot commented on pull request #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15668",
       "triggerID" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6042ca5f4d6ce30b78b9c610de372fbf054a7aa1",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "6042ca5f4d6ce30b78b9c610de372fbf054a7aa1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c2494f74ce709a29f512fc165dfe1b12b99aa244 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15668) 
   * 6042ca5f4d6ce30b78b9c610de372fbf054a7aa1 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


[GitHub] [hudi] nsivabalan merged pull request #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

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


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


[GitHub] [hudi] nsivabalan commented on a diff in pull request #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

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


##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieMetadataTableValidator.java:
##########
@@ -533,7 +533,19 @@ private List<String> validatePartitions(HoodieSparkEngineContext engineContext,
       Option<String> instantOption = hoodiePartitionMetadata.readPartitionCreatedCommitTime();
       if (instantOption.isPresent()) {
         String instantTime = instantOption.get();
-        return completedTimeline.containsOrBeforeTimelineStarts(instantTime);
+        // There are two cases where the created commit time is written to the partition metadata:
+        // (1) Commit C1 creates the partition and C1 succeeds, the partition metadata has C1 as
+        // the created commit time.
+        // (2) Commit C1 creates the partition, the partition metadata is written, and C1 fails
+        // during writing data files.  Next time, C2 adds new data to the same partition after C1
+        // is rolled back. In this case, the partition metadata still has C1 as the created commit
+        // time, since Hudi does not rewrite the partition metadata in C2.
+        if (!completedTimeline.containsOrBeforeTimelineStarts(instantTime)) {
+          Option<HoodieInstant> lastInstant = completedTimeline.lastInstant();
+          return lastInstant.isPresent()
+              && lastInstant.get().getTimestamp().compareTo(instantTime) >= 0;

Review Comment:
   minor. we have use functions we have in HoodieTimeline 
   GREATER_THAN_OR_EQUALS
   



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


[GitHub] [hudi] hudi-bot commented on pull request #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15668",
       "triggerID" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6042ca5f4d6ce30b78b9c610de372fbf054a7aa1",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15673",
       "triggerID" : "6042ca5f4d6ce30b78b9c610de372fbf054a7aa1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6042ca5f4d6ce30b78b9c610de372fbf054a7aa1 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15673) 
   
   <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


[GitHub] [hudi] hudi-bot commented on pull request #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c2494f74ce709a29f512fc165dfe1b12b99aa244 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


[GitHub] [hudi] hudi-bot commented on pull request #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15668",
       "triggerID" : "c2494f74ce709a29f512fc165dfe1b12b99aa244",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c2494f74ce709a29f512fc165dfe1b12b99aa244 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15668) 
   
   <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


[GitHub] [hudi] yihua commented on a diff in pull request #8156: [HUDI-5919] Fix the validation of partition listing in metadata table validator

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


##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieMetadataTableValidator.java:
##########
@@ -533,7 +533,19 @@ private List<String> validatePartitions(HoodieSparkEngineContext engineContext,
       Option<String> instantOption = hoodiePartitionMetadata.readPartitionCreatedCommitTime();
       if (instantOption.isPresent()) {
         String instantTime = instantOption.get();
-        return completedTimeline.containsOrBeforeTimelineStarts(instantTime);
+        // There are two cases where the created commit time is written to the partition metadata:
+        // (1) Commit C1 creates the partition and C1 succeeds, the partition metadata has C1 as
+        // the created commit time.
+        // (2) Commit C1 creates the partition, the partition metadata is written, and C1 fails
+        // during writing data files.  Next time, C2 adds new data to the same partition after C1
+        // is rolled back. In this case, the partition metadata still has C1 as the created commit
+        // time, since Hudi does not rewrite the partition metadata in C2.
+        if (!completedTimeline.containsOrBeforeTimelineStarts(instantTime)) {
+          Option<HoodieInstant> lastInstant = completedTimeline.lastInstant();
+          return lastInstant.isPresent()
+              && lastInstant.get().getTimestamp().compareTo(instantTime) >= 0;

Review Comment:
   Addressed.



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