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

[GitHub] [hudi] danny0405 opened a new pull request, #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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

   ### Change Logs
   
   We received several bug reports since #7620, for example: https://github.com/apache/hudi/issues/8060, this patch revert the changes of `CkpMetadata` and already report the write metadata events for write task, the coordinator would decide whether to re-commit these metadata stats.
   
   ### Impact
   
   Fix the problem introduced by #7620.
   
   ### Risk level (write none, low medium or high below)
   
   none
   
   ### Documentation Update
   
   _Describe any necessary documentation update if there is any new feature, config, or user-facing change_
   
   - _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


[GitHub] [hudi] hudi-bot commented on pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16111",
       "triggerID" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3e9da8cbd363aca09d3be5790ce289ecbc3183e0",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16121",
       "triggerID" : "3e9da8cbd363aca09d3be5790ce289ecbc3183e0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3e9da8cbd363aca09d3be5790ce289ecbc3183e0 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16121) 
   
   <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] SteNicholas commented on a diff in pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/common/AbstractStreamWriteFunction.java:
##########
@@ -195,15 +194,13 @@ public void setOperatorEventGateway(OperatorEventGateway operatorEventGateway) {
   private void restoreWriteMetadata() throws Exception {
     boolean eventSent = false;
     for (WriteMetadataEvent event : this.writeMetadataState.get()) {
-      if (Objects.equals(this.currentInstant, event.getInstantTime())) {
-        // Reset taskID for event
-        event.setTaskID(taskID);
-        // The checkpoint succeed but the meta does not commit,
-        // re-commit the inflight instant
-        this.eventGateway.sendEventToCoordinator(event);
-        LOG.info("Send uncommitted write metadata event to coordinator, task[{}].", taskID);
-        eventSent = true;
-      }
+      // Reset taskID for event

Review Comment:
   @danny0405, without this change, `testRecommitWithPartialUncommittedEvents` could also work well, therefore `testRecommitWithPartialUncommittedEvents` does not verify this change.



-- 
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] danny0405 merged pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


-- 
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] xccui commented on a diff in pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/meta/CkpMetadata.java:
##########
@@ -203,6 +203,11 @@ public boolean isAborted(String instant) {
     return this.messages.stream().anyMatch(ckpMsg -> instant.equals(ckpMsg.getInstant()) && ckpMsg.isAborted());
   }
 
+  @VisibleForTesting
+  public List<String> getInstantCache() {
+    return this.instantCache;

Review Comment:
   I suppose we can return an immutable list here?



-- 
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 #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7c8e63752c3f709c3102a5c412c1ec9c40846b90 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] SteNicholas commented on a diff in pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/common/AbstractStreamWriteFunction.java:
##########
@@ -195,15 +194,13 @@ public void setOperatorEventGateway(OperatorEventGateway operatorEventGateway) {
   private void restoreWriteMetadata() throws Exception {
     boolean eventSent = false;
     for (WriteMetadataEvent event : this.writeMetadataState.get()) {
-      if (Objects.equals(this.currentInstant, event.getInstantTime())) {
-        // Reset taskID for event
-        event.setTaskID(taskID);
-        // The checkpoint succeed but the meta does not commit,
-        // re-commit the inflight instant
-        this.eventGateway.sendEventToCoordinator(event);
-        LOG.info("Send uncommitted write metadata event to coordinator, task[{}].", taskID);
-        eventSent = true;
-      }
+      // Reset taskID for event

Review Comment:
   It's better to add the test cases for recommit to verify whether the recommit behavior could work 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


[GitHub] [hudi] SteNicholas commented on a diff in pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/common/AbstractStreamWriteFunction.java:
##########
@@ -194,8 +194,11 @@ public void setOperatorEventGateway(OperatorEventGateway operatorEventGateway) {
 
   private void restoreWriteMetadata() throws Exception {
     boolean eventSent = false;
+    HoodieTimeline pendingTimeline = this.metaClient.getActiveTimeline().filterPendingExcludingCompaction();

Review Comment:
   Does it need to exclude replacecommit?



-- 
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 #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16111",
       "triggerID" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7c8e63752c3f709c3102a5c412c1ec9c40846b90 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16111) 
   
   <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] danny0405 commented on a diff in pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/meta/CkpMetadata.java:
##########
@@ -203,6 +203,11 @@ public boolean isAborted(String instant) {
     return this.messages.stream().anyMatch(ckpMsg -> instant.equals(ckpMsg.getInstant()) && ckpMsg.isAborted());
   }
 
+  @VisibleForTesting
+  public List<String> getInstantCache() {
+    return this.instantCache;

Review Comment:
   This is only for test purpose, but I think you are right, this is a good coding convention.



-- 
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] danny0405 commented on a diff in pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/common/AbstractStreamWriteFunction.java:
##########
@@ -195,15 +194,13 @@ public void setOperatorEventGateway(OperatorEventGateway operatorEventGateway) {
   private void restoreWriteMetadata() throws Exception {
     boolean eventSent = false;
     for (WriteMetadataEvent event : this.writeMetadataState.get()) {
-      if (Objects.equals(this.currentInstant, event.getInstantTime())) {
-        // Reset taskID for event
-        event.setTaskID(taskID);
-        // The checkpoint succeed but the meta does not commit,
-        // re-commit the inflight instant
-        this.eventGateway.sendEventToCoordinator(event);
-        LOG.info("Send uncommitted write metadata event to coordinator, task[{}].", taskID);
-        eventSent = true;
-      }
+      // Reset taskID for event

Review Comment:
   `TestStreamWriteOperatorCoordinator#testRecommitWithPartialUncommittedEvents` should already test this logic.



-- 
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] SteNicholas commented on a diff in pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/common/AbstractStreamWriteFunction.java:
##########
@@ -195,15 +194,13 @@ public void setOperatorEventGateway(OperatorEventGateway operatorEventGateway) {
   private void restoreWriteMetadata() throws Exception {
     boolean eventSent = false;
     for (WriteMetadataEvent event : this.writeMetadataState.get()) {
-      if (Objects.equals(this.currentInstant, event.getInstantTime())) {
-        // Reset taskID for event
-        event.setTaskID(taskID);
-        // The checkpoint succeed but the meta does not commit,
-        // re-commit the inflight instant
-        this.eventGateway.sendEventToCoordinator(event);
-        LOG.info("Send uncommitted write metadata event to coordinator, task[{}].", taskID);
-        eventSent = true;
-      }
+      // Reset taskID for event

Review Comment:
   It's better to add the test cases for recommit to verify whether the recommit behavior could work well. The recommit behavior affects the quality of the writen Hudi table.



-- 
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 #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16111",
       "triggerID" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3e9da8cbd363aca09d3be5790ce289ecbc3183e0",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16121",
       "triggerID" : "3e9da8cbd363aca09d3be5790ce289ecbc3183e0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7c8e63752c3f709c3102a5c412c1ec9c40846b90 Azure: [CANCELED](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16111) 
   * 3e9da8cbd363aca09d3be5790ce289ecbc3183e0 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16121) 
   
   <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] SteNicholas commented on a diff in pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/common/AbstractStreamWriteFunction.java:
##########
@@ -194,8 +194,11 @@ public void setOperatorEventGateway(OperatorEventGateway operatorEventGateway) {
 
   private void restoreWriteMetadata() throws Exception {
     boolean eventSent = false;
+    HoodieTimeline pendingTimeline = this.metaClient.getActiveTimeline().filterPendingExcludingCompaction();

Review Comment:
   Does it need to exclude replacecommit?



-- 
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 #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16111",
       "triggerID" : "7c8e63752c3f709c3102a5c412c1ec9c40846b90",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3e9da8cbd363aca09d3be5790ce289ecbc3183e0",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "3e9da8cbd363aca09d3be5790ce289ecbc3183e0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7c8e63752c3f709c3102a5c412c1ec9c40846b90 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16111) 
   * 3e9da8cbd363aca09d3be5790ce289ecbc3183e0 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] xccui commented on a diff in pull request #8374: [HUDI-6030] Cleans the ckp meta while the JM restarts

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


##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/meta/TestCkpMetadata.java:
##########
@@ -72,6 +76,24 @@ void testWriteAndReadMessage(String uniqueId) {
     assertThat(metadata.getMessages().size(), is(5));
   }
 
+  @Test
+  void testBootstrap() throws Exception {
+    CkpMetadata metadata = getCkpMetadata("");
+    // write 4 instants to the ckp_meta
+    IntStream.range(0, 4).forEach(i -> metadata.startInstant(i + ""));
+    assertThat("The first instant should be removed from the instant cache",
+        metadata.getInstantCache(), is(Arrays.asList("1", "2", "3")));
+
+    // simulate the reboot of coordinator
+    CkpMetadata metadata1 = getCkpMetadata("");
+    metadata1.bootstrap();
+    assertNull(metadata1.getInstantCache(), "The instant cache should be recovered from bootstrap");
+
+    metadata1.startInstant("4");
+    assertThat("The first instant should be removed from the instant cache",

Review Comment:
   The message should be fixed



##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/meta/CkpMetadata.java:
##########
@@ -203,6 +203,11 @@ public boolean isAborted(String instant) {
     return this.messages.stream().anyMatch(ckpMsg -> instant.equals(ckpMsg.getInstant()) && ckpMsg.isAborted());
   }
 
+  @VisibleForTesting
+  public List<String> getInstantCache() {
+    return this.instantCache;

Review Comment:
   I suppose we can reduce an immutable list here?



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