boneanxs opened a new pull request, #9922:
URL: https://github.com/apache/hudi/pull/9922
### Change Logs
_Describe context and summary for this change. Highlight if any code was
copied._
1. `HoodieWriteHandle` needs to stop immediately if task is failed
2. `TaskContextSupplier` adds a status to identify whether the task is
failed.
3. Clean files at task side if it fails
When `Executor` tries to kill a task, spark will set the `TaskContext` as
interrupted and interrupt the task thread.
Spark internally holds an `InterruptibleIterator` to monitor task status and
kill task if it's interrupted, but we can usually see e.g. `HoodieMergeHandle`
still keep writing data even if executor already tries to kill it(see below).
The reason is that during `init` in `HoodieMergeHandle`, it will first iterator
`InterruptibleIterator` and build `keyToNewRecords`, if the kill status is
coming after the `init` method, then `HoodieMergeHandle` might still write new
records.
```java
23/03/23 02:28:45 INFO HoodieMergeHandle: MaxMemoryPerPartitionMerge =>
1073741824
23/03/23 02:28:46 INFO Executor: Executor is trying to kill task 2.1 in
stage 11.0 (TID 1471), reason: another attempt succeeded
23/03/23 02:28:46 INFO Executor: Executor is trying to kill task 2.1 in
stage 11.0 (TID 1471), reason: Stage finished
23/03/23 02:28:47 INFO HoodieMergeHandle: Number of entries in
MemoryBasedMap => 0, Total size in bytes of MemoryBasedMap => 0, Number of
entries in BitCaskDiskMap => 0, Size of file spilled to disk => 0
23/03/23 02:28:47 INFO HoodieMergeHandle: partitionPath:grass_region=test,
fileId to be merged:d3ee8406-4011-44a4-8913-8be0349a6686-0
```
Btw, though in `BaseHoodieQueueBasedExecutor.execute` hudi could exit
immediately if the task thread is interrupted, but in
`BaseHoodieQueueBasedExecutor.awaitTermination`, hudi will clean `interrupt`
exception and wait extra `60` sec to let the executor to proceed. So the task
will wait at least 60s when it's been killed. We need to avoid that.
### Impact
_Describe any public API or user-facing feature change or any performance
impact._
None
### Risk level (write none, low medium or high below)
_If medium or high, explain what verification was done to mitigate the
risks._
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]