Merge pull request #28787 from taosdata/fix/optReturnCode

opt return code
This commit is contained in:
Hongze Cheng 2024-11-19 10:33:09 +08:00 committed by GitHub
commit 8b5664f185
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 15 deletions

View File

@ -5,7 +5,7 @@ node {
} }
file_zh_changed = '' file_zh_changed = ''
file_en_changed = '' file_en_changed = ''
file_no_doc_changed = '' file_no_doc_changed = '1'
def abortPreviousBuilds() { def abortPreviousBuilds() {
def currentJobName = env.JOB_NAME def currentJobName = env.JOB_NAME
def currentBuildNumber = env.BUILD_NUMBER.toInteger() def currentBuildNumber = env.BUILD_NUMBER.toInteger()
@ -656,4 +656,4 @@ pipeline {
) )
} }
} }
} }

View File

@ -214,8 +214,6 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
} else if ((pRpc->code == TSDB_CODE_RPC_NETWORK_UNAVAIL || pRpc->code == TSDB_CODE_RPC_BROKEN_LINK) && } else if ((pRpc->code == TSDB_CODE_RPC_NETWORK_UNAVAIL || pRpc->code == TSDB_CODE_RPC_BROKEN_LINK) &&
(!IsReq(pRpc)) && (pRpc->pCont == NULL)) { (!IsReq(pRpc)) && (pRpc->pCont == NULL)) {
dGError("msg:%p, type:%s pCont is NULL, err: %s", pRpc, TMSG_INFO(pRpc->msgType), tstrerror(pRpc->code)); dGError("msg:%p, type:%s pCont is NULL, err: %s", pRpc, TMSG_INFO(pRpc->msgType), tstrerror(pRpc->code));
code = pRpc->code;
goto _OVER;
} }
if (pHandle->defaultNtype == NODE_END) { if (pHandle->defaultNtype == NODE_END) {

View File

@ -1679,7 +1679,7 @@ void cliConnCb(uv_connect_t* req, int status) {
STUB_RAND_NETWORK_ERR(status); STUB_RAND_NETWORK_ERR(status);
if (status != 0) { if (status != 0) {
tDebug("%s conn %p failed to connect to %s since %s", CONN_GET_INST_LABEL(pConn), pConn, pConn->dstAddr, tError("%s conn %p failed to connect to %s since %s", CONN_GET_INST_LABEL(pConn), pConn, pConn->dstAddr,
uv_strerror(status)); uv_strerror(status));
cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, pConn->dstAddr); cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, pConn->dstAddr);
TAOS_UNUSED(transUnrefCliHandle(pConn)); TAOS_UNUSED(transUnrefCliHandle(pConn));
@ -1832,15 +1832,20 @@ static FORCE_INLINE int32_t cliUpdateFqdnCache(SHashObj* cache, char* fqdn) {
if (code == 0) { if (code == 0) {
size_t len = strlen(fqdn); size_t len = strlen(fqdn);
uint32_t* v = taosHashGet(cache, fqdn, len); uint32_t* v = taosHashGet(cache, fqdn, len);
if (addr != *v) { if (v != NULL) {
char old[TSDB_FQDN_LEN] = {0}, new[TSDB_FQDN_LEN] = {0}; if (addr != *v) {
tinet_ntoa(old, *v); char old[TSDB_FQDN_LEN] = {0}, new[TSDB_FQDN_LEN] = {0};
tinet_ntoa(new, addr); tinet_ntoa(old, *v);
tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new); tinet_ntoa(new, addr);
code = taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr)); tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new);
code = taosHashPut(cache, fqdn, len, &addr, sizeof(addr));
}
} else {
code = taosHashPut(cache, fqdn, len, &addr, sizeof(addr));
} }
} else { } else {
code = TSDB_CODE_RPC_FQDN_ERROR; // TSDB_CODE_RPC_INVALID_FQDN; code = TSDB_CODE_RPC_FQDN_ERROR; // TSDB_CODE_RPC_INVALID_FQDN;
tWarn("failed to get ip from fqdn:%s since %s", fqdn, tstrerror(code));
} }
return code; return code;
} }
@ -2933,10 +2938,8 @@ void cliMayResetRespCode(SCliReq* pReq, STransMsg* pResp) {
// check whole vnodes is offline on this vgroup // check whole vnodes is offline on this vgroup
if (((pCtx->epSet != NULL) && pCtx->epsetRetryCnt >= pCtx->epSet->numOfEps) || pCtx->retryStep > 0) { if (((pCtx->epSet != NULL) && pCtx->epsetRetryCnt >= pCtx->epSet->numOfEps) || pCtx->retryStep > 0) {
if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { if (pResp->code == TSDB_CODE_RPC_BROKEN_LINK) {
pResp->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED; pResp->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; // TSDB_CODE_RPC_SOMENODE_BROKEN_LINK;
} else if (pResp->code == TSDB_CODE_RPC_BROKEN_LINK) {
pResp->code = TSDB_CODE_RPC_SOMENODE_BROKEN_LINK;
} }
} }
} }