Skip to content

branch-4.1: [fix](cloud) Add SC_COMPACTION_CONFLICT error code to retry cross-V1 compaction failures #62272 - #62643

Merged
yiguolei merged 1 commit into
branch-4.1from
auto-pick-62272-branch-4.1
Apr 22, 2026
Merged

branch-4.1: [fix](cloud) Add SC_COMPACTION_CONFLICT error code to retry cross-V1 compaction failures #62272#62643
yiguolei merged 1 commit into
branch-4.1from
auto-pick-62272-branch-4.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #62272

…compaction failures (#62272)
## Summary
- Add dedicated `SC_COMPACTION_CONFLICT(101)` TStatusCode for the
cross-V1 compaction detection in cloud schema change
- Include this error code in FE's schema change retry whitelist
(`AlterJobV2.getRetryTimes()`)
- Previously, this transient condition returned `INTERNAL_ERROR` which
FE does not retry, causing the schema change job to be permanently
cancelled
## Background
The cloud SC compaction optimization allows new tablets to do compaction
during schema change queue wait. A safety check detects when a
compaction rowset crosses the alter_version (V1) boundary. This is a
transient condition - on retry, V1 will be higher and the crossing
rowset falls within `[2, V1']`.
The bug was that FE treated `INTERNAL_ERROR` as a permanent failure (no
retry), so this transient condition caused the entire schema change to
be cancelled.
## Changes
| File | Change |
|------|--------|
| `gensrc/thrift/Status.thrift` | Add `SC_COMPACTION_CONFLICT = 101` |
| `be/src/common/status.h` | Register
`TStatusError(SC_COMPACTION_CONFLICT, false)` |
| `be/src/cloud/cloud_schema_change_job.cpp` | Cross-V1 check:
`INTERNAL_ERROR` → `SC_COMPACTION_CONFLICT` |
| `fe/.../alter/AlterJobV2.java` | Add `SC_COMPACTION_CONFLICT` to retry
whitelist |
| `fe/.../alter/AlterJobV2RetryTest.java` | Unit tests for
`getRetryTimes()` (7 cases) |
| `regression-test/.../test_sc_compaction_cross_v1_retry.groovy` | E2E
test: cross-V1 failure → retry → success |
## Test plan
- [x] FE unit test: `AlterJobV2RetryTest` - verifies retry whitelist for
all error codes, null handling, and config toggle
- [x] Regression test: `test_sc_compaction_cross_v1_retry` - uses debug
points to trigger cross-V1, verifies SC stays RUNNING under override,
then succeeds after override removal. Asserts data integrity and schema
correctness.
@Thearas

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@Thearas

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage78.47% (1797/2290)
Line Coverage64.14% (32283/50334)
Region Coverage65.08% (16240/24952)
Branch Coverage55.63% (8683/15608)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (2/2) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (23/23) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage53.18% (19951/37513)
Line Coverage36.67% (187930/512456)
Region Coverage33.04% (146226/442557)
Branch Coverage34.10% (63911/187398)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/2) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (23/23) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.51% (26259/36720)
Line Coverage54.39% (277776/510739)
Region Coverage51.76% (231126/446494)
Branch Coverage53.10% (99790/187920)

@yiguolei

Copy link
Copy Markdown
Contributor

skip buildall

@yiguolei
yiguolei merged commit 136f04e into branch-4.1Apr 22, 2026
32 of 34 checks passed
@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Apr 22, 2026
@github-actions

Copy link
Copy Markdown
ContributorAuthor

PR approved by at least one committer and no changes requested.

@github-actions

Copy link
Copy Markdown
ContributorAuthor

PR approved by anyone and no changes requested.

@morningman
morningman deleted the auto-pick-62272-branch-4.1 branch July 8, 2026 14:09
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@Thearas@hello-stephen@yiguolei@dataroaring@Yukang-Lian