From ccb8ab9328f778e7bfa8773ad2fe3bfc28d2f687 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 11 Oct 2020 07:51:17 +0000 Subject: [PATCH] TD-1670 --- src/mnode/src/mnodeRead.c | 15 +++++++++++---- src/rpc/src/rpcMain.c | 8 ++++++-- src/util/src/tqueue.c | 1 + tests/script/sh/deploy.sh | 34 +++++++++++++++++----------------- tests/script/test.sh | 11 +++-------- 5 files changed, 38 insertions(+), 31 deletions(-) diff --git a/src/mnode/src/mnodeRead.c b/src/mnode/src/mnodeRead.c index af2fed3408..dab19a2993 100644 --- a/src/mnode/src/mnodeRead.c +++ b/src/mnode/src/mnodeRead.c @@ -51,14 +51,21 @@ int32_t mnodeProcessRead(SMnodeMsg *pMsg) { SMnodeRsp *rpcRsp = &pMsg->rpcRsp; SRpcEpSet *epSet = rpcMallocCont(sizeof(SRpcEpSet)); mnodeGetMnodeEpSetForShell(epSet); - rpcRsp->rsp = epSet; - rpcRsp->len = sizeof(SRpcEpSet); - mDebug("%p, msg:%s in mread queue, will be redireced, inUse:%d", pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], epSet->inUse); + mDebug("%p, msg:%s in mread queue, will be redireced, numOfEps:%d inUse:%d", pMsg->rpcMsg.ahandle, + taosMsg[pMsg->rpcMsg.msgType], epSet->numOfEps, epSet->inUse); for (int32_t i = 0; i < epSet->numOfEps; ++i) { - mDebug("mnode index:%d ep:%s:%d", i, epSet->fqdn[i], htons(epSet->port[i])); + if (strcmp(epSet->fqdn[i], tsLocalFqdn) == 0 && htons(epSet->port[i]) == tsServerPort) { + epSet->inUse = (i + 1) % epSet->numOfEps; + mDebug("mnode index:%d ep:%s:%u, set inUse to %d", i, epSet->fqdn[i], htons(epSet->port[i]), epSet->inUse); + } else { + mDebug("mnode index:%d ep:%s:%u", i, epSet->fqdn[i], htons(epSet->port[i])); + } } + rpcRsp->rsp = epSet; + rpcRsp->len = sizeof(SRpcEpSet); + return TSDB_CODE_RPC_REDIRECT; } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 414d37d8b8..4d6cd94ed3 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -1121,9 +1121,13 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte SRpcEpSet *pEpSet = (SRpcEpSet*)pHead->content; if (pEpSet->numOfEps > 0) { memcpy(&pContext->epSet, pHead->content, sizeof(pContext->epSet)); - tDebug("%s, redirect is received, numOfEps:%d", pConn->info, pContext->epSet.numOfEps); - for (int i=0; iepSet.numOfEps; ++i) + tDebug("%s, redirect is received, numOfEps:%d inUse:%d", pConn->info, pContext->epSet.numOfEps, + pContext->epSet.inUse); + for (int i = 0; i < pContext->epSet.numOfEps; ++i) { pContext->epSet.port[i] = htons(pContext->epSet.port[i]); + tDebug("%s, redirect is received, index:%d ep:%s:%u", pConn->info, i, pContext->epSet.fqdn[i], + pContext->epSet.port[i]); + } } rpcSendReqToServer(pRpc, pContext); rpcFreeCont(rpcMsg.pCont); diff --git a/src/util/src/tqueue.c b/src/util/src/tqueue.c index 8c6d6243eb..d3c17e7626 100644 --- a/src/util/src/tqueue.c +++ b/src/util/src/tqueue.c @@ -263,6 +263,7 @@ void taosCloseQset(taos_qset param) { // thread to exit. void taosQsetThreadResume(taos_qset param) { STaosQset *qset = (STaosQset *)param; + uDebug("qset:%p, it will exit", qset); tsem_post(&qset->sem); } diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 8fccb1442f..e26778e86b 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -111,24 +111,24 @@ echo "serverPort ${NODE}" >> $TAOS_CFG echo "dataDir $DATA_DIR" >> $TAOS_CFG echo "logDir $LOG_DIR" >> $TAOS_CFG echo "debugFlag 0" >> $TAOS_CFG -echo "mDebugFlag 135" >> $TAOS_CFG -echo "sdbDebugFlag 135" >> $TAOS_CFG -echo "dDebugFlag 135" >> $TAOS_CFG -echo "vDebugFlag 135" >> $TAOS_CFG -echo "tsdbDebugFlag 135" >> $TAOS_CFG -echo "cDebugFlag 135" >> $TAOS_CFG -echo "jnidebugFlag 135" >> $TAOS_CFG -echo "odbcdebugFlag 135" >> $TAOS_CFG -echo "httpDebugFlag 135" >> $TAOS_CFG -echo "monitorDebugFlag 135" >> $TAOS_CFG -echo "mqttDebugFlag 135" >> $TAOS_CFG -echo "qdebugFlag 135" >> $TAOS_CFG -echo "rpcDebugFlag 135" >> $TAOS_CFG +echo "mDebugFlag 143" >> $TAOS_CFG +echo "sdbDebugFlag 143" >> $TAOS_CFG +echo "dDebugFlag 143" >> $TAOS_CFG +echo "vDebugFlag 143" >> $TAOS_CFG +echo "tsdbDebugFlag 143" >> $TAOS_CFG +echo "cDebugFlag 143" >> $TAOS_CFG +echo "jnidebugFlag 143" >> $TAOS_CFG +echo "odbcdebugFlag 143" >> $TAOS_CFG +echo "httpDebugFlag 143" >> $TAOS_CFG +echo "monitorDebugFlag 143" >> $TAOS_CFG +echo "mqttDebugFlag 143" >> $TAOS_CFG +echo "qdebugFlag 143" >> $TAOS_CFG +echo "rpcDebugFlag 143" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG -echo "udebugFlag 135" >> $TAOS_CFG -echo "sdebugFlag 135" >> $TAOS_CFG -echo "wdebugFlag 135" >> $TAOS_CFG -echo "cqdebugFlag 135" >> $TAOS_CFG +echo "udebugFlag 143" >> $TAOS_CFG +echo "sdebugFlag 143" >> $TAOS_CFG +echo "wdebugFlag 143" >> $TAOS_CFG +echo "cqdebugFlag 143" >> $TAOS_CFG echo "monitor 0" >> $TAOS_CFG echo "monitorInterval 1" >> $TAOS_CFG echo "http 0" >> $TAOS_CFG diff --git a/tests/script/test.sh b/tests/script/test.sh index 96e4ffe689..a68ac4736d 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -109,15 +109,10 @@ echo "dataDir $DATA_DIR" >> $TAOS_CFG echo "logDir $LOG_DIR" >> $TAOS_CFG echo "scriptDir ${CODE_DIR}/../script" >> $TAOS_CFG echo "numOfLogLines 100000000" >> $TAOS_CFG -echo "dDebugFlag 135" >> $TAOS_CFG -echo "mDebugFlag 135" >> $TAOS_CFG -echo "sdbDebugFlag 135" >> $TAOS_CFG -echo "rpcDebugFlag 135" >> $TAOS_CFG +echo "rpcDebugFlag 143" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG -echo "cDebugFlag 135" >> $TAOS_CFG -echo "httpDebugFlag 135" >> $TAOS_CFG -echo "monitorDebugFlag 135" >> $TAOS_CFG -echo "udebugFlag 135" >> $TAOS_CFG +echo "cDebugFlag 143" >> $TAOS_CFG +echo "udebugFlag 143" >> $TAOS_CFG echo "tablemetakeeptimer 5" >> $TAOS_CFG echo "wal 0" >> $TAOS_CFG echo "asyncLog 0" >> $TAOS_CFG -- GitLab