Skip to content

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

Open
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-66448-branch-4.0
Open

branch-4.0: [fix](storage) Reject prepare txn on shutdown tablet #66448#66456
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-66448-branch-4.0

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 5, 2026

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.
@github-actions
github-actions Bot requested a review from morningman as a code owner August 5, 2026 02:38
@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 Regression && UT Coverage Report

Increment line coverage 100.00% (1/1) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.61% (25661/35836)
Line Coverage 54.51% (272514/499957)
Region Coverage 52.05% (225782/433786)
Branch Coverage 53.47% (97182/181759)

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.

2 participants