Merge pull request #29056 from taosdata/enh/addPerfLog
add perf log to blocking-sys-call
This commit is contained in:
commit
ca66bc0885
|
@ -233,15 +233,19 @@ int32_t taosBlockSIGPIPE() {
|
|||
}
|
||||
|
||||
int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t *ip) {
|
||||
int32_t code = 0;
|
||||
OS_PARAM_CHECK(fqdn);
|
||||
OS_PARAM_CHECK(ip);
|
||||
int64_t limitMs = 1000;
|
||||
int64_t st = taosGetTimestampMs(), cost = 0;
|
||||
#ifdef WINDOWS
|
||||
// Initialize Winsock
|
||||
WSADATA wsaData;
|
||||
int iResult;
|
||||
iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||
if (iResult != 0) {
|
||||
return TAOS_SYSTEM_WINSOCKET_ERROR(WSAGetLastError());
|
||||
code = TAOS_SYSTEM_WINSOCKET_ERROR(WSAGetLastError());
|
||||
goto _err;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -260,12 +264,12 @@ int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t *ip) {
|
|||
inRetry = true;
|
||||
continue;
|
||||
} else if (EAI_SYSTEM == ret) {
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
return terrno;
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
goto _err;
|
||||
}
|
||||
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
return terrno;
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
goto _err;
|
||||
}
|
||||
|
||||
struct sockaddr *sa = result->ai_addr;
|
||||
|
@ -275,8 +279,7 @@ int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t *ip) {
|
|||
*ip = ia.s_addr;
|
||||
|
||||
freeaddrinfo(result);
|
||||
|
||||
return 0;
|
||||
goto _err;
|
||||
}
|
||||
#else
|
||||
struct addrinfo hints = {0};
|
||||
|
@ -292,7 +295,7 @@ int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t *ip) {
|
|||
struct in_addr ia = si->sin_addr;
|
||||
*ip = ia.s_addr;
|
||||
freeaddrinfo(result);
|
||||
return 0;
|
||||
goto _err;
|
||||
} else {
|
||||
#ifdef EAI_SYSTEM
|
||||
if (ret == EAI_SYSTEM) {
|
||||
|
@ -305,9 +308,16 @@ int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t *ip) {
|
|||
#endif
|
||||
|
||||
*ip = 0xFFFFFFFF;
|
||||
return TSDB_CODE_RPC_FQDN_ERROR;
|
||||
code = TSDB_CODE_RPC_FQDN_ERROR;
|
||||
goto _err;
|
||||
}
|
||||
#endif
|
||||
_err:
|
||||
cost = taosGetTimestampMs() - st;
|
||||
if (cost >= limitMs) {
|
||||
uWarn("get ip from fqdn:%s, cost:%" PRId64 "ms", fqdn, cost);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t taosGetFqdn(char *fqdn) {
|
||||
|
|
Loading…
Reference in New Issue