[Enhancement][Refactor] Refactor MergeCommitTask lifecycle and add cancellation support#67425
Merged
meegoo merged 8 commits intoStarRocks:mainfrom Jan 14, 2026
Merged
Conversation
e77efb9 to
1eb0f25
Compare
Contributor
|
@cursor review |
6bb2ade to
f623b35
Compare
Contributor
|
@cursor review |
f623b35 to
52b59e5
Compare
Contributor
|
@cursor review |
fe/fe-core/src/main/java/com/starrocks/load/batchwrite/MergeCommitTask.java
Show resolved
Hide resolved
52b59e5 to
f1d96f7
Compare
Contributor
|
@cursor review |
f1d96f7 to
1e29731
Compare
Contributor
|
@cursor review |
6ac4178 to
5ac5d42
Compare
Contributor
|
@cursor review |
fe/fe-core/src/main/java/com/starrocks/load/batchwrite/MergeCommitTask.java
Show resolved
Hide resolved
5ac5d42 to
38392c2
Compare
Contributor
|
@cursor review |
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
38392c2 to
8f6a710
Compare
|
Contributor
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Contributor
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Contributor
[FE Incremental Coverage Report]✅ pass : 345 / 369 (93.50%) file detail
|
Contributor
|
@cursor review |
wyb
approved these changes
Jan 14, 2026
meegoo
approved these changes
Jan 14, 2026
banmoy
added a commit
to banmoy/starrocks
that referenced
this pull request
Jan 14, 2026
…ncellation support (StarRocks#67425) Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
24 tasks
farhad-celo
pushed a commit
to farhad-celo/starrocks
that referenced
this pull request
Jan 20, 2026
…ncellation support (StarRocks#67425) Signed-off-by: PengFei Li <lpengfei2016@gmail.com> Signed-off-by: Farhad Shahmohammadi <f.shahmohammadi@celonis.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Why I'm doing:
MergeCommitTasklifecycle logic was scattered, making state transitions and failure handling hard to reason about.CancelStreamLoadAction.What I'm doing:
MergeCommitTaskinto a state machine:TaskStateand a strictSTATE_TRANSITIONmap.taskState/taskStateMessage/cancelHandleratomically under a single lock.MergeCommitTask.cancel(reason)to transition toCANCELLED.LOADINGthat callsCoordinator.cancel(PPlanFragmentCancelReason.USER_CANCEL, reason).AbstractTxnStateChangeCallback; external aborts triggerafterAborted()->cancel()to unify termination behavior. ThenCancelStreamLoadActioncan workupdateMetrics()and align success/failure with the final task state.Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check:
Note
Modernizes merge-commit load execution for reliability, observability, and cancelability.
MergeCommitTaskinto a locked state machine (PENDING→BEGINNING_TXN→PLANNING→EXECUTING→COMMITTING→COMMITTED→FINISHED/CANCELLED/ABORTED), with atomic transitions and per-state cancel handling (exec stage callsCoordinator.cancel).AbstractTxnStateChangeCallbackso external aborts trigger task cancellation; centralizes metrics inupdateMetrics; enriches runtime profile viaTracers,ProfileManager, and detailed summary fields.VisibleStateWaiterfor publish wait; addsTimeoutWatcher.getLeftTimeoutMillis()to manage remaining budgets; enforces data quality viaDataQualityException.MergeCommitJob: resolves DB ID before creating tasks, passestaskId/dbId/warehouseName/backendIds, and usescontainsBackend; improves error when DB missing.merge-commit;StreamLoadKvParams.toString()simplified.test_merge_commit_cancel.Written by Cursor Bugbot for commit 8f6a710. This will update automatically on new commits. Configure here.