update fqdn cache
This commit is contained in:
parent
6ff8de1d22
commit
aa8bc83791
|
@ -1608,6 +1608,8 @@ static int32_t cliDoConn(SCliThrd* pThrd, SCliConn* conn) {
|
|||
ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
|
||||
if (ret != 0) {
|
||||
tError("failed connect to %s since %s", conn->dstAddr, uv_err_name(ret));
|
||||
if (ret == )
|
||||
cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr);
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1);
|
||||
}
|
||||
|
||||
|
@ -1699,6 +1701,7 @@ void cliConnCb(uv_connect_t* req, int status) {
|
|||
if (status != 0) {
|
||||
tDebug("%s conn %p failed to connect to %s since %s", CONN_GET_INST_LABEL(pConn), pConn, pConn->dstAddr,
|
||||
uv_strerror(status));
|
||||
cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, pConn->dstAddr);
|
||||
TAOS_UNUSED(transUnrefCliHandle(pConn));
|
||||
return;
|
||||
}
|
||||
|
@ -1850,7 +1853,7 @@ static FORCE_INLINE int32_t cliUpdateFqdnCache(SHashObj* cache, char* fqdn) {
|
|||
size_t len = strlen(fqdn);
|
||||
uint32_t* v = taosHashGet(cache, fqdn, len);
|
||||
if (addr != *v) {
|
||||
char old[TD_IP_LEN] = {0}, new[TD_IP_LEN] = {0};
|
||||
char old[TSDB_FQDN_LEN] = {0}, new[TSDB_FQDN_LEN] = {0};
|
||||
tinet_ntoa(old, *v);
|
||||
tinet_ntoa(new, addr);
|
||||
tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new);
|
||||
|
@ -1870,7 +1873,7 @@ static void cliMayUpdateFqdnCache(SHashObj* cache, char* dst) {
|
|||
if (dst[i] == ':') break;
|
||||
}
|
||||
if (i > 0) {
|
||||
char fqdn[TSDB_FQDN_LEN + 1] = {0};
|
||||
char fqdn[TSDB_FQDN_LEN] = {0};
|
||||
memcpy(fqdn, dst, i);
|
||||
TAOS_UNUSED(cliUpdateFqdnCache(cache, fqdn));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue