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

if redirect does not include Ep List, treat it as NOT_READY
This commit is contained in:
Shengliang Guan 2020-08-09 15:12:53 +08:00 committed by GitHub
commit 0e89d9e641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 6 deletions

View File

@ -322,6 +322,8 @@ void *rpcMallocCont(int contLen) {
if (start == NULL) {
tError("failed to malloc msg, size:%d", size);
return NULL;
} else {
tDebug("malloc mem: %p", start);
}
return start + sizeof(SRpcReqContext) + sizeof(SRpcHead);
@ -331,7 +333,7 @@ void rpcFreeCont(void *cont) {
if ( cont ) {
char *temp = ((char *)cont) - sizeof(SRpcHead) - sizeof(SRpcReqContext);
free(temp);
// tTrace("free mem: %p", temp);
tDebug("free mem: %p", temp);
}
}
@ -551,7 +553,7 @@ static void rpcFreeMsg(void *msg) {
if ( msg ) {
char *temp = (char *)msg - sizeof(SRpcReqContext);
free(temp);
// tTrace("free mem: %p", temp);
tDebug("free mem: %p", temp);
}
}
@ -1098,10 +1100,15 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
}
if (pHead->code == TSDB_CODE_RPC_REDIRECT) {
pContext->redirect++;
if (pContext->redirect > TSDB_MAX_REPLICA) {
pHead->code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
tWarn("%s, too many redirects, quit", pConn->info);
if (rpcMsg.contLen < sizeof(SRpcEpSet)) {
// if EpSet is not included in the msg, treat it as NOT_READY
pHead->code = TSDB_CODE_RPC_NOT_READY;
} else {
pContext->redirect++;
if (pContext->redirect > TSDB_MAX_REPLICA) {
pHead->code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
tWarn("%s, too many redirects, quit", pConn->info);
}
}
}