Yukang-Lian opened a new pull request, #61089:
URL: https://github.com/apache/doris/pull/61089
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
## Summary
In cloud mode, schema change (SC) tasks for multi-tablet tables are
submitted to a thread pool with limited workers. Tablets waiting in the queue
cannot do compaction because their `alter_version` is unset (-1), which causes
rowset
accumulation during long queue waits.
This PR sets `alter_version = V0` (from FE request) on new tablets at task
pre-submit time (before enqueue), so that queued new tablets can perform
cumulative compaction on double-write data (versions > V0) while waiting.
## Changes
**BE only — no FE or meta-service changes.**
- `task_worker_pool.h/cpp`: Add `pre_submit_callback` to `TaskWorkerPool`,
invoked synchronously before task enters the thread pool queue.
- `task_worker_pool.cpp`: Implement `set_alter_version_before_enqueue()` —
sets `alter_version = V0` on both base and new tablets before enqueue. Add
unconditional `alter_version` cleanup in `alter_cloud_tablet_callback()`.
- `agent_server.cpp`: Wire up `set_alter_version_before_enqueue` as
pre_submit_callback for the ALTER worker pool.
## Key Design Points
- **V0** (partition visible version from FE) is set at pre-submit time to
enable compaction during queue wait.
- **V1** (base_max_version) is still determined at SC execution time for
rowset conversion alignment — unchanged behavior.
- SC commit atomically replaces rowsets [2, V1] on the new tablet, so any
compaction results in (V0, V1] during queue time are harmlessly discarded.
- Cleanup order: `alter_version` is reset to -1 before `remove_task_info`
to prevent race with same-signature re-submission.
### 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]