-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[opt](fe) modify TabletInvertedIndex to local and cloud to reduce memory #59683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the TabletInvertedIndex class to reduce memory usage in cloud mode by splitting it into two implementations: LocalTabletInvertedIndex for local deployments and CloudTabletInvertedIndex for cloud deployments. The key memory optimization is that CloudTabletInvertedIndex stores only one replica per tablet (using a simple Map) instead of tracking multiple replicas per backend (using a Table), since cloud mode doesn't need backend-specific replica tracking.
Key Changes
- Converted
TabletInvertedIndexto an abstract base class with abstract methods for replica management - Created
LocalTabletInvertedIndexwith the original implementation supporting multiple replicas per tablet with backend associations - Created
CloudTabletInvertedIndexwith a simplified implementation storing one replica per tablet without backend tracking - Added factory methods to
EnvFactoryandCloudEnvFactoryto instantiate the appropriate implementation based on deployment mode
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| TabletInvertedIndex.java | Converted to abstract class, removed concrete replica management logic, made several methods throw UnsupportedOperationException for cloud mode |
| LocalTabletInvertedIndex.java | New class containing the original TabletInvertedIndex implementation for local deployments with full backend-aware replica tracking |
| CloudTabletInvertedIndex.java | New lightweight class for cloud mode storing one replica per tablet without backend associations |
| EnvFactory.java | Added createTabletInvertedIndex() factory method returning LocalTabletInvertedIndex |
| CloudEnvFactory.java | Added createTabletInvertedIndex() factory method returning CloudTabletInvertedIndex |
| Env.java | Updated to use factory method instead of direct instantiation |
| Test files (8 files) | Updated to use LocalTabletInvertedIndex instead of direct TabletInvertedIndex instantiation |
| ClusterLoadStatisticsTest.java | Incorrectly changed to use CloudTabletInvertedIndex |
Comments suppressed due to low confidence (1)
fe/fe-core/src/test/java/org/apache/doris/clone/ClusterLoadStatisticsTest.java:165
- This test is using CloudTabletInvertedIndex but adding multiple replicas per tablet (lines 155-157, 160-161, 164-165). CloudTabletInvertedIndex is designed to store only one replica per tablet (using Map instead of Table), so calling addReplica multiple times for the same tablet will overwrite previous replicas. This test should be using LocalTabletInvertedIndex instead, or the test needs to be updated to match cloud mode semantics where there's only one replica per tablet.
invertedIndex = new CloudTabletInvertedIndex();
invertedIndex.addTablet(50000, new TabletMeta(1, 2, 3, 4, 5, TStorageMedium.HDD));
invertedIndex.addReplica(50000, new LocalReplica(50001, be1.getId(), 0, ReplicaState.NORMAL));
invertedIndex.addReplica(50000, new LocalReplica(50002, be2.getId(), 0, ReplicaState.NORMAL));
invertedIndex.addReplica(50000, new LocalReplica(50003, be3.getId(), 0, ReplicaState.NORMAL));
invertedIndex.addTablet(60000, new TabletMeta(1, 2, 3, 4, 5, TStorageMedium.HDD));
invertedIndex.addReplica(60000, new LocalReplica(60002, be2.getId(), 0, ReplicaState.NORMAL));
invertedIndex.addReplica(60000, new LocalReplica(60003, be3.getId(), 0, ReplicaState.NORMAL));
invertedIndex.addTablet(70000, new TabletMeta(1, 2, 3, 4, 5, TStorageMedium.HDD));
invertedIndex.addReplica(70000, new LocalReplica(70002, be2.getId(), 0, ReplicaState.NORMAL));
invertedIndex.addReplica(70000, new LocalReplica(70003, be3.getId(), 0, ReplicaState.NORMAL));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fe/fe-core/src/main/java/org/apache/doris/catalog/LocalTabletInvertedIndex.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/catalog/LocalTabletInvertedIndex.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletInvertedIndex.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletInvertedIndex.java
Show resolved
Hide resolved
acd9b13 to
85e8126
Compare
|
run buildall |
TPC-H: Total hot run time: 31967 ms |
TPC-DS: Total hot run time: 172330 ms |
|
run cloud_p0 |
FE Regression Coverage ReportIncrement line coverage |
85e8126 to
776f407
Compare
|
run buildall |
deardeng
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
PR approved by anyone and no changes requested. |
TPC-H: Total hot run time: 31474 ms |
TPC-DS: Total hot run time: 172711 ms |
dataroaring
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
PR approved by at least one committer and no changes requested. |
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)