Uh oh!
There was an error while loading. Please reload this page.
[fix](balance) do not pick tablets whose data size is zero for BE balance - #66499
Conversation
…ance A backend's load score is capacityProportion * capCoeff + replicaNumProportion * (1 - capCoeff) A tablet whose replica data size is zero relocates nothing, so migrating it leaves the capacity term untouched while still improving the replica count term. LoadStatisticForTag.isMoreBalanced() therefore accepts the move even though not a single byte is copied. The disk usage difference that triggers a balance is measured as (totalCapacity - availableCapacity), so it also covers non-Doris files and plain disk size differences, which no tablet migration can ever remove. With zero sized tablets as the only available lever, the scheduler keeps shifting replica counts until the composite score converges, and the per partition replica distribution pays for it: a freshly created table that createTablets() spread round robin over 16 backends as 16/17 ends up as 12-18, while every backend still reports a MID load score. Skip such tablets in BE load balance, both when selecting candidates and again when the context is finally scheduled, since the two can be far apart in time and the size is refreshed in between. Zero also means the size has not been reported yet, because replica data size is not persisted in the FE image and stays zero after a restart until the next tablet stat update; balancing on an unknown size is guesswork, so skipping is right there as well. This is the same rule DiskRebalancer.completeSchedCtx() already applies to disk balance, and it is unconditional here too, including urgent balance: moving an empty replica frees no space on a filling disk either. Add TStat counterBalanceRejectByZeroDataSize for the scheduling time rejection, and report the number of tablets skipped during selection in the existing per round log instead of a counter, because after a restart every tablet of every high load backend hits that path on every round.
hello-stephen
commented
Aug 5, 2026
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
deardeng
commented
Aug 5, 2026
run buildall |
deardeng
commented
Aug 5, 2026
/review |
Codex automated review failed and did not complete. Error: All Codex review accounts are usage-limited; earliest retry is 2026-08-08T03:32:00Z. Please trigger /review again after that time. |
hello-stephen
commented
Aug 5, 2026
FE UT Coverage ReportIncrement line coverage |
hello-stephen
commented
Aug 5, 2026
TPC-H: Total hot run time: 28768 ms |
hello-stephen
commented
Aug 5, 2026
TPC-DS: Total hot run time: 165926 ms |
hello-stephen
commented
Aug 5, 2026
ClickBench: Total hot run time: 23.9 s |
hello-stephen
commented
Aug 5, 2026
FE Regression Coverage ReportIncrement line coverage |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
Uh oh!
There was an error while loading. Please reload this page.
…ance (#66499) A backend's load score is capacityProportion * capCoeff + replicaNumProportion * (1 - capCoeff) A tablet whose replica data size is zero relocates nothing, so migrating it leaves the capacity term untouched while still improving the replica count term. LoadStatisticForTag.isMoreBalanced() therefore accepts the move even though not a single byte is copied. The disk usage difference that triggers a balance is measured as (totalCapacity - availableCapacity), so it also covers non-Doris files and plain disk size differences, which no tablet migration can ever remove. With zero sized tablets as the only available lever, the scheduler keeps shifting replica counts until the composite score converges, and the per partition replica distribution pays for it: a freshly created table that createTablets() spread round robin over 16 backends as 16/17 ends up as 12-18, while every backend still reports a MID load score. Skip such tablets in BE load balance, both when selecting candidates and again when the context is finally scheduled, since the two can be far apart in time and the size is refreshed in between. Zero also means the size has not been reported yet, because replica data size is not persisted in the FE image and stays zero after a restart until the next tablet stat update; balancing on an unknown size is guesswork, so skipping is right there as well. This is the same rule DiskRebalancer.completeSchedCtx() already applies to disk balance, and it is unconditional here too, including urgent balance: moving an empty replica frees no space on a filling disk either. Add TStat counterBalanceRejectByZeroDataSize for the scheduling time rejection, and report the number of tablets skipped during selection in the existing per round log instead of a counter, because after a restart every tablet of every high load backend hits that path on every round.
…ance (#66499) A backend's load score is capacityProportion * capCoeff + replicaNumProportion * (1 - capCoeff) A tablet whose replica data size is zero relocates nothing, so migrating it leaves the capacity term untouched while still improving the replica count term. LoadStatisticForTag.isMoreBalanced() therefore accepts the move even though not a single byte is copied. The disk usage difference that triggers a balance is measured as (totalCapacity - availableCapacity), so it also covers non-Doris files and plain disk size differences, which no tablet migration can ever remove. With zero sized tablets as the only available lever, the scheduler keeps shifting replica counts until the composite score converges, and the per partition replica distribution pays for it: a freshly created table that createTablets() spread round robin over 16 backends as 16/17 ends up as 12-18, while every backend still reports a MID load score. Skip such tablets in BE load balance, both when selecting candidates and again when the context is finally scheduled, since the two can be far apart in time and the size is refreshed in between. Zero also means the size has not been reported yet, because replica data size is not persisted in the FE image and stays zero after a restart until the next tablet stat update; balancing on an unknown size is guesswork, so skipping is right there as well. This is the same rule DiskRebalancer.completeSchedCtx() already applies to disk balance, and it is unconditional here too, including urgent balance: moving an empty replica frees no space on a filling disk either. Add TStat counterBalanceRejectByZeroDataSize for the scheduling time rejection, and report the number of tablets skipped during selection in the existing per round log instead of a counter, because after a restart every tablet of every high load backend hits that path on every round.
…ance (apache#66499) A backend's load score is capacityProportion * capCoeff + replicaNumProportion * (1 - capCoeff) A tablet whose replica data size is zero relocates nothing, so migrating it leaves the capacity term untouched while still improving the replica count term. LoadStatisticForTag.isMoreBalanced() therefore accepts the move even though not a single byte is copied. The disk usage difference that triggers a balance is measured as (totalCapacity - availableCapacity), so it also covers non-Doris files and plain disk size differences, which no tablet migration can ever remove. With zero sized tablets as the only available lever, the scheduler keeps shifting replica counts until the composite score converges, and the per partition replica distribution pays for it: a freshly created table that createTablets() spread round robin over 16 backends as 16/17 ends up as 12-18, while every backend still reports a MID load score. Skip such tablets in BE load balance, both when selecting candidates and again when the context is finally scheduled, since the two can be far apart in time and the size is refreshed in between. Zero also means the size has not been reported yet, because replica data size is not persisted in the FE image and stays zero after a restart until the next tablet stat update; balancing on an unknown size is guesswork, so skipping is right there as well. This is the same rule DiskRebalancer.completeSchedCtx() already applies to disk balance, and it is unconditional here too, including urgent balance: moving an empty replica frees no space on a filling disk either. Add TStat counterBalanceRejectByZeroDataSize for the scheduling time rejection, and report the number of tablets skipped during selection in the existing per round log instead of a counter, because after a restart every tablet of every high load backend hits that path on every round.
…ance (#66499) A backend's load score is capacityProportion * capCoeff + replicaNumProportion * (1 - capCoeff) A tablet whose replica data size is zero relocates nothing, so migrating it leaves the capacity term untouched while still improving the replica count term. LoadStatisticForTag.isMoreBalanced() therefore accepts the move even though not a single byte is copied. The disk usage difference that triggers a balance is measured as (totalCapacity - availableCapacity), so it also covers non-Doris files and plain disk size differences, which no tablet migration can ever remove. With zero sized tablets as the only available lever, the scheduler keeps shifting replica counts until the composite score converges, and the per partition replica distribution pays for it: a freshly created table that createTablets() spread round robin over 16 backends as 16/17 ends up as 12-18, while every backend still reports a MID load score. Skip such tablets in BE load balance, both when selecting candidates and again when the context is finally scheduled, since the two can be far apart in time and the size is refreshed in between. Zero also means the size has not been reported yet, because replica data size is not persisted in the FE image and stays zero after a restart until the next tablet stat update; balancing on an unknown size is guesswork, so skipping is right there as well. This is the same rule DiskRebalancer.completeSchedCtx() already applies to disk balance, and it is unconditional here too, including urgent balance: moving an empty replica frees no space on a filling disk either. Add TStat counterBalanceRejectByZeroDataSize for the scheduling time rejection, and report the number of tablets skipped during selection in the existing per round log instead of a counter, because after a restart every tablet of every high load backend hits that path on every round.
A backend's load score is
A tablet whose replica data size is zero relocates nothing, so migrating it leaves the capacity term untouched while still improving the replica count term. LoadStatisticForTag.isMoreBalanced() therefore accepts the move even though not a single byte is copied.
The disk usage difference that triggers a balance is measured as (totalCapacity - availableCapacity), so it also covers non-Doris files and plain disk size differences, which no tablet migration can ever remove. With zero sized tablets as the only available lever, the scheduler keeps shifting replica counts until the composite score converges, and the per partition replica distribution pays for it: a freshly created table that createTablets() spread round robin over 16 backends as 16/17 ends up as 12-18, while every backend still reports a MID load score.
Skip such tablets in BE load balance, both when selecting candidates and again when the context is finally scheduled, since the two can be far apart in time and the size is refreshed in between. Zero also means the size has not been reported yet, because replica data size is not persisted in the FE image and stays zero after a restart until the next tablet stat update; balancing on an unknown size is guesswork, so skipping is right there as well.
This is the same rule DiskRebalancer.completeSchedCtx() already applies to disk balance, and it is unconditional here too, including urgent balance: moving an empty replica frees no space on a filling disk either.
Add TStat counterBalanceRejectByZeroDataSize for the scheduling time rejection, and report the number of tablets skipped during selection in the existing per round log instead of a counter, because after a restart every tablet of every high load backend hits that path on every round.
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)