morningman commented on a change in pull request #4029:
URL: https://github.com/apache/incubator-doris/pull/4029#discussion_r450272944
##########
File path: fe/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
##########
@@ -716,7 +716,6 @@ public void processBatchDropRollup(List<AlterClause>
dropRollupClauses, Database
public void processDropMaterializedView(DropMaterializedViewStmt
dropMaterializedViewStmt, Database db,
OlapTable olapTable) throws DdlException, MetaNotFoundException {
- db.writeLock();
Review comment:
Add a `Preconditions.checkState( db.isWriteLockHeldByCurrentThread())`
to NOTICE.
##########
File path: fe/src/main/java/org/apache/doris/analysis/DropTableStmt.java
##########
@@ -32,17 +32,20 @@
private boolean ifExists;
private final TableName tableName;
private final boolean isView;
+ private boolean needCheckCommitedTxns;
Review comment:
```suggestion
private boolean needCheckCommittedTxns;
```
##########
File path: fe/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -2666,6 +2666,13 @@ public void dropDb(DropDbStmt stmt) throws DdlException {
Database db = this.fullNameToDb.get(dbName);
db.writeLock();
try {
+ if (stmt.isNeedCheckCommitedTxns()) {
+ if
(Catalog.getCurrentCatalog().getGlobalTransactionMgr().existCommittedTxns(db.getId(),
null, null)) {
+ throw new DdlException("There are still some commited
txns cannot be aborted in db ["
Review comment:
There are still some transactions in the COMMITTED state waiting to be
completed. The database cannot be dropped. If you want to force drop(cannot be
recovered), please use "DROPP database";
##########
File path: fe/src/main/java/org/apache/doris/analysis/DropTableStmt.java
##########
@@ -61,6 +64,10 @@ public boolean isView() {
return isView;
}
+ public boolean isNeedCheckCommitedTxns() {
Review comment:
```suggestion
public boolean isNeedCheckCommittedTxns() {
```
##########
File path: fe/src/main/java/org/apache/doris/analysis/DropTableStmt.java
##########
@@ -32,17 +32,20 @@
private boolean ifExists;
private final TableName tableName;
private final boolean isView;
+ private boolean needCheckCommitedTxns;
- public DropTableStmt(boolean ifExists, TableName tableName) {
+ public DropTableStmt(boolean ifExists, TableName tableName, boolean
needCheckCommitedTxns) {
Review comment:
```suggestion
public DropTableStmt(boolean ifExists, TableName tableName, boolean
needCheckCommittedTxns) {
```
##########
File path: fe/src/main/java/org/apache/doris/analysis/DropTableStmt.java
##########
@@ -32,17 +32,20 @@
private boolean ifExists;
private final TableName tableName;
private final boolean isView;
+ private boolean needCheckCommitedTxns;
- public DropTableStmt(boolean ifExists, TableName tableName) {
+ public DropTableStmt(boolean ifExists, TableName tableName, boolean
needCheckCommitedTxns) {
this.ifExists = ifExists;
this.tableName = tableName;
this.isView = false;
+ this.needCheckCommitedTxns = needCheckCommitedTxns;
Review comment:
```suggestion
this.needCheckCommittedTxns = needCheckCommittedTxns;
```
##########
File path: fe/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -3308,6 +3315,20 @@ public void dropPartition(Database db, OlapTable
olapTable, DropPartitionClause
if (isTempPartition) {
olapTable.dropTempPartition(partitionName, true);
} else {
+ if (clause.isNeedCheckCommitedTxns()) {
Review comment:
Duplicated `if clause`?
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]