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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 55ca52a  [Bug] Fix bug that Drop olap table may introduce some 
problems when table's state is not normal (#5712)
55ca52a is described below

commit 55ca52a42d34047ed39bcc8edaa0ddccd8548989
Author: caiconghui <[email protected]>
AuthorDate: Wed May 12 10:38:23 2021 +0800

    [Bug] Fix bug that Drop olap table may introduce some problems when table's 
state is not normal (#5712)
    
    Co-authored-by: caiconghui <[email protected]>
---
 fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
index b1a252d..2c87f00 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
@@ -4437,6 +4437,14 @@ public class Catalog {
             DropInfo info = new DropInfo(db.getId(), table.getId(), -1L, 
stmt.isForceDrop());
             table.writeLock();
             try {
+                if (table instanceof OlapTable && !stmt.isForceDrop()) {
+                    OlapTable olapTable = (OlapTable) table;
+                    if ((olapTable.getState() != OlapTableState.NORMAL)) {
+                        throw new DdlException("The table [" + tableName +"]'s 
state is " + olapTable.getState() + ", cannot be dropped." +
+                                " please cancel the operation on olap table 
firstly. If you want to forcibly drop(cannot be recovered)," +
+                                " please use \"DROP table FORCE\".");
+                    }
+                }
                 unprotectDropTable(db, table, stmt.isForceDrop(), false);
             } finally {
                 table.writeUnlock();

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

Reply via email to