You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/03/10 08:48:36 UTC

[GitHub] [incubator-doris] EmmyMiao87 opened a new pull request #3068: Support delete materialized view

EmmyMiao87 opened a new pull request #3068: Support delete materialized view
URL: https://github.com/apache/incubator-doris/pull/3068
 
 
   DROP MATERIALIZE VIEW [ IF EXISTS ] <mv_name> ON [db_name].<table_name>
   Parameters
     IF EXISTS: Do not throw an error if the materialized view does not exist. A notice is issued in this case.
     mv_name: The name of the materialized view to remove.
     db_name: The name of db to which materialized view belongs.
     table_name: The name of table to which materialized view belongs.
   
   Add the check of keystype in create mv stmt test

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman commented on a change in pull request #3068: Support delete materialized view

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #3068: Support delete materialized view
URL: https://github.com/apache/incubator-doris/pull/3068#discussion_r390315531
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/alter/Alter.java
 ##########
 @@ -107,24 +114,38 @@ public void processCreateMaterializedView(CreateMaterializedViewStmt stmt) throw
                 throw new DdlException("Do not support alter non-OLAP table[" + tableName + "]");
             }
             OlapTable olapTable = (OlapTable) table;
+            olapTable.checkStableAndNormal(db.getClusterName());
 
-            if (olapTable.getState() != OlapTableState.NORMAL) {
-                throw new DdlException("Table[" + table.getName() + "]'s state is not NORMAL. "
-                                               + "Do not allow doing materialized view");
+            ((MaterializedViewHandler)materializedViewHandler).processCreateMaterializedView(stmt, db, olapTable);
+        } finally {
+            db.writeUnlock();
+        }
+    }
+
+    public void processDropMaterializedView(DropMaterializedViewStmt stmt) throws DdlException, MetaNotFoundException {
+        // check db
+        String dbName = stmt.getTableName().getDb();
+        Database db = Catalog.getInstance().getDb(dbName);
+        if (db == null) {
+            ErrorReport.reportDdlException(ErrorCode.ERR_BAD_DB_ERROR, dbName);
+        }
+
+        db.writeLock();
+        try {
+            String tableName = stmt.getTableName().getTbl();
+            Table table = db.getTable(tableName);
+            if (table == null) {
+                ErrorReport.reportDdlException(ErrorCode.ERR_BAD_TABLE_ERROR, tableName);
             }
-            // check if all tablets are healthy, and no tablet is in tablet scheduler
-            boolean isStable = olapTable.isStable(Catalog.getCurrentSystemInfo(),
-                                                  Catalog.getCurrentCatalog().getTabletScheduler(),
-                                                  db.getClusterName());
-            if (!isStable) {
-                throw new DdlException("table [" + olapTable.getName() + "] is not stable."
-                                               + " Some tablets of this table may not be healthy or are being "
-                                               + "scheduled."
-                                               + " You need to repair the table first"
-                                               + " or stop cluster balance. See 'help admin;'.");
+
+            if (table.getType() != TableType.OLAP) {
+                throw new DdlException("Do not support non-OLAP table [" + tableName + "] when drop materialized view");
             }
 
-            ((MaterializedViewHandler)materializedViewHandler).processCreateMaterializedView(stmt, db, olapTable);
+            OlapTable olapTable = (OlapTable) table;
+            olapTable.checkStableAndNormal(db.getClusterName());
 
 Review comment:
   No need to check table's stable when dropping mv.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] morningman merged pull request #3068: Support delete materialized view

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #3068: Support delete materialized view
URL: https://github.com/apache/incubator-doris/pull/3068
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org