diff --git a/src/system/detail/inc/mgmt.h b/src/system/detail/inc/mgmt.h index f837f7242404f3fd5e03abcd3bf7eb43396459f3..39a94f320bba4099d933929b599bbc70ab81b77f 100644 --- a/src/system/detail/inc/mgmt.h +++ b/src/system/detail/inc/mgmt.h @@ -314,7 +314,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 4bd64330687685645a284a4adc97cd5cc2fd2e47..900bbf91c6043f07649141244c136f3af4b57b3d 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 f382abb6021e01a6713f66a715565db8257f7399..8e94e7f401fc4a1589fa88d2a7b7f0d42b8e0731 100644 --- a/src/system/detail/src/mgmtShell.c +++ b/src/system/detail/src/mgmtShell.c @@ -763,7 +763,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); }