cshuo opened a new pull request, #19971:
URL: https://github.com/apache/hudi/pull/19971
### Describe the issue this Pull Request addresses
Closes #19947.
During Flink recovery, recommit can reach heartbeat validation before a
timed-out initial heartbeat write succeeds on a scheduled retry. If the file is
absent, commit fails with `last heartbeat 0`. This affects both data-table and
streaming metadata-table heartbeats.
### Summary and Changelog
- Add `HoodieHeartbeatClient.awaitHeartbeat()` with bounded waiting based on
the existing `lastHeartbeatTime`, made volatile for visibility across threads.
- Preserve `start()` semantics: initial write timeouts still defer to
scheduled retries. Waiting does not replace commit-time expiry checks.
- Start both required heartbeats before waiting in Flink recommit, sharing
the configured heartbeat expiry window between the two waits.
- Cover initial write timeouts, background recovery, wait timeout and
interruption, and both Flink heartbeat paths.
Validation: `TestHoodieHeartbeatClient` (10 tests) and
`TestFlinkWriteClient` (7 tests) passed with:
```shell
mvn -Pflink1.20 -pl hudi-client/hudi-flink-client -am \
-Dtest=TestHoodieHeartbeatClient,TestFlinkWriteClient \
-Dsurefire.failIfNoSpecifiedTests=false \
-DskipITs -DskipSparkTests -DskipScalaTests test
```
### Impact
Flink recommit waits for confirmed heartbeat writes before attempting commit
and reports an explicit timeout if they remain unavailable. Adds an optional
client API without new configuration. The shared waiting budget applies after
heartbeat startup.
### Risk Level
Low. Recovery can wait longer during storage delays, bounded by the existing
heartbeat interval and tolerable-misses settings. Regression tests exercise
timeout recovery and both heartbeat paths; existing heartbeat expiry validation
remains in place.
### Documentation Update
Added API Javadoc documenting readiness, timeout behavior, and the
requirement to retain commit-time expiry validation.
### 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]