cshuo opened a new pull request, #20118:
URL: https://github.com/apache/hudi/pull/20118
### Describe the issue this Pull Request addresses
Closes #20117.
When native MOR logs contain both data and delete writers, a failure while
closing the data writer or reading its file-format metadata skips delete writer
closure and state cleanup. A delete writer close failure also leaves stale
state behind.
### Summary and Changelog
- Ensure `HoodieNativeLogFormatWriter` attempts both writer closes, using
`CloseableUtils.closeSuppressing()` to preserve the first failure and attach
subsequent close failures.
- Clear each writer reference and its record positions in `finally`, after
attempting that writer's close.
- Add 16 regression cases covering `close()` and `flushAppend()`, close and
metadata failures, suppressed exceptions, repeated close calls, and
record-position cleanup.
Validation: `TestHoodieNativeLogFormatWriter` passes all 28 tests, with no
failures, errors, or skips. Checkstyle passes.
```bash
mvn -pl hudi-client/hudi-client-common -am \
-Dtest=TestHoodieNativeLogFormatWriter \
-Dsurefire.failIfNoSpecifiedTests=false \
-DskipITs -DskipSparkTests -DskipScalaTests test
```
### Impact
Native log writers release resources and clear pending state even when close
or metadata retrieval fails. The original exception is retained, and repeated
close calls do not retry already-attempted writers. No public API or
configuration changes.
### Risk Level
Low. The change is limited to native log writer cleanup and exception
handling. Targeted tests cover both entry points and verify that subsequent
appends do not inherit stale record positions.
### Documentation Update
None.
### Contributor's checklist
- [ ] Read through [contributor's
guide](https://hudi.apache.org/contribute/how-to-contribute)
- [x] Enough context is provided in the sections above
- [x] Adequate tests were added if applicable
--
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]