PDGGK opened a new pull request, #19778:
URL: https://github.com/apache/hudi/pull/19778
### Describe the issue this Pull Request addresses
`close()` on the write client releases several independent resources as a
bare sequence, so the first failure strands everything after it.
```java
// BaseHoodieClient:153
stopEmbeddedServerView(true);
this.context.setJobStatus("", "");
this.heartbeatClient.close();
this.txnManager.close();
// BaseHoodieWriteClient:1663
super.close();
this.index.close();
this.tableServiceClient.close();
```
The one that matters most is last in the base chain: `txnManager` owns the
write lock. If stopping the timeline server or closing the heartbeat client
throws, the lock provider is never released, and the next writer waits for it
to time out rather than getting a clean handover. The heartbeat client is in
the same position — it holds a scheduled executor and leaves heartbeat files
behind.
`BaseHoodieWriteClient` inherits the problem and adds to it: a failure in
`super.close()` also skips the index and the table service client.
### Summary and Changelog
Each step is now closed independently. The first failure is what the caller
sees, with any later ones attached via `addSuppressed` rather than dropped, so
nothing that used to surface stops surfacing.
Tests:
`TestBaseHoodieWriteClient#testCloseReleasesLaterResourcesWhenAnEarlierCloseFails`
injects an index whose `close()` throws and asserts the table service client
and the transaction manager are still closed, and that the original failure is
what propagates.
Reverting the change turns it red with `Wanted but not invoked:
tableServiceClient.close()`.
A note on how the test is shaped: an earlier version made the *last*
resource throw, which passed with and without the fix — everything before it
had already been released, so it proved nothing. The failure has to be injected
ahead of the resources whose release is being asserted.
`mvn test -pl hudi-client/hudi-client-common
-Dtest=TestBaseHoodieWriteClient#testCloseReleasesLaterResourcesWhenAnEarlierCloseFails`
passes; `checkstyle:check` clean. The full `TestBaseHoodieWriteClient` class
exhausts the heap on my machine both with and without this change, so I could
not run it end to end locally.
### Impact
No public API change. `close()` still throws the same failure it threw
before; it simply releases the remaining resources first.
### Risk Level
low
### Documentation Update
none
### Contributor's checklist
- [x] 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]