未验证 提交 0e89d9e6 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2988 from taosdata/hotfix/TD-1094

if redirect does not include Ep List, treat it as NOT_READY
...@@ -322,6 +322,8 @@ void *rpcMallocCont(int contLen) { ...@@ -322,6 +322,8 @@ void *rpcMallocCont(int contLen) {
if (start == NULL) { if (start == NULL) {
tError("failed to malloc msg, size:%d", size); tError("failed to malloc msg, size:%d", size);
return NULL; return NULL;
} else {
tDebug("malloc mem: %p", start);
} }
return start + sizeof(SRpcReqContext) + sizeof(SRpcHead); return start + sizeof(SRpcReqContext) + sizeof(SRpcHead);
...@@ -331,7 +333,7 @@ void rpcFreeCont(void *cont) { ...@@ -331,7 +333,7 @@ void rpcFreeCont(void *cont) {
if ( cont ) { if ( cont ) {
char *temp = ((char *)cont) - sizeof(SRpcHead) - sizeof(SRpcReqContext); char *temp = ((char *)cont) - sizeof(SRpcHead) - sizeof(SRpcReqContext);
free(temp); free(temp);
// tTrace("free mem: %p", temp); tDebug("free mem: %p", temp);
} }
} }
...@@ -551,7 +553,7 @@ static void rpcFreeMsg(void *msg) { ...@@ -551,7 +553,7 @@ static void rpcFreeMsg(void *msg) {
if ( msg ) { if ( msg ) {
char *temp = (char *)msg - sizeof(SRpcReqContext); char *temp = (char *)msg - sizeof(SRpcReqContext);
free(temp); free(temp);
// tTrace("free mem: %p", temp); tDebug("free mem: %p", temp);
} }
} }
...@@ -1098,10 +1100,15 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) { ...@@ -1098,10 +1100,15 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
} }
if (pHead->code == TSDB_CODE_RPC_REDIRECT) { if (pHead->code == TSDB_CODE_RPC_REDIRECT) {
pContext->redirect++; if (rpcMsg.contLen < sizeof(SRpcEpSet)) {
if (pContext->redirect > TSDB_MAX_REPLICA) { // if EpSet is not included in the msg, treat it as NOT_READY
pHead->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; pHead->code = TSDB_CODE_RPC_NOT_READY;
tWarn("%s, too many redirects, quit", pConn->info); } else {
pContext->redirect++;
if (pContext->redirect > TSDB_MAX_REPLICA) {
pHead->code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
tWarn("%s, too many redirects, quit", pConn->info);
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册