dataroaring commented on code in PR #52935:
URL: https://github.com/apache/doris/pull/52935#discussion_r2194608717
##########
fe/fe-core/src/main/java/org/apache/doris/backup/BackupJob.java:
##########
@@ -813,6 +875,43 @@ private void waitingAllUploadingFinished() {
}
}
+ private void cleanupDroppedTablesAndPartitions() {
+ if (backupMeta == null) {
+ return;
+ }
+
+ // Remove dropped partitions first (before removing tables)
+ for (Map.Entry<Long, Set<Long>> entry :
droppedPartitionsByTable.entrySet()) {
+ Long tableId = entry.getKey();
+ Set<Long> droppedPartitionIds = entry.getValue();
+
+ Table table = backupMeta.getTable(tableId);
+ if (table instanceof OlapTable) {
+ OlapTable olapTable = (OlapTable) table;
+
+ // Directly get partitions by ID instead of iterating all
partitions
+ for (Long droppedPartitionId : droppedPartitionIds) {
+ Partition partition =
olapTable.getPartition(droppedPartitionId);
+ if (partition != null) {
+ LOG.info("remove dropped partition {} from table {}
(id: {}) in backup meta. {}",
+ partition.getName(), table.getName(), tableId,
this);
+
olapTable.dropPartitionAndReserveTablet(partition.getName());
+ }
+ }
+ }
+ }
+
+ // Remove dropped tables after processing partitions
+ for (Long tableId : droppedTables) {
+ Table removedTable = backupMeta.getTable(tableId);
+ if (removedTable != null) {
+ LOG.info("remove dropped table {} (id: {}) from backup meta.
{}",
+ removedTable.getName(), tableId, this);
+ backupMeta.removeTable(tableId);
+ }
+ }
Review Comment:
droppedPartitionsByTable.clear();
droppedTables.clear();
because they are useless here to reduce editlog size.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]