Skip to content

branch-4.1: [fix](load) fix load_to_single_tablet routing for auto partition #64356#64455

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

branch-4.1: [fix](load) fix load_to_single_tablet routing for auto partition #64356#64455
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-64356-branch-4.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #64356

)

### What problem does this PR solve?

`load_tablet_idx` is used by random distribution routing. For normal
random
loads it can advance across batches, but for
`load_to_single_tablet=true` it
must remain fixed for the partition in the sink so all rows are routed
to one
tablet.

For normally planned partitions this is stable because FE builds the
sink plan
once and all BE sink instances receive the same `load_tablet_idx`.

For runtime auto partitions, each BE can independently call
`createPartition()`
or `replacePartition()` for the same txn and partition. Before this
patch, the
auto partition cache only stored tablet locations and did not store
`load_tablet_idx`. FE also did not know whether the caller was using
`load_to_single_tablet`, so runtime auto partitions could lose the
single-tablet
routing semantics or compute different tablet indexes across BE RPCs.

This patch passes `load_to_single_tablet` in create/replace partition
RPCs and
stores the selected `load_tablet_idx` in `AutoPartitionCacheManager`.
Later BE
RPCs for the same txn and partition reuse the cached tablet index
together with
the cached tablet locations. Ordinary random loads are unchanged.
@github-actions github-actions Bot requested a review from yiguolei as a code owner June 12, 2026 08:49
@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

FE UT Coverage Report

Increment line coverage 13.46% (7/52) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (2/2) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.81% (26591/37030)
Line Coverage 54.91% (282635/514686)
Region Coverage 52.43% (235768/449682)
Branch Coverage 53.64% (101936/190053)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 23.08% (12/52) 🎉
Increment coverage report
Complete coverage report

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