提交 60edeb43 编写于 作者: S slguan

fix the issue #376

上级 8e11a6b8
...@@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED) ...@@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED)
ADD_CUSTOM_COMMAND(OUTPUT ${JDBC_CMD_NAME} ADD_CUSTOM_COMMAND(OUTPUT ${JDBC_CMD_NAME}
POST_BUILD POST_BUILD
COMMAND mvn -Dmaven.test.skip=true install -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml COMMAND mvn -Dmaven.test.skip=true install -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver*dist.* ${EXECUTABLE_OUTPUT_PATH}/../lib/ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-1.0.1-dist.jar ${LIBRARY_OUTPUT_PATH}
COMMAND mvn -Dmaven.test.skip=true clean -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml COMMAND mvn -Dmaven.test.skip=true clean -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml
COMMENT "build jdbc driver") COMMENT "build jdbc driver")
ADD_CUSTOM_TARGET(${JDBC_TARGET_NAME} ALL WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} DEPENDS ${JDBC_CMD_NAME}) ADD_CUSTOM_TARGET(${JDBC_TARGET_NAME} ALL WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} DEPENDS ${JDBC_CMD_NAME})
......
...@@ -178,6 +178,7 @@ void tsInitGlobalConfig(); ...@@ -178,6 +178,7 @@ void tsInitGlobalConfig();
#define TSDB_CFG_CTYPE_B_LOG 4 // is a log type configuration #define TSDB_CFG_CTYPE_B_LOG 4 // is a log type configuration
#define TSDB_CFG_CTYPE_B_CLIENT 8 // can be displayed in the client log #define TSDB_CFG_CTYPE_B_CLIENT 8 // can be displayed in the client log
#define TSDB_CFG_CTYPE_B_OPTION 16 // can be configured by taos_options function #define TSDB_CFG_CTYPE_B_OPTION 16 // can be configured by taos_options function
#define TSDB_CFG_CTYPE_B_NOT_PRINT 32
#define TSDB_CFG_CSTATUS_NONE 0 // not configured #define TSDB_CFG_CSTATUS_NONE 0 // not configured
#define TSDB_CFG_CSTATUS_DEFAULT 1 // use system default value #define TSDB_CFG_CSTATUS_DEFAULT 1 // use system default value
......
...@@ -269,20 +269,6 @@ void httpCleanUpConnect(HttpServer *pServer) { ...@@ -269,20 +269,6 @@ void httpCleanUpConnect(HttpServer *pServer) {
httpTrace("http server:%s is cleaned up", pServer->label); httpTrace("http server:%s is cleaned up", pServer->label);
} }
void httpCloseDeadConnects(HttpThread *pThread) {
int32_t thresholdSec = taosGetTimestampSec() - 3600;
HttpContext *pContext = (HttpContext*)pThread->pHead;
while (pContext != NULL && pContext == pContext->signature) {
HttpContext *pContextNext = pContext->next;
if (pContext->lastAccessTime < thresholdSec) {
httpPrint("context:%p, fd:%d, ip:%s, lastAccessTime:%d smaller then threshold:%d, so close it",
pContext, pContext->fd, pContext->ipstr, pContext->lastAccessTime, thresholdSec);
httpCloseContextByServer(pThread, pContext);
}
pContext = pContextNext;
}
}
// read all the data, then just discard it // read all the data, then just discard it
void httpReadDirtyData(int fd) { void httpReadDirtyData(int fd) {
char data[1024] = {0}; char data[1024] = {0};
...@@ -486,7 +472,6 @@ void httpAcceptHttpConnection(void *arg) { ...@@ -486,7 +472,6 @@ void httpAcceptHttpConnection(void *arg) {
struct sockaddr_in clientAddr; struct sockaddr_in clientAddr;
int sockFd; int sockFd;
int threadId = 0; int threadId = 0;
const int connThreshold = 2 * tsHttpCacheSessions / tsHttpMaxThreads;
HttpThread * pThread; HttpThread * pThread;
HttpServer * pServer; HttpServer * pServer;
HttpContext * pContext; HttpContext * pContext;
...@@ -570,9 +555,6 @@ void httpAcceptHttpConnection(void *arg) { ...@@ -570,9 +555,6 @@ void httpAcceptHttpConnection(void *arg) {
pContext, connFd, inet_ntoa(clientAddr.sin_addr), htons(clientAddr.sin_port), pThread->label, pContext, connFd, inet_ntoa(clientAddr.sin_addr), htons(clientAddr.sin_port), pThread->label,
pThread->numOfFds); pThread->numOfFds);
if (pThread->numOfFds > connThreshold) {
httpCloseDeadConnects(pThread);
}
// pick up next thread for next connection // pick up next thread for next connection
threadId++; threadId++;
threadId = threadId % pServer->numOfThreads; threadId = threadId % pServer->numOfThreads;
......
...@@ -483,7 +483,7 @@ void tsInitGlobalConfig() { ...@@ -483,7 +483,7 @@ void tsInitGlobalConfig() {
tsInitConfigOption(cfg++, "defaultUser", tsDefaultUser, TSDB_CFG_VTYPE_STRING, tsInitConfigOption(cfg++, "defaultUser", tsDefaultUser, TSDB_CFG_VTYPE_STRING,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT, 0, 0, TSDB_USER_LEN, TSDB_CFG_UTYPE_NONE); TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT, 0, 0, TSDB_USER_LEN, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "defaultPass", tsDefaultPass, TSDB_CFG_VTYPE_STRING, tsInitConfigOption(cfg++, "defaultPass", tsDefaultPass, TSDB_CFG_VTYPE_STRING,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT, 0, 0, TSDB_PASSWORD_LEN, TSDB_CFG_UTYPE_NONE); TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_NOT_PRINT, 0, 0, TSDB_PASSWORD_LEN, TSDB_CFG_UTYPE_NONE);
// locale & charset // locale & charset
tsInitConfigOption(cfg++, "timezone", tsTimezone, TSDB_CFG_VTYPE_STRING, tsInitConfigOption(cfg++, "timezone", tsTimezone, TSDB_CFG_VTYPE_STRING,
...@@ -754,6 +754,7 @@ void tsPrintGlobalConfig() { ...@@ -754,6 +754,7 @@ void tsPrintGlobalConfig() {
for (int i = 0; i < tsGlobalConfigNum; ++i) { for (int i = 0; i < tsGlobalConfigNum; ++i) {
SGlobalConfig *cfg = tsGlobalConfig + i; SGlobalConfig *cfg = tsGlobalConfig + i;
if (tscEmbedded == 0 && !(cfg->cfgType & TSDB_CFG_CTYPE_B_CLIENT)) continue; if (tscEmbedded == 0 && !(cfg->cfgType & TSDB_CFG_CTYPE_B_CLIENT)) continue;
if (cfg->cfgType & TSDB_CFG_CTYPE_B_NOT_PRINT) continue;
int optionLen = (int)strlen(cfg->option); int optionLen = (int)strlen(cfg->option);
int blankLen = TSDB_CFG_PRINT_LEN - optionLen; int blankLen = TSDB_CFG_PRINT_LEN - optionLen;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册