You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "nsivabalan (via GitHub)" <gi...@apache.org> on 2026/10/27 18:57:06 UTC
[PR] fix(client): do not block the writer on a running async table service when switching write clients [hudi]
nsivabalan opened a new pull request, #20444:
URL: https://github.com/apache/hudi/pull/20444
### Describe the issue this Pull Request addresses
#20415 made `AsyncCompactService#updateWriteClient` and `AsyncClusteringService#updateWriteClient` wait for the service's running compaction or clustering run: both the run and the client switch now hold the same monitor (`synchronized (compactor)` / `synchronized (clusteringClient)`) for the whole run.
The thread calling `updateWriteClient` is the writer's driver thread:
- **HoodieStreamer**: `StreamSync#reInitWriteClient` → `HoodieStreamer#onInitializingWriteClient`, on every write client re-creation (e.g. a source schema change).
- **Spark streaming sink**: `HoodieStreamingSink#retireWriteClient`, inside `addBatch` when the writer schema changes.
A compaction or clustering run is not bounded in time. On a busy cluster it routinely waits for executors, and large compactions/clusterings run for an hour or more. With the run-long lock, ingestion stops for that whole time: HoodieStreamer does not sync, and the streaming query's micro-batch does not complete (so the query's trigger, progress and checkpoint all stall). That is a regression of ingestion latency driven by an unrelated table service, and we cannot block the driver until a compaction completes.
Related: #20400, #20429.
### Summary and Changelog
- Restore the non-blocking `updateWriteClient` in `AsyncCompactService` and `AsyncClusteringService`: the switch only replaces the client used by later runs, and the run loop no longer holds a run-long lock.
- Make `BaseCompactor#compactionClient` and `BaseClusterer#clusteringClient` `volatile`, since the writer switches them while the service thread reads them. Both Spark implementations read the client once at the start of a run, so a run never mixes two clients.
- Replace `TestAsyncTableServiceClientHandoff#testHandoffWaitsForActiveRun` with `testHandoffDoesNotWaitForActiveRun`: while a compaction/clustering run is held, the switch returns immediately, the running run keeps the client it started with, and the next run uses the new client.
- Restore the original `HoodieStreamingSink#retireWriteClient` doc.
### Impact
Switching write clients never waits for a running async compaction or clustering, as before #20415.
As before #20415, the writer closes the previous client once it has switched the services, so a run that is still in progress on that client can fail. Handling that failure (rolling back and retrying the run with the new client, and reporting non-retryable failures to the writer with their cause) is tracked in #20429, which is reworked on top of this change.
### Risk Level
low. Restores the pre-#20415 behaviour of `updateWriteClient`; adds `volatile` to two fields.
### 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
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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
Re: [PR] fix(client): restore non-blocking write client switch for async table services [hudi]
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan merged PR #20444:
URL: https://github.com/apache/hudi/pull/20444
--
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
Re: [PR] fix(client): restore non-blocking write client switch for async table services [hudi]
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on PR #20444:
URL: https://github.com/apache/hudi/pull/20444#issuecomment-6486320605
@danny0405 for your review
--
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
Re: [PR] fix(client): restore non-blocking write client switch for async table services [hudi]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #20444:
URL: https://github.com/apache/hudi/pull/20444#issuecomment-6451875950
## [Codecov](https://app.codecov.io/gh/apache/hudi/pull/20444?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `4 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 80.82%. Comparing base ([`c0ed524`](https://app.codecov.io/gh/apache/hudi/commit/c0ed52483fb22e57c57a9c7b211b9bcb4919cf5b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`284886b`](https://app.codecov.io/gh/apache/hudi/commit/284886b1beb30d3dd584a26b2075e4b24fdf91fc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/hudi/pull/20444?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [.../org/apache/hudi/async/AsyncClusteringService.java](https://app.codecov.io/gh/apache/hudi/pull/20444?src=pr&el=tree&filepath=hudi-client%2Fhudi-client-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fhudi%2Fasync%2FAsyncClusteringService.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aHVkaS1jbGllbnQvaHVkaS1jbGllbnQtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9odWRpL2FzeW5jL0FzeW5jQ2x1c3RlcmluZ1NlcnZpY2UuamF2YQ==) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/hudi/pull/20444?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ava/org/apache/hudi/async/AsyncCompactService.java](https://app.codecov.io/gh/apache/hudi/pull/20444?src=pr&el=tree&filepath=hudi-client%2Fhudi-client-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fhudi%2Fasync%2FAsyncCompactService.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aHVkaS1jbGllbnQvaHVkaS1jbGllbnQtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9odWRpL2FzeW5jL0FzeW5jQ29tcGFjdFNlcnZpY2UuamF2YQ==) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/hudi/pull/20444?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #20444 +/- ##
============================================
- Coverage 80.83% 80.82% -0.01%
+ Complexity 36002 35999 -3
============================================
Files 2575 2575
Lines 147152 147144 -8
Branches 18085 18085
============================================
- Hits 118943 118927 -16
- Misses 20021 20027 +6
- Partials 8188 8190 +2
```
| [Components](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hudi-common](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `84.18% <ø> (-0.01%)` | :arrow_down: |
| [hudi-client](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `84.02% <0.00%> (-0.03%)` | :arrow_down: |
| [hudi-flink](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `86.16% <ø> (ø)` | |
| [hudi-spark-datasource](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `74.23% <ø> (ø)` | |
| [hudi-utilities](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `79.24% <ø> (ø)` | |
| [hudi-cli](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.80% <ø> (ø)` | |
| [hudi-hadoop](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `71.16% <ø> (ø)` | |
| [hudi-sync](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.22% <ø> (ø)` | |
| [hudi-io](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.57% <ø> (ø)` | |
| [hudi-timeline-service](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.41% <ø> (ø)` | |
| [hudi-cloud](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.01% <ø> (ø)` | |
| [hudi-kafka-connect](https://app.codecov.io/gh/apache/hudi/pull/20444/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.90% <ø> (ø)` | |
| [Flag](https://app.codecov.io/gh/apache/hudi/pull/20444/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hadoop-mr-java-client](https://app.codecov.io/gh/apache/hudi/pull/20444/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `43.95% <0.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Files with missing lines](https://app.codecov.io/gh/apache/hudi/pull/20444?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...main/java/org/apache/hudi/async/BaseClusterer.java](https://app.codecov.io/gh/apache/hudi/pull/20444?src=pr&el=tree&filepath=hudi-client%2Fhudi-client-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fhudi%2Fasync%2FBaseClusterer.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aHVkaS1jbGllbnQvaHVkaS1jbGllbnQtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9odWRpL2FzeW5jL0Jhc2VDbHVzdGVyZXIuamF2YQ==) | `100.00% <ø> (ø)` | |
| [...main/java/org/apache/hudi/async/BaseCompactor.java](https://app.codecov.io/gh/apache/hudi/pull/20444?src=pr&el=tree&filepath=hudi-client%2Fhudi-client-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fhudi%2Fasync%2FBaseCompactor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aHVkaS1jbGllbnQvaHVkaS1jbGllbnQtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9odWRpL2FzeW5jL0Jhc2VDb21wYWN0b3IuamF2YQ==) | `100.00% <ø> (ø)` | |
| [...in/scala/org/apache/hudi/HoodieStreamingSink.scala](https://app.codecov.io/gh/apache/hudi/pull/20444?src=pr&el=tree&filepath=hudi-spark-datasource%2Fhudi-spark-common%2Fsrc%2Fmain%2Fscala%2Forg%2Fapache%2Fhudi%2FHoodieStreamingSink.scala&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aHVkaS1zcGFyay1kYXRhc291cmNlL2h1ZGktc3BhcmstY29tbW9uL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvaHVkaS9Ib29kaWVTdHJlYW1pbmdTaW5rLnNjYWxh) | `70.66% <ø> (ø)` | |
| [.../org/apache/hudi/async/AsyncClusteringService.java](https://app.codecov.io/gh/apache/hudi/pull/20444?src=pr&el=tree&filepath=hudi-client%2Fhudi-client-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fhudi%2Fasync%2FAsyncClusteringService.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aHVkaS1jbGllbnQvaHVkaS1jbGllbnQtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9odWRpL2FzeW5jL0FzeW5jQ2x1c3RlcmluZ1NlcnZpY2UuamF2YQ==) | `83.78% <0.00%> (-6.47%)` | :arrow_down: |
| [...ava/org/apache/hudi/async/AsyncCompactService.java](https://app.codecov.io/gh/apache/hudi/pull/20444?src=pr&el=tree&filepath=hudi-client%2Fhudi-client-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fhudi%2Fasync%2FAsyncCompactService.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aHVkaS1jbGllbnQvaHVkaS1jbGllbnQtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9odWRpL2FzeW5jL0FzeW5jQ29tcGFjdFNlcnZpY2UuamF2YQ==) | `81.57% <0.00%> (-6.52%)` | :arrow_down: |
... and [2 files with indirect coverage changes](https://app.codecov.io/gh/apache/hudi/pull/20444/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</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