Skip to content

branch-4.1: [fix](transaction) avoid aborting newer same-label transactions #64939#65275

Merged
yiguolei merged 1 commit into
branch-4.1from
auto-pick-64939-branch-4.1
Jul 7, 2026
Merged

branch-4.1: [fix](transaction) avoid aborting newer same-label transactions #64939#65275
yiguolei merged 1 commit into
branch-4.1from
auto-pick-64939-branch-4.1

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked from #64939

### What problem does this PR solve?

In cloud mode, `CloudMetaMgr::abort_txn` currently prefers `db_id +
label` over `txn_id` when building `AbortTxnRequest`.

For stream load rollback, the context usually contains both `txn_id` and
`label`. If an old stream load attempt is aborted externally but its
BE-side execution is still cleaning up later, its rollback may abort by
label instead of by the original txn id.

When the upstream retries with the same label, this label-based rollback
can match and abort a newer running transaction with the same label,
causing the new attempt to fail with:
```
txn is not in 1 state, txn_status=4
```

### Solution
Prefer txn_id when aborting a cloud stream load transaction. Fall back
to db_id + label only when txn_id is not available.
This makes rollback cleanup target the exact failed transaction, instead
of affecting another transaction that happens to use the same label.
@github-actions github-actions Bot requested a review from yiguolei as a code owner July 6, 2026 12:44
@hello-stephen

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?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 54.82% (20967/38250)
Line Coverage 38.23% (200061/523321)
Region Coverage 34.67% (156938/452659)
Branch Coverage 35.64% (68556/192337)

@yiguolei yiguolei merged commit e8d22e4 into branch-4.1 Jul 7, 2026
28 of 31 checks passed
@morningman morningman deleted the auto-pick-64939-branch-4.1 branch July 8, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants