Uh oh!
There was an error while loading. Please reload this page.
[fix](fe) move some variables from Tablet to LocalTablet which are not used in CloudTablet - #59327
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Tablet class hierarchy by moving cooldown-related fields and methods from the base Tablet class to a new LocalTablet subclass. This separation ensures that CloudTablet instances don't carry unnecessary cooldown-related state that is only used in non-cloud deployments.
Key changes:
- Created new LocalTablet class extending Tablet with cooldown configuration management
- Removed cooldown fields and methods from base Tablet class
- Updated all cooldown-related code to cast to LocalTablet before accessing cooldown methods
- Modified serialization/deserialization to handle LocalTablet with backward compatibility
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| fe/fe-core/src/main/java/org/apache/doris/catalog/LocalTablet.java | New class that extends Tablet and contains cooldown-specific fields and methods previously in Tablet |
| fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java | Removed cooldown configuration fields and methods, simplified getRemoteDataSize() to return 0 |
| fe/fe-core/src/main/java/org/apache/doris/catalog/EnvFactory.java | Updated tablet factory methods to create LocalTablet instances instead of Tablet |
| fe/fe-core/src/main/java/org/apache/doris/persist/gson/GsonUtils.java | Updated serialization to register LocalTablet as subtype with backward compatibility for old "Tablet" class name |
| fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java | Added cast to LocalTablet when accessing getCooldownReplicaId() with Config.isNotCloudMode() guard |
| fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java | Added cast to LocalTablet when accessing getCooldownConf() |
| fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java | Added cast to LocalTablet when accessing getCooldownConf() in addReplica method |
| fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java | Added cast to LocalTablet in handleCooldownConf method |
| fe/fe-core/src/main/java/org/apache/doris/cooldown/CooldownConfHandler.java | Updated to cast Tablet to LocalTablet in multiple locations |
| fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java | Added instanceof check before casting to LocalTablet to safely access getCooldownConf() |
| fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java | Added instanceof check before casting to LocalTablet to safely access getCooldownConf() |
| fe/fe-core/src/test/java/org/apache/doris/cooldown/CooldownConfHandlerTest.java | Updated test to use LocalTablet type and cast appropriately |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mymeiyi
commented
Dec 24, 2025
run buildall |
doris-robot
commented
Dec 24, 2025
TPC-H: Total hot run time: 35290 ms |
doris-robot
commented
Dec 24, 2025
TPC-DS: Total hot run time: 176821 ms |
mymeiyi
commented
Dec 24, 2025
run buildall |
doris-robot
commented
Dec 24, 2025
TPC-H: Total hot run time: 35987 ms |
doris-robot
commented
Dec 24, 2025
TPC-DS: Total hot run time: 179744 ms |
doris-robot
commented
Dec 24, 2025
ClickBench: Total hot run time: 27.35 s |
hello-stephen
commented
Dec 24, 2025
FE UT Coverage ReportIncrement line coverage |
mymeiyi
commented
Dec 25, 2025
run cloud_p0 |
hello-stephen
commented
Dec 25, 2025
FE Regression Coverage ReportIncrement line coverage |
Uh oh!
There was an error while loading. Please reload this page.
mymeiyi
commented
Dec 26, 2025
run buildall |
doris-robot
commented
Dec 26, 2025
TPC-H: Total hot run time: 36377 ms |
doris-robot
commented
Dec 26, 2025
TPC-DS: Total hot run time: 178871 ms |
doris-robot
commented
Dec 26, 2025
ClickBench: Total hot run time: 27.07 s |
hello-stephen
commented
Dec 26, 2025
FE Regression Coverage ReportIncrement line coverage |
mymeiyi
commented
Dec 27, 2025
run buildall |
doris-robot
commented
Dec 27, 2025
TPC-H: Total hot run time: 34663 ms |
doris-robot
commented
Dec 27, 2025
TPC-DS: Total hot run time: 179312 ms |
doris-robot
commented
Dec 27, 2025
ClickBench: Total hot run time: 27.28 s |
hello-stephen
commented
Dec 27, 2025
FE UT Coverage ReportIncrement line coverage |
| // replica has cooldowned data | ||
| do { | ||
| Pair<Long, Long> cooldownConf = tablet.getCooldownConf(); | ||
| Pair<Long, Long> cooldownConf = ((LocalTablet) tablet).getCooldownConf(); |
There was a problem hiding this comment.
If we add a method getCooldownConf in Tablet and implement it in both LocalTablet and CloudTablet, is there extra memory footprint overhead for each tablet object?
mymeiyi
commented
Jan 6, 2026
run buildall |
doris-robot
commented
Jan 6, 2026
TPC-H: Total hot run time: 31326 ms |
doris-robot
commented
Jan 6, 2026
TPC-DS: Total hot run time: 172303 ms |
doris-robot
commented
Jan 6, 2026
ClickBench: Total hot run time: 26.96 s |
hello-stephen
commented
Jan 6, 2026
FE UT Coverage ReportIncrement line coverage |
hello-stephen
commented
Jan 6, 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. |
dataroaring
commented
Jan 6, 2026
Code Review: Senior Database Engineer PerspectiveOverall Verdict: LGTM with minor fixes ✅SummaryGood memory optimization PR. The design cleanly separates cooldown-related fields into Issues FoundMust Fix Before Merge1. Misplaced comment in // Line 66-67// if CooldownReplicaId is not init// [fix](fe) move some variables from Tablet to LocalTablet which are not used in CloudTabletThe second line appears to be a commit message accidentally left in the code. Should be removed. 2. Missing Should Consider3. Inconsistent exception vs default value pattern // Tablet.javapublicvoidsetCooldownConf(...) {
thrownewUnsupportedOperationException("not support setCooldownConf in Tablet");
}
publiclonggetCooldownReplicaId() {
return -1; // Returns default instead of throwing
}Setters throw exceptions but getters return defaults. This asymmetry could be confusing. Consider either:
4. Test coverage
Consider adding explicit unit tests for the refactored behavior. Positive Aspects ✅
RecommendationApprove after addressing the misplaced comment and adding the missing |
Uh oh!
There was an error while loading. Please reload this page.
### What problem does this PR solve? #59327 introduces `LocalTablet`, #59460 introduces `LocalReplica`. These 2 pr will merge into 4.1. This pr add compatible code for LocalTablet and LocalReplica to make 4.1 can downgrade to 4.0. Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
…t used in CloudTablet (apache#59327) ### What problem does this PR solve? ### Purpose 1. some fields are not used in cloud mode, but `CloudTablet` extends `Tablet` and inherits these fields, which consumes too much memory 2. this pr add `LocalTablet` subclass to keep these fields which are only used in local mode 3. this pr only move cooldown related fileds, more fileds will be moved later ### TestResult in a cloud cluster with one million tablets, the test results are as follows: ||before|after|| |--------|--------|--------|--------| |total memory of `CloudTablet`|<img width="1280" height="351" alt="1-1" src="https://github.com/user-attachments/assets/b20cb1dd-da76-420d-8093-53891bbd5063" />|<img width="1280" height="358" alt="2-1" src="https://github.com/user-attachments/assets/00791566-83b7-4605-b7ac-1e25d7274223" />| reduce 272.93 MB | |memory of one `CloudTablet`|<img width="1386" height="762" alt="1-2" src="https://github.com/user-attachments/assets/424a01eb-d276-463d-9a8d-ff3a9ed185b2" />|<img width="1396" height="692" alt="2-2" src="https://github.com/user-attachments/assets/2bedff14-7bcc-42ab-bf7b-d5a8f993b8dd" />|reduce 272 B| |fields of `CloudTablet`|<img width="1388" height="620" alt="1-3" src="https://github.com/user-attachments/assets/cbc7fca3-5e39-4a44-b1c2-1e21d8328769" />|<img width="1388" height="512" alt="2-3" src="https://github.com/user-attachments/assets/cfc094f9-46e1-4fc3-8f1d-37dad0d04a8a" />|| ### Compatibility ||old FE upgrade to new FE| new FE downgrade to old FE| |--------|--------|--------| |cloud mode| supported | supported| |local mode| supported | unsupported (need modify code in old FE to support it) | ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
### What problem does this PR solve? #59327 introduces `LocalTablet`, #59460 introduces `LocalReplica`. These 2 pr will merge into 4.1. This pr add compatible code for LocalTablet and LocalReplica to make 4.1 can downgrade to 4.0. Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
…e#59771) ### What problem does this PR solve? apache#59327 introduces `LocalTablet`, apache#59460 introduces `LocalReplica`. These 2 pr will merge into 4.1. This pr add compatible code for LocalTablet and LocalReplica to make 4.1 can downgrade to 4.0. Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
…e#59771) ### What problem does this PR solve? apache#59327 introduces `LocalTablet`, apache#59460 introduces `LocalReplica`. These 2 pr will merge into 4.1. This pr add compatible code for LocalTablet and LocalReplica to make 4.1 can downgrade to 4.0. Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
…t used in CloudTablet (apache#59327) 1. some fields are not used in cloud mode, but `CloudTablet` extends `Tablet` and inherits these fields, which consumes too much memory 2. this pr add `LocalTablet` subclass to keep these fields which are only used in local mode 3. this pr only move cooldown related fileds, more fileds will be moved later in a cloud cluster with one million tablets, the test results are as follows: ||before|after|| |--------|--------|--------|--------| |total memory of `CloudTablet`|<img width="1280" height="351" alt="1-1" src="https://github.com/user-attachments/assets/b20cb1dd-da76-420d-8093-53891bbd5063" />|<img width="1280" height="358" alt="2-1" src="https://github.com/user-attachments/assets/00791566-83b7-4605-b7ac-1e25d7274223" />| reduce 272.93 MB | |memory of one `CloudTablet`|<img width="1386" height="762" alt="1-2" src="https://github.com/user-attachments/assets/424a01eb-d276-463d-9a8d-ff3a9ed185b2" />|<img width="1396" height="692" alt="2-2" src="https://github.com/user-attachments/assets/2bedff14-7bcc-42ab-bf7b-d5a8f993b8dd" />|reduce 272 B| |fields of `CloudTablet`|<img width="1388" height="620" alt="1-3" src="https://github.com/user-attachments/assets/cbc7fca3-5e39-4a44-b1c2-1e21d8328769" />|<img width="1388" height="512" alt="2-3" src="https://github.com/user-attachments/assets/cfc094f9-46e1-4fc3-8f1d-37dad0d04a8a" />|| ||old FE upgrade to new FE| new FE downgrade to old FE| |--------|--------|--------| |cloud mode| supported | supported| |local mode| supported | unsupported (need modify code in old FE to support it) | None - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
What problem does this PR solve?
Purpose
CloudTabletextendsTabletand inherits these fields, which consumes too much memoryLocalTabletsubclass to keep these fields which are only used in local modeTestResult
in a cloud cluster with one million tablets, the test results are as follows:
CloudTabletCloudTabletCloudTabletCompatibility
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)