update epset
This commit is contained in:
parent
c0fc41f71f
commit
b2b1eb748a
|
@ -1493,18 +1493,35 @@ FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) {
|
||||||
bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) {
|
bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) {
|
||||||
bool noDelay = true;
|
bool noDelay = true;
|
||||||
if (hasEpSet == false) {
|
if (hasEpSet == false) {
|
||||||
// assert(pResp->contLen == 0);
|
|
||||||
if (pResp->contLen == 0) {
|
if (pResp->contLen == 0) {
|
||||||
if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
|
if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
|
||||||
noDelay = false;
|
noDelay = false;
|
||||||
} else {
|
} else {
|
||||||
EPSET_FORWARD_INUSE(&pCtx->epSet);
|
EPSET_FORWARD_INUSE(&pCtx->epSet);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (pResp->contLen != 0) {
|
||||||
if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
|
SEpSet epSet;
|
||||||
noDelay = false;
|
int32_t valid = tDeserializeSEpSet(pResp->pCont, pResp->contLen, &epSet);
|
||||||
|
if (valid < 0) {
|
||||||
|
tDebug("get invalid epset, epset equal, continue");
|
||||||
|
if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
|
||||||
|
noDelay = false;
|
||||||
|
} else {
|
||||||
|
EPSET_FORWARD_INUSE(&pCtx->epSet);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
EPSET_FORWARD_INUSE(&pCtx->epSet);
|
if (!transEpSetIsEqual(&pCtx->epSet, &epSet)) {
|
||||||
|
tDebug("epset not equal, retry new epset");
|
||||||
|
pCtx->epSet = epSet;
|
||||||
|
noDelay = false;
|
||||||
|
} else {
|
||||||
|
if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
|
||||||
|
noDelay = false;
|
||||||
|
} else {
|
||||||
|
tDebug("epset equal, continue");
|
||||||
|
EPSET_FORWARD_INUSE(&pCtx->epSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1584,7 +1601,7 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
|
||||||
addConnToPool(pThrd->pool, pConn);
|
addConnToPool(pThrd->pool, pConn);
|
||||||
} else if (code == TSDB_CODE_SYN_RESTORING) {
|
} else if (code == TSDB_CODE_SYN_RESTORING) {
|
||||||
tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen);
|
tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen);
|
||||||
noDelay = cliResetEpset(pCtx, pResp, false);
|
noDelay = cliResetEpset(pCtx, pResp, true);
|
||||||
addConnToPool(pThrd->pool, pConn);
|
addConnToPool(pThrd->pool, pConn);
|
||||||
transFreeMsg(pResp->pCont);
|
transFreeMsg(pResp->pCont);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue