Skip to content
Merged
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 @@ -89,10 +89,21 @@ public static void replacePartition(TableIf olapTable, List<String> partitionNam
if (!olapTable.writeLockIfExist()) {
return;
}
// Filter out partitions that were deleted between the snapshot time and now.
// The write lock is held here, so this check and the subsequent replace are atomic.
// The temp partition list is kept as-is so all written data remains visible.
List<String> validPartitionNames = new ArrayList<>();
for (int i = 0; i < partitionNames.size(); i++) {
if (((OlapTable) olapTable).checkPartitionNameExist(partitionNames.get(i), false)) {
validPartitionNames.add(partitionNames.get(i));
} else {
LOG.warn("partition [{}] has been deleted before replace, skipping", partitionNames.get(i));
}
}
Map<String, String> properties = Maps.newHashMap();
properties.put(PropertyAnalyzer.PROPERTIES_USE_TEMP_PARTITION_NAME, "false");
ReplacePartitionOp replacePartitionOp = new ReplacePartitionOp(
new PartitionNamesInfo(false, partitionNames),
new PartitionNamesInfo(false, validPartitionNames),
new PartitionNamesInfo(true, tempPartitionNames), isForce, properties);
if (replacePartitionOp.getTempPartitionNames().isEmpty()) {
return;
Expand Down