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 #47198

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
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,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 @@ -1686,6 +1686,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 @@ -1704,6 +1705,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