提交 f5db4a8b 编写于 作者: dengyihao's avatar dengyihao

change paramter

上级 f3c1eb82
...@@ -1416,13 +1416,19 @@ FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) { ...@@ -1416,13 +1416,19 @@ 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); // 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 {
if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
noDelay = false;
} else {
EPSET_FORWARD_INUSE(&pCtx->epSet);
}
} }
} else { } else {
SEpSet epSet; SEpSet epSet;
...@@ -1433,17 +1439,19 @@ bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) { ...@@ -1433,17 +1439,19 @@ bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) {
noDelay = false; noDelay = false;
} else { } else {
EPSET_FORWARD_INUSE(&pCtx->epSet); EPSET_FORWARD_INUSE(&pCtx->epSet);
noDelay = true;
} }
} else { } else {
if (!transEpSetIsEqual(&pCtx->epSet, &epSet)) { if (!transEpSetIsEqual(&pCtx->epSet, &epSet)) {
tDebug("epset not equal, retry new epset"); tDebug("epset not equal, retry new epset");
pCtx->epSet = epSet; pCtx->epSet = epSet;
} else { } else {
tDebug("epset equal, continue"); if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
EPSET_FORWARD_INUSE(&pCtx->epSet); noDelay = false;
} else {
tDebug("epset equal, continue");
EPSET_FORWARD_INUSE(&pCtx->epSet);
}
} }
noDelay = false;
} }
} }
return noDelay; return noDelay;
...@@ -1459,14 +1467,22 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { ...@@ -1459,14 +1467,22 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
if (retry == false) { if (retry == false) {
return false; return false;
} }
if (pCtx->retryInit) {
if (-1 != pCtx->retryMaxTimeout && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) { if (!pCtx->retryInit) {
return false; pCtx->retryMinInterval = pTransInst->retryMinInterval;
} pCtx->retryMaxInterval = pTransInst->retryMaxInterval;
pCtx->retryStepFactor = pTransInst->retryStepFactor;
pCtx->retryMaxTimeout = pTransInst->retryMaxTimouet;
pCtx->retryInitTimestamp = taosGetTimestampMs();
pCtx->retryNextInterval = pCtx->retryMinInterval;
pCtx->retryStep = 1;
pCtx->retryInit = true;
}
if (-1 != pCtx->retryMaxTimeout && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) {
return false;
} }
bool noDelay = false; bool noDelay = false;
if (code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { if (code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
tDebug("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen); tDebug("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen);
noDelay = cliResetEpset(pCtx, pResp, false); noDelay = cliResetEpset(pCtx, pResp, false);
...@@ -1490,34 +1506,24 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { ...@@ -1490,34 +1506,24 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
transFreeMsg(pResp->pCont); transFreeMsg(pResp->pCont);
} }
if (!pCtx->retryInit) { if (noDelay == false) {
pCtx->retryMinInterval = pTransInst->retryMinInterval; pCtx->epsetRetryCnt = 1;
pCtx->retryMaxInterval = pTransInst->retryMaxInterval; pCtx->retryStep++;
pCtx->retryStepFactor = pTransInst->retryStepFactor;
pCtx->retryMaxTimeout = pTransInst->retryMaxTimouet;
pCtx->retryInitTimestamp = taosGetTimestampMs();
pCtx->retryNextInterval = pCtx->retryMinInterval;
pCtx->retryStep = 1;
pCtx->retryInit = true;
} else {
if (noDelay == false) {
pCtx->epsetRetryCnt = 0;
pCtx->retryStep++;
int64_t factor = pow(pCtx->retryStepFactor, pCtx->retryStep - 1);
pCtx->retryNextInterval = factor * pCtx->retryMinInterval;
if (pCtx->retryNextInterval >= pCtx->retryMaxInterval) {
pCtx->retryNextInterval = pCtx->retryMaxInterval;
}
if (-1 != pCtx->retryMaxTimeout && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) { int64_t factor = pow(pCtx->retryStepFactor, pCtx->retryStep - 1);
return false; pCtx->retryNextInterval = factor * pCtx->retryMinInterval;
} if (pCtx->retryNextInterval >= pCtx->retryMaxInterval) {
} else { pCtx->retryNextInterval = pCtx->retryMaxInterval;
pCtx->retryNextInterval = 0; }
pCtx->epsetRetryCnt++;
if (-1 != pCtx->retryMaxTimeout && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) {
return false;
} }
} else {
pCtx->retryNextInterval = 0;
pCtx->epsetRetryCnt++;
} }
pMsg->sent = 0; pMsg->sent = 0;
cliSchedMsgToNextNode(pMsg, pThrd); cliSchedMsgToNextNode(pMsg, pThrd);
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册