Re: [PR] [HUDI-7109] Fix Flink may re-use a committed instant in append mode [hudi]

2023-11-16 Thread via GitHub


danny0405 merged PR #10119:
URL: https://github.com/apache/hudi/pull/10119


-- 
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-unsubscr...@hudi.apache.org

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



Re: [PR] [HUDI-7109] Fix Flink may re-use a committed instant in append mode [hudi]

2023-11-16 Thread via GitHub


hehuiyuan commented on code in PR #10119:
URL: https://github.com/apache/hudi/pull/10119#discussion_r1395978844


##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/append/AppendWriteFunction.java:
##
@@ -112,7 +112,7 @@ protected void sendBootstrapEvent() {
 int attemptId = getRuntimeContext().getAttemptNumber();
 if (attemptId > 0) {
   // either a partial or global failover, reuses the current inflight 
instant
-  if (this.currentInstant != null) {
+  if (this.currentInstant != null && 
!metaClient.getActiveTimeline().filterCompletedInstants().containsInstant(currentInstant))
 {

Review Comment:
   It is possible.   
   writeClient.commit  is successful,  but the  log `"Commit instant [{}] 
success!` doesn't exist. Something happened when  
this.ckpMetadata.commitInstant(instant).
   
   After flink job restart, the  WriteFunction's instant is `20231114121907373`
   



-- 
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-unsubscr...@hudi.apache.org

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



Re: [PR] [HUDI-7109] Fix Flink may re-use a committed instant in append mode [hudi]

2023-11-16 Thread via GitHub


hudi-bot commented on PR #10119:
URL: https://github.com/apache/hudi/pull/10119#issuecomment-1814603945

   
   ## CI report:
   
   * 80cd231d122e710c178a39121d3910c9f37c07b8 Azure: 
[FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=20953)
 
   
   
   Bot commands
 @hudi-bot supports the following commands:
   
- `@hudi-bot run azure` re-run the last Azure build
   


-- 
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-unsubscr...@hudi.apache.org

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



Re: [PR] [HUDI-7109] Fix Flink may re-use a committed instant in append mode [hudi]

2023-11-16 Thread via GitHub


hudi-bot commented on PR #10119:
URL: https://github.com/apache/hudi/pull/10119#issuecomment-1814315021

   
   ## CI report:
   
   * 80cd231d122e710c178a39121d3910c9f37c07b8 Azure: 
[PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=20953)
 
   
   
   Bot commands
 @hudi-bot supports the following commands:
   
- `@hudi-bot run azure` re-run the last Azure build
   


-- 
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-unsubscr...@hudi.apache.org

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



Re: [PR] [HUDI-7109] Fix Flink may re-use a committed instant in append mode [hudi]

2023-11-16 Thread via GitHub


hudi-bot commented on PR #10119:
URL: https://github.com/apache/hudi/pull/10119#issuecomment-1814303867

   
   ## CI report:
   
   * 80cd231d122e710c178a39121d3910c9f37c07b8 UNKNOWN
   
   
   Bot commands
 @hudi-bot supports the following commands:
   
- `@hudi-bot run azure` re-run the last Azure build
   


-- 
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-unsubscr...@hudi.apache.org

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



Re: [PR] [HUDI-7109] Fix Flink may re-use a committed instant in append mode [hudi]

2023-11-16 Thread via GitHub


zhangyue19921010 commented on code in PR #10119:
URL: https://github.com/apache/hudi/pull/10119#discussion_r1395580706


##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/append/AppendWriteFunction.java:
##
@@ -112,7 +112,7 @@ protected void sendBootstrapEvent() {
 int attemptId = getRuntimeContext().getAttemptNumber();
 if (attemptId > 0) {
   // either a partial or global failover, reuses the current inflight 
instant
-  if (this.currentInstant != null) {
+  if (this.currentInstant != null && 
!metaClient.getActiveTimeline().filterCompletedInstants().containsInstant(currentInstant))
 {

Review Comment:
   Make sure currentInstant is truly inflight



-- 
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-unsubscr...@hudi.apache.org

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



Re: [PR] [HUDI-7109] Fix Flink may re-use a committed instant in append mode [hudi]

2023-11-16 Thread via GitHub


zhangyue19921010 commented on PR #10119:
URL: https://github.com/apache/hudi/pull/10119#issuecomment-1814294050

   cc @hehuiyuan and @danny0405 


-- 
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-unsubscr...@hudi.apache.org

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



[PR] [HUDI-7109] Fix Flink may re-use a committed instant in append mode [hudi]

2023-11-16 Thread via GitHub


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

   ### Change Logs
   If Flink is crashed after instant committed but before 
`this.ckpMetadata.commitInstant(instant);`
   
   Re-start, Flink may re-use a committed instant in append mode.
   
   Will check candidate re-used instant is committed or not
   if committed, Hoodie would abort current instant.
   
   ### Impact
   
   Flink append mode.
   
   ### Risk level (write none, low medium or high below)
low
   
   Committed instant 20231114121907373 is re-used in next writing loop.
   related logs 
   ```
   2023-11-14 12:20:04.791 INFO  [Sink: hoodie_append_:5/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init write metadata 
state : WriteMetadataEvent{writeStatusesSize=1, taskID=524, 
instantTime='20231114121907373', lastBatch=false, endInput=false, 
bootstrap=true} & 
   2023-11-14 12:20:04.792 INFO  [Sink: hoodie_append_:7/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init write metadata 
state : WriteMetadataEvent{writeStatusesSize=1, taskID=536, 
instantTime='20231114121907373', lastBatch=false, endInput=false, 
bootstrap=true} & 
   2023-11-14 12:20:04.792 INFO  [Sink: hoodie_append_:2/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init write metadata 
state : WriteMetadataEvent{writeStatusesSize=1, taskID=121, 
instantTime='20231114121907373', lastBatch=false, endInput=false, 
bootstrap=true} & 
   2023-11-14 12:20:04.792 INFO  [Sink: hoodie_append_:7/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init write metadata 
state : WriteMetadataEvent{writeStatusesSize=1, taskID=676, 
instantTime='20231114121907373', lastBatch=false, endInput=false, 
bootstrap=true} & 
   2023-11-14 12:20:04.792 INFO  [Sink: hoodie_append_:6/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init write metadata 
state : WriteMetadataEvent{writeStatusesSize=1, taskID=335, 
instantTime='20231114121907373', lastBatch=false, endInput=false, 
bootstrap=true} & 
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:5/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init state 
currentInstant = 20231114121907373
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:7/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init state 
currentInstant = 20231114121907373
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:6/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init state 
currentInstant = 20231114121907373
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:7/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init state 
currentInstant = 20231114121907373
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:2/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Init state 
currentInstant = 20231114121907373
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:7/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Restore write metadata
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:6/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Restore write metadata
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:7/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Restore write metadata
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:5/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Restore write metadata
   2023-11-14 12:20:04.835 INFO  [Sink: hoodie_append_:2/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Restore write metadata
   2023-11-14 12:20:04.888 INFO  [Sink: hoodie_append_:7/750)#114] 
org.apache.hudi.common.table.timeline.HoodieActiveTimeline - Loaded instants 
upto : Option{val=[20231114121907373__commit__COMPLETED]}
   2023-11-14 12:20:04.888 INFO  [Sink: hoodie_append_:5/750)#114] 
org.apache.hudi.common.table.timeline.HoodieActiveTimeline - Loaded instants 
upto : Option{val=[20231114121907373__commit__COMPLETED]}
   2023-11-14 12:20:04.888 INFO  [Sink: hoodie_append_:7/750)#114] 
org.apache.hudi.common.table.timeline.HoodieActiveTimeline - Loaded instants 
upto : Option{val=[20231114121907373__commit__COMPLETED]}
   2023-11-14 12:20:04.888 INFO  [Sink: hoodie_append_:6/750)#114] 
org.apache.hudi.common.table.timeline.HoodieActiveTimeline - Loaded instants 
upto : Option{val=[20231114121907373__commit__COMPLETED]}
   2023-11-14 12:20:04.888 INFO  [Sink: hoodie_append_:2/750)#114] 
org.apache.hudi.common.table.timeline.HoodieActiveTimeline - Loaded instants 
upto : Option{val=[20231114121907373__commit__COMPLETED]}
   2023-11-14 12:20:04.889 INFO  [Sink: hoodie_append_:7/750)#114] 
org.apache.hudi.sink.common.AbstractStreamWriteFunction - Send bootstrap event 
when restore write metadata
   2023-11-14 12:20:04.890 INFO  [Sink: hoodie_append_:5/750)#114]