You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2026/03/03 09:41:35 UTC

(doris) branch branch-4.0 updated: branch-4.0: [fix](insert-overwrite) skip deleted partitions before replace to avoid DdlException #60914 (#60949)

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 <zh...@selectdb.com>
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: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org