yujun777 opened a new pull request, #71378:
URL: https://github.com/apache/doris/pull/71378
### What problem does this PR solve?
Issue Number: None
Problem Summary:
Operators previously could not track per-MV cumulative incremental vs.
rebuild execution time or cumulative committed loaded rows across IVM refresh
tasks without querying task history or losing counters across FE
restarts/failovers.
### Details
This PR adds persisted per-MV refresh cost counters to `IvmRefreshSummary`
and exports them on Master FE `/metrics` through `ChangelogMonitor` /
`IvmRefreshSnapshotMetrics`:
1. **Per-phase execution timing and committed loaded rows (`MTMVTask`,
`IvmIncrRefreshManager`, `IvmIncrRefreshResult`)**:
- Time incremental execution (`executeSingleIvmAttempt`) and rebuild
execution (`executePartitionBasedRefresh`, covering `PARTITION_REBUILD`,
`COMPLETE`, dirty-partition rebuilds in `MIXED` tasks, and fallback rebuilds)
in `MTMVTask` and snapshot millisecond totals (`ivmIncrementalDurationMs` /
`iid`, `ivmRebuildDurationMs` / `ird`) in `MTMVTask.after()`.
- Capture committed target loaded rows
(`ctx.getState().getAffectedRows()`) after each successful incremental refresh
(`IvmIncrRefreshResult.getLoadedRows()`) and each committed partition/complete
overwrite batch (`PartitionRefreshBatchResult.loadedRows()`), snapshotting
`ivmRefreshRows` (`irw`) in `MTMVTask.after()` without counting uncommitted
retries.
- All new Gson fields default cleanly to `0` on legacy journal/image
records.
2. **Idempotent summary persistence (`IvmRefreshSummary`)**:
- Persist cumulative `totalIncrementalDurationMs` (`tid`),
`totalRebuildDurationMs` (`trd`), and `totalRefreshRows` (`trw`) in
`IvmRefreshSummary`, updated idempotently through the existing `ADD_TASK`
`ivmSummarySeq` path on Master execution, Follower replay, and FE
restart/failover (`CANCELED` tasks and replayed sequences are skipped).
3. **Prometheus & JSON export (`IvmRefreshSnapshotMetrics`)**:
- Export
`doris_fe_ivm_refresh_execution_seconds_total{db_name,mv_name,mv_id,mode}`
(`mode="incremental"` / `mode="rebuild"`) and
`doris_fe_ivm_refresh_rows_total{db_name,mv_name,mv_id}` grouped cleanly by
metric family, avoiding any Prometheus metric-name collision with the existing
cluster-level `doris_fe_ivm_refresh_duration_seconds_total{method}` counter.
### Release note
- Export per-MV Master FE Prometheus counters
`doris_fe_ivm_refresh_execution_seconds_total{db_name,mv_name,mv_id,mode}`
(`incremental` / `rebuild`) and
`doris_fe_ivm_refresh_rows_total{db_name,mv_name,mv_id}` for IVM materialized
views.
### Testing
Diff scope: 10 files (`5` production files, `5` test files: `4` FE UT
classes, `1` Groovy regression suite).
- **FE Checkstyle & FE UTs**: `mvn test -pl fe-core -am` across 6 classes
(53/53 tests PASS): `IvmRefreshSummaryTest`, `IvmRefreshSnapshotMetricsTest`,
`ChangelogMonitorTest`,
`MTMVTest#testIvmSummaryCountsOnlyNewResultsAcrossImageAndReplay`,
`AlterMTMVTest`, `IvmIncrRefreshManagerTest`.
- **FE build & local 1FE+1BE regression**: `./build.sh --fe` + 2/2
regression suites PASS (`test_ivm_refresh_cost_metrics`,
`test_ivm_refresh_method_metrics`).
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]