Merge pull request #7220 from taosdata/feature/TD-5610
[TD-5610]<enhance> Unable to Resolve FQDN
This commit is contained in:
commit
cd4a42c241
|
@ -339,6 +339,11 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
|
||||||
const char* msg = (sub->cmd.command == TSDB_SQL_STABLEVGROUP)? "vgroup-list":"multi-tableMeta";
|
const char* msg = (sub->cmd.command == TSDB_SQL_STABLEVGROUP)? "vgroup-list":"multi-tableMeta";
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
tscError("0x%"PRIx64" get %s failed, code:%s", pSql->self, msg, tstrerror(code));
|
tscError("0x%"PRIx64" get %s failed, code:%s", pSql->self, msg, tstrerror(code));
|
||||||
|
if (code == TSDB_CODE_RPC_FQDN_ERROR) {
|
||||||
|
size_t sz = strlen(tscGetErrorMsgPayload(&sub->cmd));
|
||||||
|
tscAllocPayload(&pSql->cmd, (int)sz + 1);
|
||||||
|
memcpy(tscGetErrorMsgPayload(&pSql->cmd), tscGetErrorMsgPayload(&sub->cmd), sz);
|
||||||
|
}
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -501,6 +501,15 @@ static void doProcessMsgFromServer(SSchedMsg* pSchedMsg) {
|
||||||
pRes->code = rpcMsg->code;
|
pRes->code = rpcMsg->code;
|
||||||
}
|
}
|
||||||
rpcMsg->code = (pRes->code == TSDB_CODE_SUCCESS) ? (int32_t)pRes->numOfRows : pRes->code;
|
rpcMsg->code = (pRes->code == TSDB_CODE_SUCCESS) ? (int32_t)pRes->numOfRows : pRes->code;
|
||||||
|
if (pRes->code == TSDB_CODE_RPC_FQDN_ERROR) {
|
||||||
|
if (pEpSet) {
|
||||||
|
char buf[TSDB_FQDN_LEN + 64] = {0};
|
||||||
|
tscAllocPayload(pCmd, sizeof(buf));
|
||||||
|
sprintf(tscGetErrorMsgPayload(pCmd), "%s\"%s\"", tstrerror(pRes->code),pEpSet->fqdn[(pEpSet->inUse)%(pEpSet->numOfEps)]);
|
||||||
|
} else {
|
||||||
|
sprintf(tscGetErrorMsgPayload(pCmd), "%s", tstrerror(pRes->code));
|
||||||
|
}
|
||||||
|
}
|
||||||
(*pSql->fp)(pSql->param, pSql, rpcMsg->code);
|
(*pSql->fp)(pSql->param, pSql, rpcMsg->code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,11 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
|
||||||
|
|
||||||
if (pSql->res.code != TSDB_CODE_SUCCESS) {
|
if (pSql->res.code != TSDB_CODE_SUCCESS) {
|
||||||
terrno = pSql->res.code;
|
terrno = pSql->res.code;
|
||||||
|
if (terrno ==TSDB_CODE_RPC_FQDN_ERROR) {
|
||||||
|
printf("taos connect failed, reason: %s\n\n", taos_errstr(pSql));
|
||||||
|
} else {
|
||||||
|
printf("taos connect failed, reason: %s.\n\n", tstrerror(terrno));
|
||||||
|
}
|
||||||
taos_free_result(pSql);
|
taos_free_result(pSql);
|
||||||
taos_close(pObj);
|
taos_close(pObj);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -643,7 +648,7 @@ char *taos_errstr(TAOS_RES *tres) {
|
||||||
return (char*) tstrerror(terrno);
|
return (char*) tstrerror(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasAdditionalErrorInfo(pSql->res.code, &pSql->cmd)) {
|
if (hasAdditionalErrorInfo(pSql->res.code, &pSql->cmd) || pSql->res.code == TSDB_CODE_RPC_FQDN_ERROR) {
|
||||||
return pSql->cmd.payload;
|
return pSql->cmd.payload;
|
||||||
} else {
|
} else {
|
||||||
return (char*)tstrerror(pSql->res.code);
|
return (char*)tstrerror(pSql->res.code);
|
||||||
|
|
|
@ -98,7 +98,6 @@ TAOS *shellInit(SShellArguments *_args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (con == NULL) {
|
if (con == NULL) {
|
||||||
printf("taos connect failed, reason: %s.\n\n", tstrerror(terrno));
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
return con;
|
return con;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue