add error
This commit is contained in:
parent
0988064f9c
commit
9fb329f481
|
@ -200,7 +200,7 @@ static FORCE_INLINE void cliMayUpdateFqdnCache(SHashObj* cache, char* dst);
|
||||||
// process data read from server, add decompress etc later
|
// process data read from server, add decompress etc later
|
||||||
static void cliHandleResp(SCliConn* conn);
|
static void cliHandleResp(SCliConn* conn);
|
||||||
// handle except about conn
|
// handle except about conn
|
||||||
static void cliHandleExcept(SCliConn* conn);
|
static void cliHandleExcept(SCliConn* conn, int32_t code);
|
||||||
static void cliReleaseUnfinishedMsg(SCliConn* conn);
|
static void cliReleaseUnfinishedMsg(SCliConn* conn);
|
||||||
static void cliHandleFastFail(SCliConn* pConn, int status);
|
static void cliHandleFastFail(SCliConn* pConn, int status);
|
||||||
|
|
||||||
|
@ -571,8 +571,11 @@ void cliHandleExceptImpl(SCliConn* pConn, int32_t code) {
|
||||||
if (T_REF_VAL_GET(pConn) > 1) transUnrefCliHandle(pConn);
|
if (T_REF_VAL_GET(pConn) > 1) transUnrefCliHandle(pConn);
|
||||||
transUnrefCliHandle(pConn);
|
transUnrefCliHandle(pConn);
|
||||||
}
|
}
|
||||||
void cliHandleExcept(SCliConn* conn) {
|
void cliHandleExcept(SCliConn* conn, int32_t code) {
|
||||||
tTrace("%s conn %p except ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn));
|
tTrace("%s conn %p except ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn));
|
||||||
|
if (code != TSDB_CODE_RPC_FQDN_ERROR) {
|
||||||
|
code = -1;
|
||||||
|
}
|
||||||
cliHandleExceptImpl(conn, -1);
|
cliHandleExceptImpl(conn, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,7 +869,7 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
|
||||||
while (transReadComplete(pBuf)) {
|
while (transReadComplete(pBuf)) {
|
||||||
tTrace("%s conn %p read complete", CONN_GET_INST_LABEL(conn), conn);
|
tTrace("%s conn %p read complete", CONN_GET_INST_LABEL(conn), conn);
|
||||||
if (pBuf->invalid) {
|
if (pBuf->invalid) {
|
||||||
cliHandleExcept(conn);
|
cliHandleExcept(conn, -1);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
cliHandleResp(conn);
|
cliHandleResp(conn);
|
||||||
|
@ -886,7 +889,7 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
|
||||||
tDebug("%s conn %p read error:%s, ref:%d", CONN_GET_INST_LABEL(conn), conn, uv_err_name(nread),
|
tDebug("%s conn %p read error:%s, ref:%d", CONN_GET_INST_LABEL(conn), conn, uv_err_name(nread),
|
||||||
T_REF_VAL_GET(conn));
|
T_REF_VAL_GET(conn));
|
||||||
conn->broken = true;
|
conn->broken = true;
|
||||||
cliHandleExcept(conn);
|
cliHandleExcept(conn, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,7 +1040,7 @@ static void cliSendCb(uv_write_t* req, int status) {
|
||||||
} else {
|
} else {
|
||||||
if (!uv_is_closing((uv_handle_t*)&pConn->stream)) {
|
if (!uv_is_closing((uv_handle_t*)&pConn->stream)) {
|
||||||
tError("%s conn %p failed to write:%s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(status));
|
tError("%s conn %p failed to write:%s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(status));
|
||||||
cliHandleExcept(pConn);
|
cliHandleExcept(pConn, -1);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1113,7 +1116,7 @@ void cliSend(SCliConn* pConn) {
|
||||||
|
|
||||||
if (transQueueEmpty(&pConn->cliMsgs)) {
|
if (transQueueEmpty(&pConn->cliMsgs)) {
|
||||||
tError("%s conn %p not msg to send", pTransInst->label, pConn);
|
tError("%s conn %p not msg to send", pTransInst->label, pConn);
|
||||||
cliHandleExcept(pConn);
|
cliHandleExcept(pConn, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1186,7 +1189,7 @@ void cliSend(SCliConn* pConn) {
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
tGError("%s conn %p failed to send msg:%s, errmsg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType),
|
tGError("%s conn %p failed to send msg:%s, errmsg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType),
|
||||||
uv_err_name(status));
|
uv_err_name(status));
|
||||||
cliHandleExcept(pConn);
|
cliHandleExcept(pConn, -1);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
_RETURN:
|
_RETURN:
|
||||||
|
@ -1242,7 +1245,8 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
|
||||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||||
conn->timer = NULL;
|
conn->timer = NULL;
|
||||||
|
|
||||||
cliHandleFastFail(conn, -1);
|
cliHandleFastFail(conn, terrno);
|
||||||
|
terrno = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
|
@ -1304,7 +1308,7 @@ static void cliSendBatchCb(uv_write_t* req, int status) {
|
||||||
tDebug("%s conn %p failed to send batch msg, batch size:%d, msgLen:%d, reason:%s", CONN_GET_INST_LABEL(conn), conn,
|
tDebug("%s conn %p failed to send batch msg, batch size:%d, msgLen:%d, reason:%s", CONN_GET_INST_LABEL(conn), conn,
|
||||||
p->wLen, p->batchSize, uv_err_name(status));
|
p->wLen, p->batchSize, uv_err_name(status));
|
||||||
|
|
||||||
if (!uv_is_closing((uv_handle_t*)&conn->stream)) cliHandleExcept(conn);
|
if (!uv_is_closing((uv_handle_t*)&conn->stream)) cliHandleExcept(conn, -1);
|
||||||
|
|
||||||
cliHandleBatchReq(nxtBatch, thrd);
|
cliHandleBatchReq(nxtBatch, thrd);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1362,7 +1366,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) {
|
||||||
cliDestroyBatch(pConn->pBatch);
|
cliDestroyBatch(pConn->pBatch);
|
||||||
pConn->pBatch = NULL;
|
pConn->pBatch = NULL;
|
||||||
}
|
}
|
||||||
cliHandleExcept(pConn);
|
cliHandleExcept(pConn, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cliConnCb(uv_connect_t* req, int status) {
|
void cliConnCb(uv_connect_t* req, int status) {
|
||||||
|
@ -1653,7 +1657,8 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
|
||||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||||
conn->timer = NULL;
|
conn->timer = NULL;
|
||||||
|
|
||||||
cliHandleExcept(conn);
|
cliHandleExcept(conn, terrno);
|
||||||
|
terrno = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1667,20 +1672,20 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn,
|
tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn,
|
||||||
tstrerror(TAOS_SYSTEM_ERROR(errno)));
|
tstrerror(TAOS_SYSTEM_ERROR(errno)));
|
||||||
cliHandleExcept(conn);
|
cliHandleExcept(conn, -1);
|
||||||
errno = 0;
|
errno = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd);
|
int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
tGError("%s conn %p failed to set stream, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
|
tGError("%s conn %p failed to set stream, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
|
||||||
cliHandleExcept(conn);
|
cliHandleExcept(conn, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ret = transSetConnOption((uv_tcp_t*)conn->stream, tsKeepAliveIdle);
|
ret = transSetConnOption((uv_tcp_t*)conn->stream, tsKeepAliveIdle);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
tGError("%s conn %p failed to set socket opt, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
|
tGError("%s conn %p failed to set socket opt, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
|
||||||
cliHandleExcept(conn);
|
cliHandleExcept(conn, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue