Merge pull request #18008 from taosdata/fix/TD-20292
fix: wait until db created while process use db req
This commit is contained in:
commit
0ab95bb1fa
|
@ -606,7 +606,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
|
|||
} else {
|
||||
if (terrno == TSDB_CODE_MND_DB_IN_CREATING) {
|
||||
if (mndSetRpcInfoForDbTrans(pMnode, pReq, MND_OPER_CREATE_DB, createReq.db) == 0) {
|
||||
mInfo("db:%s, is creating and response after trans finished", createReq.db);
|
||||
mInfo("db:%s, is creating and createdb response after trans finished", createReq.db);
|
||||
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
goto _OVER;
|
||||
} else {
|
||||
|
@ -1225,6 +1225,14 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
|
|||
usedbRsp.vgVersion = usedbReq.vgVersion;
|
||||
usedbRsp.errCode = terrno;
|
||||
|
||||
if (terrno == TSDB_CODE_MND_DB_IN_CREATING) {
|
||||
if (mndSetRpcInfoForDbTrans(pMnode, pReq, MND_OPER_CREATE_DB, usedbReq.db) == 0) {
|
||||
mInfo("db:%s, is creating and usedb response after trans finished", usedbReq.db);
|
||||
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
goto _OVER;
|
||||
}
|
||||
}
|
||||
|
||||
mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr());
|
||||
} else {
|
||||
if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_USE_DB, pDb) != 0) {
|
||||
|
@ -1255,7 +1263,7 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
|
|||
pReq->info.rspLen = contLen;
|
||||
|
||||
_OVER:
|
||||
if (code != 0) {
|
||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||
mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr());
|
||||
}
|
||||
|
||||
|
|
|
@ -938,11 +938,15 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
|
|||
for (int32_t i = 0; i < size; ++i) {
|
||||
SRpcHandleInfo *pInfo = taosArrayGet(pTrans->pRpcArray, i);
|
||||
if (pInfo->handle != NULL) {
|
||||
mInfo("trans:%d, send rsp, code:0x%x stage:%s app:%p", pTrans->id, code, mndTransStr(pTrans->stage),
|
||||
pInfo->ahandle);
|
||||
if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
|
||||
code = TSDB_CODE_MND_TRANS_NETWORK_UNAVAILL;
|
||||
}
|
||||
if (i != 0 && code == 0) {
|
||||
code = TSDB_CODE_RPC_REDIRECT;
|
||||
}
|
||||
mInfo("trans:%d, client:%d send rsp, code:0x%x stage:%s app:%p", pTrans->id, i, code, mndTransStr(pTrans->stage),
|
||||
pInfo->ahandle);
|
||||
|
||||
SRpcMsg rspMsg = {.code = code, .info = *pInfo};
|
||||
|
||||
if (pTrans->originRpcType == TDMT_MND_CREATE_DB) {
|
||||
|
|
Loading…
Reference in New Issue