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

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

commit 18d191b293e1edd940cb28386bb9e4c959010d84
Author: yiguolei <[email protected]>
AuthorDate: Sun Apr 21 20:26:06 2024 +0800

    Revert "[fix](tablet invert index) fix tablet invert index leaky caused by 
auto partition (#33714)"
    
    This reverts commit 89441b0cb0e27e332e7a806838c0fdac47f1de26.
---
 .../apache/doris/datasource/InternalCatalog.java   | 18 ++++---
 .../apache/doris/alter/AddExistsPartitionTest.java | 56 ----------------------
 2 files changed, 8 insertions(+), 66 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index 16187bdc517..ea33e30f861 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -1416,9 +1416,7 @@ public class InternalCatalog implements 
CatalogIf<Database> {
             if (olapTable.checkPartitionNameExist(partitionName)) {
                 if (singlePartitionDesc.isSetIfNotExists()) {
                     LOG.info("add partition[{}] which already exists", 
partitionName);
-                    if 
(!DebugPointUtil.isEnable("InternalCatalog.addPartition.noCheckExists")) {
-                        return;
-                    }
+                    return;
                 } else {
                     
ErrorReport.reportDdlException(ErrorCode.ERR_SAME_NAME_PARTITION, 
partitionName);
                 }
@@ -1575,7 +1573,6 @@ public class InternalCatalog implements 
CatalogIf<Database> {
         if (!Strings.isNullOrEmpty(dataProperty.getStoragePolicy())) {
             storagePolicy = dataProperty.getStoragePolicy();
         }
-        boolean ignoreException = false;
         try {
             long partitionId = idGeneratorBuffer.getNextId();
             Partition partition = createPartitionWithIndices(db.getId(), 
olapTable,
@@ -1596,10 +1593,11 @@ public class InternalCatalog implements 
CatalogIf<Database> {
                 // check partition name
                 if (olapTable.checkPartitionNameExist(partitionName)) {
                     if (singlePartitionDesc.isSetIfNotExists()) {
-                        ignoreException = true;
+                        LOG.info("add partition[{}] which already exists", 
partitionName);
+                        return;
+                    } else {
+                        
ErrorReport.reportDdlException(ErrorCode.ERR_SAME_NAME_PARTITION, 
partitionName);
                     }
-                    LOG.info("add partition[{}] which already exists", 
partitionName);
-                    
ErrorReport.reportDdlException(ErrorCode.ERR_SAME_NAME_PARTITION, 
partitionName);
                 }
 
                 // check if meta changed
@@ -1644,6 +1642,8 @@ public class InternalCatalog implements 
CatalogIf<Database> {
                     }
                 }
 
+
+
                 if (metaChanged) {
                     throw new DdlException("Table[" + tableName + "]'s meta 
has been changed. try again.");
                 }
@@ -1688,9 +1688,7 @@ public class InternalCatalog implements 
CatalogIf<Database> {
             for (Long tabletId : tabletIdSet) {
                 Env.getCurrentInvertedIndex().deleteTablet(tabletId);
             }
-            if (!ignoreException) {
-                throw e;
-            }
+            throw e;
         }
     }
 
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/alter/AddExistsPartitionTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/alter/AddExistsPartitionTest.java
deleted file mode 100644
index 0d95ee30cde..00000000000
--- 
a/fe/fe-core/src/test/java/org/apache/doris/alter/AddExistsPartitionTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.alter;
-
-import org.apache.doris.catalog.Env;
-import org.apache.doris.common.Config;
-import org.apache.doris.common.util.DebugPointUtil;
-import org.apache.doris.common.util.DebugPointUtil.DebugPoint;
-import org.apache.doris.utframe.TestWithFeService;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import java.util.List;
-
-public class AddExistsPartitionTest extends TestWithFeService {
-
-    @Override
-    protected void beforeCreatingConnectContext() throws Exception {
-        Config.enable_debug_points = true;
-    }
-
-    @Test
-    public void testAddExistsPartition() throws Exception {
-        
DebugPointUtil.addDebugPoint("InternalCatalog.addPartition.noCheckExists", new 
DebugPoint());
-        createDatabase("test");
-        createTable("CREATE TABLE test.tbl (k INT) DISTRIBUTED BY HASH(k) "
-                + " BUCKETS 5 PROPERTIES ( \"replication_num\" = \"" + 
backendNum() + "\" )");
-        List<Long> backendIds = Env.getCurrentSystemInfo().getAllBackendIds();
-        for (long backendId : backendIds) {
-            Assertions.assertEquals(5, 
Env.getCurrentInvertedIndex().getTabletIdsByBackendId(backendId).size());
-        }
-
-        String addPartitionSql = "ALTER TABLE test.tbl  ADD PARTITION  IF NOT 
EXISTS tbl"
-                + " DISTRIBUTED BY HASH(k) BUCKETS 5";
-        Assertions.assertNotNull(getSqlStmtExecutor(addPartitionSql));
-        for (long backendId : backendIds) {
-            Assertions.assertEquals(5, 
Env.getCurrentInvertedIndex().getTabletIdsByBackendId(backendId).size());
-        }
-    }
-}


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

Reply via email to