From e9a5ee3a5f8d3c79dfeae26a7e33bfd42feceef2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 23 Feb 2022 18:31:22 +0800 Subject: [PATCH] remove global variables --- include/common/tglobal.h | 2 -- source/client/src/clientCfg.c | 3 ++- source/client/src/clientEnv.c | 2 +- source/common/src/tglobal.c | 12 ------------ source/libs/executor/src/executorimpl.c | 2 +- source/libs/qcom/src/queryUtil.c | 2 +- 6 files changed, 5 insertions(+), 18 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 49d8f84d38..b7f8721459 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -23,8 +23,6 @@ extern "C" { #include "tdef.h" // common -extern int32_t tsMaxConnections; -extern int32_t tsMaxShellConns; extern int32_t tsShellActivityTimer; extern uint32_t tsMaxTmrCtrl; extern float tsNumOfThreadsPerCore; diff --git a/source/client/src/clientCfg.c b/source/client/src/clientCfg.c index ca671ab150..22b1407a15 100644 --- a/source/client/src/clientCfg.c +++ b/source/client/src/clientCfg.c @@ -159,8 +159,9 @@ static int32_t tscAddCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "statusInterval", 1, 1, 30) != 0) return -1; if (cfgAddFloat(pCfg, "numOfThreadsPerCore", 1, 0, 10) != 0) return -1; if (cfgAddFloat(pCfg, "ratioOfQueryCores", 1, 0, 5) != 0) return -1; - if (cfgAddInt32(pCfg, "maxShellConns", 50000, 10, 50000000) != 0) return -1; if (cfgAddInt32(pCfg, "shellActivityTimer", 3, 1, 120) != 0) return -1; + + if (cfgAddInt32(pCfg, "maxConnections", 50000, 1, 100000) != 0) return -1; return 0; } diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index c7640e90d8..37227cea6f 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -90,7 +90,7 @@ void* openTransporter(const char *user, const char *auth, int32_t numOfThread) { rpcInit.label = "TSC"; rpcInit.numOfThreads = numOfThread; rpcInit.cfp = processMsgFromServer; - rpcInit.sessions = tsMaxConnections; + rpcInit.sessions = cfgGetItem(tscCfg, "maxConnections")->i32; rpcInit.connType = TAOS_CONN_CLIENT; rpcInit.user = (char *)user; rpcInit.idleTime = tsShellActivityTimer * 1000; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 0042239e1a..f9f00fa9a3 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -29,8 +29,6 @@ // common -int32_t tsMaxShellConns = 50000; -int32_t tsMaxConnections = 50000; int32_t tsShellActivityTimer = 3; // second float tsNumOfThreadsPerCore = 1.0f; int32_t tsNumOfCommitThreads = 4; @@ -440,16 +438,6 @@ static void doInitGlobalConfig(void) { taosAddConfigOption(cfg); - cfg.option = "maxConnections"; - cfg.ptr = &tsMaxConnections; - cfg.valType = TAOS_CFG_VTYPE_INT32; - cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; - cfg.minValue = 1; - cfg.maxValue = 100000; - cfg.ptrLength = 0; - cfg.unitType = TAOS_CFG_UTYPE_NONE; - taosAddConfigOption(cfg); - cfg.option = "minimalLogDirGB"; cfg.ptr = &tsMinimalLogDirGB; cfg.valType = TAOS_CFG_VTYPE_FLOAT; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 5508b5ecd7..b35ce9e7c3 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -5301,7 +5301,7 @@ SOperatorInfo* createExchangeOperatorInfo(const SArray* pSources, const SArray* rpcInit.label = "EX"; rpcInit.numOfThreads = 1; rpcInit.cfp = qProcessFetchRsp; - rpcInit.sessions = tsMaxConnections; + rpcInit.sessions = 50000; //tsMaxConnections; rpcInit.connType = TAOS_CONN_CLIENT; rpcInit.user = (char *)"root"; rpcInit.idleTime = tsShellActivityTimer * 1000; diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 4cd040c238..9b381ad823 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -87,7 +87,7 @@ int32_t initTaskQueue() { double factor = 4.0; int32_t numOfThreads = TMAX((int)(tsNumOfCores * tsNumOfThreadsPerCore / factor), 2); - int32_t queueSize = tsMaxConnections * 2; + int32_t queueSize = 25000; //tsMaxConnections * 2; pTaskQueue = taosInitScheduler(queueSize, numOfThreads, "tsc"); if (NULL == pTaskQueue) { qError("failed to init task queue"); -- GitLab