From 72352f036702effabc71960f218b1bd284718eed Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 24 Aug 2020 10:04:04 +0800 Subject: [PATCH] TD-1205 add error code to crash_gen.py --- src/mnode/src/mnodeDb.c | 8 ++++++-- tests/pytest/crash_gen.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index 78c022ce46..26b4430777 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -41,7 +41,7 @@ static void * tsDbSdb = NULL; static int32_t tsDbUpdateSize; -static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMsg); +static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, SMnodeMsg *pMsg); static int32_t mnodeDropDb(SMnodeMsg *newMsg); static int32_t mnodeSetDbDropping(SDbObj *pDb); static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); @@ -343,7 +343,7 @@ static int32_t mnodeCreateDbCb(SMnodeMsg *pMsg, int32_t code) { return code; } -static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMsg) { +static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, SMnodeMsg *pMsg) { int32_t code = acctCheck(pAcct, ACCT_GRANT_DB); if (code != 0) return code; @@ -393,6 +393,9 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs return code; } + pMsg->pDb = pDb; + mnodeIncDbRef(pDb); + SSdbOper oper = { .type = SDB_OPER_GLOBAL, .table = tsDbSdb, @@ -405,6 +408,7 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs code = sdbInsertRow(&oper); if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) { mError("db:%s, failed to create, reason:%s", pDb->name, tstrerror(code)); + pMsg->pDb = NULL; mnodeDestroyDb(pDb); } diff --git a/tests/pytest/crash_gen.py b/tests/pytest/crash_gen.py index 8edba3903d..7d3eb959c0 100755 --- a/tests/pytest/crash_gen.py +++ b/tests/pytest/crash_gen.py @@ -1492,6 +1492,7 @@ class Task(): 0x386, # DB is being dropped?! 0x503, 0x510, # vnode not in ready state + 0x14, # db not ready, errno changed 0x600, 1000 # REST catch-all error ]: -- GitLab