commit
f2bf418725
|
@ -583,7 +583,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_consumeImp(JNIEn
|
||||||
return 0l;
|
return 0l;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (long)res;
|
return (jlong)res;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_unsubscribeImp(JNIEnv *env, jobject jobj, jlong sub,
|
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_unsubscribeImp(JNIEnv *env, jobject jobj, jlong sub,
|
||||||
|
|
|
@ -972,7 +972,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRes->numOfRows > 0) {
|
if (pRes->numOfRows > 0) {
|
||||||
int32_t currentTotal = pRes->numOfRowsGroup + pRes->numOfRows;
|
int32_t currentTotal = (int32_t)(pRes->numOfRowsGroup + pRes->numOfRows);
|
||||||
|
|
||||||
if (pQueryInfo->limit.limit >= 0 && currentTotal > pQueryInfo->limit.limit) {
|
if (pQueryInfo->limit.limit >= 0 && currentTotal > pQueryInfo->limit.limit) {
|
||||||
int32_t overflow = (int32_t)(currentTotal - pQueryInfo->limit.limit);
|
int32_t overflow = (int32_t)(currentTotal - pQueryInfo->limit.limit);
|
||||||
|
|
|
@ -2390,7 +2390,7 @@ bool validateIpAddress(const char* ip, size_t size) {
|
||||||
|
|
||||||
strncpy(tmp, ip, size);
|
strncpy(tmp, ip, size);
|
||||||
|
|
||||||
in_addr_t epAddr = inet_addr(tmp);
|
in_addr_t epAddr = taosInetAddr(tmp);
|
||||||
|
|
||||||
return epAddr != INADDR_NONE;
|
return epAddr != INADDR_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ void tsSetTimeZone() {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t tz = (-timezone * MILLISECOND_PER_SECOND) / MILLISECOND_PER_HOUR;
|
int32_t tz = (int32_t)((-timezone * MILLISECOND_PER_SECOND) / MILLISECOND_PER_HOUR);
|
||||||
tz += daylight;
|
tz += daylight;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -65,6 +65,10 @@ void taosBlockSIGPIPE();
|
||||||
// TAOS_OS_FUNC_SOCKET_SETSOCKETOPT
|
// TAOS_OS_FUNC_SOCKET_SETSOCKETOPT
|
||||||
int taosSetSockOpt(SOCKET socketfd, int level, int optname, void *optval, int optlen);
|
int taosSetSockOpt(SOCKET socketfd, int level, int optname, void *optval, int optlen);
|
||||||
|
|
||||||
|
// TAOS_OS_FUNC_SOCKET_INET
|
||||||
|
uint32_t taosInetAddr(char *ipAddr);
|
||||||
|
const char *taosInetNtoa(struct in_addr ipInt);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -164,9 +164,25 @@ int gettimeofday(struct timeval *ptv, void *pTimeZone);
|
||||||
#define MSG_NOSIGNAL 0
|
#define MSG_NOSIGNAL 0
|
||||||
#define SO_NO_CHECK 0x1234
|
#define SO_NO_CHECK 0x1234
|
||||||
#define SOL_TCP 0x1234
|
#define SOL_TCP 0x1234
|
||||||
#define TCP_KEEPCNT 0x1234
|
|
||||||
#define TCP_KEEPIDLE 0x1234
|
#ifndef TCP_KEEPCNT
|
||||||
#define TCP_KEEPINTVL 0x1234
|
#define TCP_KEEPCNT 0x1234
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TCP_KEEPIDLE
|
||||||
|
#define TCP_KEEPIDLE 0x1234
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TCP_KEEPINTVL
|
||||||
|
#define TCP_KEEPINTVL 0x1234
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#if _MSC_VER >= 1900
|
||||||
|
#define TAOS_OS_FUNC_SOCKET_INET
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SHUT_RDWR SD_BOTH
|
#define SHUT_RDWR SD_BOTH
|
||||||
#define SHUT_RD SD_RECEIVE
|
#define SHUT_RD SD_RECEIVE
|
||||||
#define SHUT_WR SD_SEND
|
#define SHUT_WR SD_SEND
|
||||||
|
|
|
@ -57,4 +57,16 @@ int taosSetSockOpt(SOCKET socketfd, int level, int optname, void *optval, int op
|
||||||
return setsockopt(socketfd, level, optname, optval, (socklen_t)optlen);
|
return setsockopt(socketfd, level, optname, optval, (socklen_t)optlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TAOS_OS_FUNC_SOCKET_INET
|
||||||
|
|
||||||
|
uint32_t taosInetAddr(char *ipAddr) {
|
||||||
|
return inet_addr(ipAddr);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *taosInetNtoa(struct in_addr ipInt) {
|
||||||
|
return inet_ntoa(ipInt);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -61,8 +61,15 @@ int64_t user_mktime64(const unsigned int year0, const unsigned int mon0,
|
||||||
res = res*24;
|
res = res*24;
|
||||||
res = ((res + hour) * 60 + min) * 60 + sec;
|
res = ((res + hour) * 60 + min) * 60 + sec;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#if _MSC_VER >= 1900
|
||||||
|
int64_t timezone = _timezone;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
return (res + timezone);
|
return (res + timezone);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==== mktime() kernel code =================//
|
// ==== mktime() kernel code =================//
|
||||||
static int64_t m_deltaUtc = 0;
|
static int64_t m_deltaUtc = 0;
|
||||||
void deltaToUtcInitOnce() {
|
void deltaToUtcInitOnce() {
|
||||||
|
|
|
@ -62,4 +62,24 @@ int taosSetSockOpt(SOCKET socketfd, int level, int optname, void *optval, int op
|
||||||
}
|
}
|
||||||
|
|
||||||
return setsockopt(socketfd, level, optname, optval, optlen);
|
return setsockopt(socketfd, level, optname, optval, optlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TAOS_OS_FUNC_SOCKET_INET
|
||||||
|
|
||||||
|
uint32_t taosInetAddr(char *ipAddr) {
|
||||||
|
uint32_t value;
|
||||||
|
int ret = inet_pton(AF_INET, ipAddr, &value);
|
||||||
|
if (ret <= 0) {
|
||||||
|
return INADDR_NONE;
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *taosInetNtoa(struct in_addr ipInt) {
|
||||||
|
// not thread safe, only for debug usage while print log
|
||||||
|
static char tmpDstStr[16];
|
||||||
|
return inet_ntop(AF_INET, &ipInt, tmpDstStr, INET6_ADDRSTRLEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -302,7 +302,7 @@ static void *httpAcceptHttpConnection(void *arg) {
|
||||||
#if 0
|
#if 0
|
||||||
if (totalFds > tsHttpCacheSessions * 100) {
|
if (totalFds > tsHttpCacheSessions * 100) {
|
||||||
httpError("fd:%d, ip:%s:%u, totalFds:%d larger than httpCacheSessions:%d*100, refuse connection", connFd,
|
httpError("fd:%d, ip:%s:%u, totalFds:%d larger than httpCacheSessions:%d*100, refuse connection", connFd,
|
||||||
inet_ntoa(clientAddr.sin_addr), htons(clientAddr.sin_port), totalFds, tsHttpCacheSessions);
|
taosInetNtoa(clientAddr.sin_addr), htons(clientAddr.sin_port), totalFds, tsHttpCacheSessions);
|
||||||
taosCloseSocket(connFd);
|
taosCloseSocket(connFd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -316,14 +316,14 @@ static void *httpAcceptHttpConnection(void *arg) {
|
||||||
|
|
||||||
pContext = httpCreateContext(connFd);
|
pContext = httpCreateContext(connFd);
|
||||||
if (pContext == NULL) {
|
if (pContext == NULL) {
|
||||||
httpError("fd:%d, ip:%s:%u, no enough resource to allocate http context", connFd, inet_ntoa(clientAddr.sin_addr),
|
httpError("fd:%d, ip:%s:%u, no enough resource to allocate http context", connFd, taosInetNtoa(clientAddr.sin_addr),
|
||||||
htons(clientAddr.sin_port));
|
htons(clientAddr.sin_port));
|
||||||
taosCloseSocket(connFd);
|
taosCloseSocket(connFd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pContext->pThread = pThread;
|
pContext->pThread = pThread;
|
||||||
sprintf(pContext->ipstr, "%s:%u", inet_ntoa(clientAddr.sin_addr), htons(clientAddr.sin_port));
|
sprintf(pContext->ipstr, "%s:%u", taosInetNtoa(clientAddr.sin_addr), htons(clientAddr.sin_port));
|
||||||
|
|
||||||
struct epoll_event event;
|
struct epoll_event event;
|
||||||
event.events = EPOLLIN | EPOLLPRI | EPOLLWAKEUP | EPOLLERR | EPOLLHUP | EPOLLRDHUP;
|
event.events = EPOLLIN | EPOLLPRI | EPOLLWAKEUP | EPOLLERR | EPOLLHUP | EPOLLRDHUP;
|
||||||
|
|
|
@ -234,17 +234,22 @@ static void monitorInitDatabaseCb(void *param, TAOS_RES *result, int32_t code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void monitorStopSystem() {
|
void monitorStopSystem() {
|
||||||
monitorInfo("monitor module is stopped");
|
if (tsMonitorConn.state == MONITOR_STATE_STOPPED) return;
|
||||||
monitorExecuteSQLFp = NULL;
|
|
||||||
tsMonitorConn.state = MONITOR_STATE_STOPPED;
|
tsMonitorConn.state = MONITOR_STATE_STOPPED;
|
||||||
|
monitorExecuteSQLFp = NULL;
|
||||||
|
|
||||||
|
monitorInfo("monitor module is stopped");
|
||||||
|
|
||||||
if (tsMonitorConn.initTimer != NULL) {
|
if (tsMonitorConn.initTimer != NULL) {
|
||||||
taosTmrStopA(&(tsMonitorConn.initTimer));
|
taosTmrStopA(&(tsMonitorConn.initTimer));
|
||||||
}
|
}
|
||||||
if (tsMonitorConn.timer != NULL) {
|
if (tsMonitorConn.timer != NULL) {
|
||||||
taosTmrStopA(&(tsMonitorConn.timer));
|
taosTmrStopA(&(tsMonitorConn.timer));
|
||||||
}
|
}
|
||||||
|
if (tsMonitorConn.conn != NULL) {
|
||||||
taos_close(tsMonitorConn.conn);
|
taos_close(tsMonitorConn.conn);
|
||||||
|
tsMonitorConn.conn = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void monitorCleanUpSystem() {
|
void monitorCleanUpSystem() {
|
||||||
|
|
|
@ -254,11 +254,11 @@ static void *taosAcceptTcpConnection(void *arg) {
|
||||||
pFdObj->ip = caddr.sin_addr.s_addr;
|
pFdObj->ip = caddr.sin_addr.s_addr;
|
||||||
pFdObj->port = htons(caddr.sin_port);
|
pFdObj->port = htons(caddr.sin_port);
|
||||||
tDebug("%s new TCP connection from %s:%hu, fd:%d FD:%p numOfFds:%d", pServerObj->label,
|
tDebug("%s new TCP connection from %s:%hu, fd:%d FD:%p numOfFds:%d", pServerObj->label,
|
||||||
inet_ntoa(caddr.sin_addr), pFdObj->port, connFd, pFdObj, pThreadObj->numOfFds);
|
taosInetNtoa(caddr.sin_addr), pFdObj->port, connFd, pFdObj, pThreadObj->numOfFds);
|
||||||
} else {
|
} else {
|
||||||
taosCloseSocket(connFd);
|
taosCloseSocket(connFd);
|
||||||
tError("%s failed to malloc FdObj(%s) for connection from:%s:%hu", pServerObj->label, strerror(errno),
|
tError("%s failed to malloc FdObj(%s) for connection from:%s:%hu", pServerObj->label, strerror(errno),
|
||||||
inet_ntoa(caddr.sin_addr), htons(caddr.sin_port));
|
taosInetNtoa(caddr.sin_addr), htons(caddr.sin_port));
|
||||||
}
|
}
|
||||||
|
|
||||||
// pick up next thread for next connection
|
// pick up next thread for next connection
|
||||||
|
|
|
@ -133,7 +133,7 @@ static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void taosReadIpStrConfig(SGlobalCfg *cfg, char *input_value) {
|
static void taosReadIpStrConfig(SGlobalCfg *cfg, char *input_value) {
|
||||||
uint32_t value = inet_addr(input_value);
|
uint32_t value = taosInetAddr(input_value);
|
||||||
char * option = (char *)cfg->ptr;
|
char * option = (char *)cfg->ptr;
|
||||||
if (value == INADDR_NONE) {
|
if (value == INADDR_NONE) {
|
||||||
uError("config option:%s, input value:%s, is not a valid ip address, use default value:%s",
|
uError("config option:%s, input value:%s, is not a valid ip address, use default value:%s",
|
||||||
|
|
|
@ -748,11 +748,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
|
||||||
sprintf(value, "%d", *((int *)row[i]));
|
sprintf(value, "%d", *((int *)row[i]));
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_BIGINT:
|
case TSDB_DATA_TYPE_BIGINT:
|
||||||
#ifdef _TD_ARM_32_
|
sprintf(value, "%" PRId64, *((int64_t *)row[i]));
|
||||||
sprintf(value, "%lld", *((int64_t *)row[i]));
|
|
||||||
#else
|
|
||||||
sprintf(value, "%ld", *((int64_t *)row[i]));
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_FLOAT:{
|
case TSDB_DATA_TYPE_FLOAT:{
|
||||||
#ifdef _TD_ARM_32_
|
#ifdef _TD_ARM_32_
|
||||||
|
|
Loading…
Reference in New Issue