diff --git a/src/system/detail/inc/mgmt.h b/src/system/detail/inc/mgmt.h index 75ec841076518beef66587b9ba41d3a1b05fe242..d7e5a1b8a989f739727da1dc7e8fcccf0b304c06 100644 --- a/src/system/detail/inc/mgmt.h +++ b/src/system/detail/inc/mgmt.h @@ -312,7 +312,7 @@ int mgmtUpdateDb(SDbObj *pDb); SDbObj *mgmtGetDb(char *db); SDbObj *mgmtGetDbByMeterId(char *db); int mgmtCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate); -int mgmtDropDbByName(SAcctObj *pAcct, char *name); +int mgmtDropDbByName(SAcctObj *pAcct, char *name, short ignoreNotExists); int mgmtDropDb(SDbObj *pDb); /* void mgmtMonitorDbDrop(void *unused); */ void mgmtMonitorDbDrop(void *unused, void *unusedt); diff --git a/src/system/detail/src/mgmtDb.c b/src/system/detail/src/mgmtDb.c index a9490fe2a26f3371a678932093e30affeeaf86fd..f7ccdfc3a547589b7d6cd352701e074fbaa14fff 100644 --- a/src/system/detail/src/mgmtDb.c +++ b/src/system/detail/src/mgmtDb.c @@ -310,10 +310,11 @@ int mgmtDropDb(SDbObj *pDb) { } } -int mgmtDropDbByName(SAcctObj *pAcct, char *name) { +int mgmtDropDbByName(SAcctObj *pAcct, char *name, short ignoreNotExists) { SDbObj *pDb; pDb = (SDbObj *)sdbGetRow(dbSdb, name); if (pDb == NULL) { + if (ignoreNotExists) return TSDB_CODE_SUCCESS; mWarn("db:%s is not there", name); return TSDB_CODE_INVALID_DB; } diff --git a/src/system/detail/src/mgmtShell.c b/src/system/detail/src/mgmtShell.c index 5157ad503006479f8783b9c3867f8e1ce67bbb2c..2e094b9251c68240fe076598ac154f76feac6e31 100644 --- a/src/system/detail/src/mgmtShell.c +++ b/src/system/detail/src/mgmtShell.c @@ -849,7 +849,7 @@ int mgmtProcessDropDbMsg(char *pMsg, int msgLen, SConnObj *pConn) { if (!pConn->writeAuth) { code = TSDB_CODE_NO_RIGHTS; } else { - code = mgmtDropDbByName(pConn->pAcct, pDrop->db); + code = mgmtDropDbByName(pConn->pAcct, pDrop->db, pDrop->ignoreNotExists); if (code == 0) { mLPrint("DB:%s is dropped by %s", pDrop->db, pConn->pUser->user); }