Yukang-Lian opened a new pull request, #61374:
URL: https://github.com/apache/doris/pull/61374
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Currently, compaction execution metrics (input/output data sizes, row
counts, merge latency, etc.) are lost once the compaction object is destructed.
Operators have no way to inspect
historical compaction performance through the web interface — only the
current running status is available.
This PR introduces a compaction profile history feature that allows
operators to query detailed execution metrics of recent compactions via `GET
/api/compaction/profile`, enabling
performance diagnosis and bottleneck identification without parsing BE
logs.
**Example** — `GET /api/compaction/profile?tablet_id=12345&top_n=1`:
```json
{
"status": "Success",
"compaction_profiles": [
{
"compaction_id": 487,
"compaction_type": "cumulative",
"tablet_id": 12345,
"start_time": "2025-07-15 14:02:31",
"end_time": "2025-07-15 14:02:31",
"cost_time_ms": 236,
"success": true,
"input_rowsets_data_size": 10706329,
"input_rowsets_count": 5,
"input_row_num": 52000,
"input_segments_num": 5,
"input_rowsets_index_size": 204800,
"input_rowsets_total_size": 10911129,
"merged_rows": 1200,
"filtered_rows": 50,
"output_rows": 50750,
"output_rowset_data_size": 5033164,
"output_row_num": 50750,
"output_segments_num": 1,
"output_rowset_index_size": 102400,
"output_rowset_total_size": 5135564,
"merge_rowsets_latency_ms": 180,
"bytes_read_from_local": 10911129,
"bytes_read_from_remote": 0,
"output_version": "[12-16]"
}
]
}
```
Features:
- Filter by tablet_id to inspect compaction history of a specific tablet
- Use top_n to limit results to the N most recent records
- Failed compactions include status_msg for diagnosis, and output metrics
are preserved even on failure (e.g., checksum mismatch) since they are the most
valuable for debugging
- Dynamically adjust compaction_profile_max_records at runtime to control
memory usage (default 500 records, ~150KB), or set to 0 to disable
- All compaction paths are tracked: local
(base/cumulative/full/cold_data), cloud (base/cumulative/full/index_change),
and single-replica
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]