Skip to content
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

[Enhancement] Optimize performance of get physical partition from olap table (backport #47198) #49613

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,7 @@ public Partition resetPartitionForRestore(OlapTable localTbl, OlapTable remoteTb
physicalPartition.setIdForRestore(newPhysicalPartId);
physicalPartition.setParentId(newPartId);
remotePart.addSubPartition(physicalPartition);
remoteTbl.addPhysicalPartition(physicalPartition);
}
// save version info for creating replicas
long visibleVersion = physicalPartition.getVisibleVersion();
Expand Down
4 changes: 4 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/catalog/OlapTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,10 @@ public void addPartition(Partition partition) {
}
}

public void addPhysicalPartition(PhysicalPartition physicalPartition) {
physicalPartitionIdToPartitionId.put(physicalPartition.getId(), physicalPartition.getParentId());
}

// This is a private method.
// Call public "dropPartitionAndReserveTablet" and "dropPartition"
private void dropPartition(long dbId, String partitionName, boolean isForceDrop, boolean reserveTablets) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1623,6 +1623,7 @@ public void addSubPartitions(Database db, OlapTable table, Partition partition,
for (PhysicalPartition subPartition : subPartitions) {
// add sub partition
partition.addSubPartition(subPartition);
olapTable.addPhysicalPartition(subPartition);
}

// add partition log
Expand All @@ -1641,6 +1642,7 @@ public void replayAddSubPartition(PhysicalPartitionPersistInfoV2 info) throws Dd
Partition partition = olapTable.getPartition(info.getPartitionId());
PhysicalPartition physicalPartition = info.getPhysicalPartition();
partition.addSubPartition(physicalPartition);
olapTable.addPhysicalPartition(physicalPartition);

if (!isCheckpointThread()) {
// add to inverted index
Expand Down
Loading