Skip to content

branch-4.1: [fix](storage) Reject prepare txn on shutdown tablet #66448 - #66457

Merged
yiguolei merged 1 commit into
branch-4.1from
auto-pick-66448-branch-4.1
Aug 6, 2026
Merged

branch-4.1: [fix](storage) Reject prepare txn on shutdown tablet #66448#66457
yiguolei merged 1 commit into
branch-4.1from
auto-pick-66448-branch-4.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #66448

Cause:
PR #54124 moved the migration and push locks from RowsetBuilder into
Tablet::prepare_txn. During that refactor, the call to
TxnManager::prepare_txn changed from the const Tablet& overload to the
raw tablet_id/tablet_uid overload. This silently bypassed the
TABLET_SHUTDOWN guard introduced by PR #42296.
Impact:
A load thread holding an old Tablet instance could resume after
migration and register the stale tablet UID in the transaction map.
Publish would then operate on the reloaded Tablet with a new UID and
leave the transaction in an E-909 state.
Fix:
Call the const Tablet& overload with *this while the migration and push
locks are held. This preserves the lock encapsulation from PR #54124 and
restores the shutdown-tablet protection from PR #42296.
Test:
Add a deterministic unit test that marks a Tablet as TABLET_SHUTDOWN,
verifies Tablet::prepare_txn fails, and verifies no stale tablet entry
is registered. TxnManagerTest.* passes 16/16.
@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% (1/1) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage58.33% (24596/42166)
Line Coverage42.49% (247064/581435)
Region Coverage38.60% (195266/505875)
Branch Coverage39.91% (89209/223521)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.57% (30294/41178)
Line Coverage57.50% (332477/578224)
Region Coverage54.32% (276385/508774)
Branch Coverage55.31% (123691/223624)

@yiguolei

Copy link
Copy Markdown
Contributor

skip buildall

@yiguolei
yiguolei merged commit 7d24308 into branch-4.1Aug 6, 2026
32 of 34 checks passed
@morrySnow
morrySnow deleted the auto-pick-66448-branch-4.1 branch August 20, 2026 03:59
Sign up for freeto 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

@hello-stephen@yiguolei@deardeng