This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 832fec6b59a branch-4.0: [fix](insert-overwrite) skip deleted 
partitions before replace to avoid DdlException #60914 (#60949)
832fec6b59a is described below

commit 832fec6b59a6245e5e8e18813a80c53dfc375111
Author: morrySnow <[email protected]>
AuthorDate: Tue Mar 3 17:41:27 2026 +0800

    branch-4.0: [fix](insert-overwrite) skip deleted partitions before replace 
to avoid DdlException #60914 (#60949)
    
    picked from #60914
---
 .../apache/doris/insertoverwrite/InsertOverwriteUtil.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/insertoverwrite/InsertOverwriteUtil.java
 
b/fe/fe-core/src/main/java/org/apache/doris/insertoverwrite/InsertOverwriteUtil.java
index a2019660ae4..037b177e3a2 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/insertoverwrite/InsertOverwriteUtil.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/insertoverwrite/InsertOverwriteUtil.java
@@ -79,10 +79,21 @@ public class InsertOverwriteUtil {
                 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");
                 ReplacePartitionClause replacePartitionClause = new 
ReplacePartitionClause(
-                        new PartitionNamesInfo(false, partitionNames),
+                        new PartitionNamesInfo(false, validPartitionNames),
                         new PartitionNamesInfo(true, tempPartitionNames), 
isForce, properties);
                 if (replacePartitionClause.getTempPartitionNames().isEmpty()) {
                     return;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to