skywalker0618 opened a new pull request, #20148:
URL: https://github.com/apache/hudi/pull/20148
### Describe the issue this Pull Request addresses
`StreamWriteOperatorCoordinator` runs Hive sync on its own
`NonThrownExecutor` after each checkpoint
commit, and synchronously after the commit that ends a bounded input. The
executor only logs a
failure, so a table that has stopped syncing to the metastore leaves no
trace outside the JobManager
log: the job keeps running and committing, and nothing in its metrics says
the table has fallen
behind in Hive.
### Summary and Changelog
Flink jobs with Hive sync enabled now report sync health through the job's
own metrics, next to the
existing write, compaction and index metrics.
- New `FlinkHiveSyncMetrics` (extends `HoodieFlinkMetrics`), registered on
the coordinator's
`OperatorCoordinator.Context#metricGroup()` in `initHiveSync()`, so only
jobs with Hive sync
enabled get it:
- `hiveSyncSuccessCount` and `hiveSyncFailureCount`: counters.
- `hiveSyncDurationMs`: histogram over the last 100 syncs, failed ones
included, since a sync that
fails after retrying an unreachable metastore is the slow case worth
seeing.
- `hiveSyncLastSuccessTimeMs`: gauge holding the wall-clock time of the
last completed sync in
epoch milliseconds, 0 until the first one.
- `doSyncHive()` times each sync and records the outcome. A failure is
recorded and rethrown
unchanged, so the existing handling (logging by the executor, or the
caller in batch mode) is
unaffected. A failure closing the sync tool counts as a failed sync.
- A sync can run on either the Hive sync executor or the coordinator's event
executor, so the
counters are `ThreadSafeSimpleCounter`, the histogram is backed by a
synchronized Dropwizard
reservoir, and the gauge reads a volatile field.
The metrics are reported under the coordinator scope of the write operator,
with no subtask index,
as the sync runs once per commit on the JobManager.
### Impact
No config or public API change. Jobs with `hive_sync.enabled=true` report
four new metrics under
the write operator's coordinator scope.
### Risk Level
low
The only behavioural change to the sync path is timing and counting around
the existing call. Built
against Flink 1.18 and 2.2; checkstyle passes.
### 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
- [ ] 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]