config
This commit is contained in:
parent
d15e60d1ce
commit
5e3e048569
|
@ -25,22 +25,12 @@ extern "C" {
|
||||||
/* ------------------------ TYPES EXPOSED ---------------- */
|
/* ------------------------ TYPES EXPOSED ---------------- */
|
||||||
typedef struct SDnode SDnode;
|
typedef struct SDnode SDnode;
|
||||||
|
|
||||||
/* ------------------------ Environment ------------------ */
|
|
||||||
typedef struct {
|
|
||||||
int32_t sver;
|
|
||||||
int32_t numOfCores;
|
|
||||||
uint16_t numOfCommitThreads;
|
|
||||||
bool enableTelem;
|
|
||||||
bool printAuth;
|
|
||||||
} SDnodeEnvCfg;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the environment
|
* @brief Initialize the environment
|
||||||
*
|
*
|
||||||
* @param pOption Option of the environment
|
|
||||||
* @return int32_t 0 for success and -1 for failure
|
* @return int32_t 0 for success and -1 for failure
|
||||||
*/
|
*/
|
||||||
int32_t dndInit(const SDnodeEnvCfg *pCfg);
|
int32_t dndInit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief clear the environment
|
* @brief clear the environment
|
||||||
|
@ -51,12 +41,6 @@ void dndCleanup();
|
||||||
/* ------------------------ SDnode ----------------------- */
|
/* ------------------------ SDnode ----------------------- */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t numOfSupportVnodes;
|
int32_t numOfSupportVnodes;
|
||||||
// int32_t statusInterval;
|
|
||||||
// float numOfThreadsPerCore;
|
|
||||||
// float ratioOfQueryCores;
|
|
||||||
// int32_t maxShellConns;
|
|
||||||
// int32_t shellActivityTimer;
|
|
||||||
|
|
||||||
uint16_t serverPort;
|
uint16_t serverPort;
|
||||||
char dataDir[TSDB_FILENAME_LEN];
|
char dataDir[TSDB_FILENAME_LEN];
|
||||||
char localEp[TSDB_EP_LEN];
|
char localEp[TSDB_EP_LEN];
|
||||||
|
|
|
@ -220,7 +220,6 @@ static void taosAddClientLogCfg(SConfig *pCfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void taosAddServerLogCfg(SConfig *pCfg) {
|
static void taosAddServerLogCfg(SConfig *pCfg) {
|
||||||
taosAddClientLogCfg(pCfg);
|
|
||||||
cfgAddInt32(pCfg, "dDebugFlag", dDebugFlag, 0, 255, 0);
|
cfgAddInt32(pCfg, "dDebugFlag", dDebugFlag, 0, 255, 0);
|
||||||
cfgAddInt32(pCfg, "vDebugFlag", vDebugFlag, 0, 255, 0);
|
cfgAddInt32(pCfg, "vDebugFlag", vDebugFlag, 0, 255, 0);
|
||||||
cfgAddInt32(pCfg, "mDebugFlag", mDebugFlag, 0, 255, 0);
|
cfgAddInt32(pCfg, "mDebugFlag", mDebugFlag, 0, 255, 0);
|
||||||
|
@ -277,7 +276,6 @@ static void taosAddClientCfg(SConfig *pCfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void taosAddServerCfg(SConfig *pCfg) {
|
static void taosAddServerCfg(SConfig *pCfg) {
|
||||||
taosAddClientCfg(pCfg);
|
|
||||||
cfgAddInt32(pCfg, "supportVnodes", 256, 0, 65536, 0);
|
cfgAddInt32(pCfg, "supportVnodes", 256, 0, 65536, 0);
|
||||||
cfgAddDir(pCfg, "dataDir", osDataDir(), 0);
|
cfgAddDir(pCfg, "dataDir", osDataDir(), 0);
|
||||||
cfgAddFloat(pCfg, "minimalDataDirGB", 2.0f, 0.001f, 10000000, 0);
|
cfgAddFloat(pCfg, "minimalDataDirGB", 2.0f, 0.001f, 10000000, 0);
|
||||||
|
@ -324,7 +322,6 @@ static void taosSetServerLogCfg(SConfig *pCfg) {
|
||||||
tsdbDebugFlag = cfgGetItem(pCfg, "tsdbDebugFlag")->i32;
|
tsdbDebugFlag = cfgGetItem(pCfg, "tsdbDebugFlag")->i32;
|
||||||
tqDebugFlag = cfgGetItem(pCfg, "tqDebugFlag")->i32;
|
tqDebugFlag = cfgGetItem(pCfg, "tqDebugFlag")->i32;
|
||||||
fsDebugFlag = cfgGetItem(pCfg, "fsDebugFlag")->i32;
|
fsDebugFlag = cfgGetItem(pCfg, "fsDebugFlag")->i32;
|
||||||
taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void taosSetClientCfg(SConfig *pCfg) {
|
static void taosSetClientCfg(SConfig *pCfg) {
|
||||||
|
@ -342,12 +339,15 @@ static void taosSetClientCfg(SConfig *pCfg) {
|
||||||
cfgSetItem(pCfg, "timezone", osTimezone(), pItem->stype);
|
cfgSetItem(pCfg, "timezone", osTimezone(), pItem->stype);
|
||||||
|
|
||||||
taosGetSystemInfo();
|
taosGetSystemInfo();
|
||||||
if (tsNumOfCores <= 0) {
|
if (tsNumOfCores <= 1) {
|
||||||
tsNumOfCores = 1;
|
tsNumOfCores = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval;
|
bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval;
|
||||||
taosSetCoreDump(enableCore);
|
taosSetCoreDump(enableCore);
|
||||||
|
|
||||||
|
// todo
|
||||||
|
tsVersion = 30000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void taosSetServerCfg(SConfig *pCfg) {
|
static void taosSetServerCfg(SConfig *pCfg) {
|
||||||
|
@ -363,15 +363,16 @@ static void taosSetServerCfg(SConfig *pCfg) {
|
||||||
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char *envFile,
|
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char *envFile,
|
||||||
const char *apolloUrl, bool tsc) {
|
const char *apolloUrl, bool tsc) {
|
||||||
SConfig *pCfg = cfgInit();
|
SConfig *pCfg = cfgInit();
|
||||||
if (tsCfg == NULL) return -1;
|
if (pCfg == NULL) return -1;
|
||||||
|
|
||||||
if (tsc) {
|
if (tsc) {
|
||||||
taosAddClientLogCfg(pCfg);
|
taosAddClientLogCfg(pCfg);
|
||||||
} else {
|
} else {
|
||||||
|
taosAddClientLogCfg(pCfg);
|
||||||
taosAddServerLogCfg(pCfg);
|
taosAddServerLogCfg(pCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosLoadCfg(tsCfg, cfgDir, envFile, apolloUrl) != 0) {
|
if (taosLoadCfg(pCfg, cfgDir, envFile, apolloUrl) != 0) {
|
||||||
uError("failed to load cfg since %s", terrstr());
|
uError("failed to load cfg since %s", terrstr());
|
||||||
cfgCleanup(pCfg);
|
cfgCleanup(pCfg);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -379,8 +380,11 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
|
||||||
|
|
||||||
if (tsc) {
|
if (tsc) {
|
||||||
taosSetClientLogCfg(pCfg);
|
taosSetClientLogCfg(pCfg);
|
||||||
|
taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32);
|
||||||
} else {
|
} else {
|
||||||
|
taosSetClientLogCfg(pCfg);
|
||||||
taosSetServerLogCfg(pCfg);
|
taosSetServerLogCfg(pCfg);
|
||||||
|
taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosInitLog(logname, logFileNum) != 0) {
|
if (taosInitLog(logname, logFileNum) != 0) {
|
||||||
|
@ -396,12 +400,15 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
|
||||||
int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloUrl, bool tsc) {
|
int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloUrl, bool tsc) {
|
||||||
if (tsCfg != NULL) return 0;
|
if (tsCfg != NULL) return 0;
|
||||||
tsCfg = cfgInit();
|
tsCfg = cfgInit();
|
||||||
if (tsCfg == NULL) return -1;
|
|
||||||
|
|
||||||
if (tsc) {
|
if (tsc) {
|
||||||
taosAddServerCfg(tsCfg);
|
taosAddClientLogCfg(tsCfg);
|
||||||
} else {
|
|
||||||
taosAddClientCfg(tsCfg);
|
taosAddClientCfg(tsCfg);
|
||||||
|
} else {
|
||||||
|
taosAddClientLogCfg(tsCfg);
|
||||||
|
taosAddServerLogCfg(tsCfg);
|
||||||
|
taosAddClientCfg(tsCfg);
|
||||||
|
taosAddServerCfg(tsCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosLoadCfg(tsCfg, cfgDir, envFile, apolloUrl) != 0) {
|
if (taosLoadCfg(tsCfg, cfgDir, envFile, apolloUrl) != 0) {
|
||||||
|
@ -414,6 +421,7 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
|
||||||
if (tsc) {
|
if (tsc) {
|
||||||
taosSetClientCfg(tsCfg);
|
taosSetClientCfg(tsCfg);
|
||||||
} else {
|
} else {
|
||||||
|
taosSetClientCfg(tsCfg);
|
||||||
taosSetServerCfg(tsCfg);
|
taosSetServerCfg(tsCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,6 +444,6 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
|
||||||
|
|
||||||
if (strcasecmp(option, "resetlog") == 0) {
|
if (strcasecmp(option, "resetlog") == 0) {
|
||||||
taosResetLog();
|
taosResetLog();
|
||||||
// taosPrintCfg();
|
cfgDumpCfg(tsCfg, 1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -28,7 +28,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDnodeEnvCfg dmnGetEnvCfg();
|
|
||||||
SDnodeObjCfg dmnGetObjCfg();
|
SDnodeObjCfg dmnGetObjCfg();
|
||||||
|
|
||||||
void dmnDumpCfg();
|
void dmnDumpCfg();
|
||||||
|
|
|
@ -17,18 +17,6 @@
|
||||||
#include "dmnInt.h"
|
#include "dmnInt.h"
|
||||||
#include "tconfig.h"
|
#include "tconfig.h"
|
||||||
|
|
||||||
SDnodeEnvCfg dmnGetEnvCfg() {
|
|
||||||
SConfig *pCfg = taosGetCfg();
|
|
||||||
SDnodeEnvCfg envCfg = {0};
|
|
||||||
|
|
||||||
const char *vstr = cfgGetItem(pCfg, "version")->str;
|
|
||||||
envCfg.sver = 30000000;
|
|
||||||
envCfg.numOfCores = cfgGetItem(pCfg, "numOfCores")->i32;
|
|
||||||
envCfg.numOfCommitThreads = (uint16_t)cfgGetItem(pCfg, "numOfCommitThreads")->i32;
|
|
||||||
envCfg.enableTelem = cfgGetItem(pCfg, "telemetryReporting")->bval;
|
|
||||||
return envCfg;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDnodeObjCfg dmnGetObjCfg() {
|
SDnodeObjCfg dmnGetObjCfg() {
|
||||||
SConfig *pCfg = taosGetCfg();
|
SConfig *pCfg = taosGetCfg();
|
||||||
SDnodeObjCfg objCfg = {0};
|
SDnodeObjCfg objCfg = {0};
|
||||||
|
|
|
@ -73,8 +73,7 @@ static int32_t dmnParseOption(int32_t argc, char const *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dmnRunDnode() {
|
int32_t dmnRunDnode() {
|
||||||
SDnodeEnvCfg envCfg = dmnGetEnvCfg();
|
if (dndInit() != 0) {
|
||||||
if (dndInit(&envCfg) != 0) {
|
|
||||||
uInfo("Failed to start TDengine, please check the log");
|
uInfo("Failed to start TDengine, please check the log");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +92,7 @@ int32_t dmnRunDnode() {
|
||||||
dndClose(pDnode);
|
dndClose(pDnode);
|
||||||
dndCleanup();
|
dndCleanup();
|
||||||
taosCloseLog();
|
taosCloseLog();
|
||||||
|
taosCleanupCfg();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,12 +113,12 @@ int main(int argc, char const *argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosCreateLog("taosdlog", 1, configDir, dmn.envFile, dmn.apolloUrl, 1) != 0) {
|
if (taosCreateLog("taosdlog", 1, configDir, dmn.envFile, dmn.apolloUrl, 0) != 0) {
|
||||||
uInfo("Failed to start TDengine since read config error");
|
uInfo("Failed to start TDengine since read config error");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosInitCfg(configDir, dmn.envFile, dmn.apolloUrl, 1) != 0) {
|
if (taosInitCfg(configDir, dmn.envFile, dmn.apolloUrl, 0) != 0) {
|
||||||
uInfo("Failed to start TDengine since read config error");
|
uInfo("Failed to start TDengine since read config error");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,5 @@ int main(int argc, char const *argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = dmnRunDnode();
|
return dmnRunDnode();
|
||||||
taosCleanupCfg();
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,6 @@ typedef struct {
|
||||||
typedef struct SDnode {
|
typedef struct SDnode {
|
||||||
EStat stat;
|
EStat stat;
|
||||||
SDnodeObjCfg cfg;
|
SDnodeObjCfg cfg;
|
||||||
SDnodeEnvCfg env;
|
|
||||||
SDnodeDir dir;
|
SDnodeDir dir;
|
||||||
FileFd lockFd;
|
FileFd lockFd;
|
||||||
SDnodeMgmt dmgmt;
|
SDnodeMgmt dmgmt;
|
||||||
|
@ -138,11 +137,6 @@ typedef struct SDnode {
|
||||||
SStartupReq startup;
|
SStartupReq startup;
|
||||||
} SDnode;
|
} SDnode;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int8_t once;
|
|
||||||
SDnodeEnvCfg cfg;
|
|
||||||
} SDnodeEnv;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -179,7 +179,7 @@ static void dndBuildBnodeOption(SDnode *pDnode, SBnodeOpt *pOption) {
|
||||||
pOption->sendRedirectRspFp = dndSendRedirectRsp;
|
pOption->sendRedirectRspFp = dndSendRedirectRsp;
|
||||||
pOption->dnodeId = dndGetDnodeId(pDnode);
|
pOption->dnodeId = dndGetDnodeId(pDnode);
|
||||||
pOption->clusterId = dndGetClusterId(pDnode);
|
pOption->clusterId = dndGetClusterId(pDnode);
|
||||||
pOption->sver = pDnode->env.sver;
|
pOption->sver = tsVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t dndOpenBnode(SDnode *pDnode) {
|
static int32_t dndOpenBnode(SDnode *pDnode) {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "tfs.h"
|
#include "tfs.h"
|
||||||
#include "wal.h"
|
#include "wal.h"
|
||||||
|
|
||||||
static SDnodeEnv dndEnv = {0};
|
static int8_t once = DND_ENV_INIT;
|
||||||
|
|
||||||
EStat dndGetStat(SDnode *pDnode) { return pDnode->stat; }
|
EStat dndGetStat(SDnode *pDnode) { return pDnode->stat; }
|
||||||
|
|
||||||
|
@ -137,7 +137,6 @@ static int32_t dndCreateImp(SDnode *pDnode, SDnodeObjCfg *pCfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&pDnode->cfg, pCfg, sizeof(SDnodeObjCfg));
|
memcpy(&pDnode->cfg, pCfg, sizeof(SDnodeObjCfg));
|
||||||
memcpy(&pDnode->env, &dndEnv.cfg, sizeof(SDnodeEnvCfg));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,8 +258,8 @@ void dndClose(SDnode *pDnode) {
|
||||||
dInfo("dnode object is closed, data:%p", pDnode);
|
dInfo("dnode object is closed, data:%p", pDnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dndInit(const SDnodeEnvCfg *pCfg) {
|
int32_t dndInit() {
|
||||||
if (atomic_val_compare_exchange_8(&dndEnv.once, DND_ENV_INIT, DND_ENV_READY) != DND_ENV_INIT) {
|
if (atomic_val_compare_exchange_8(&once, DND_ENV_INIT, DND_ENV_READY) != DND_ENV_INIT) {
|
||||||
terrno = TSDB_CODE_REPEAT_INIT;
|
terrno = TSDB_CODE_REPEAT_INIT;
|
||||||
dError("failed to init dnode env since %s", terrstr());
|
dError("failed to init dnode env since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -283,8 +282,8 @@ int32_t dndInit(const SDnodeEnvCfg *pCfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SVnodeOpt vnodeOpt = {
|
SVnodeOpt vnodeOpt = {
|
||||||
.sver = pCfg->sver,
|
.sver = tsVersion,
|
||||||
.nthreads = pCfg->numOfCommitThreads,
|
.nthreads = tsNumOfCommitThreads,
|
||||||
.putReqToVQueryQFp = dndPutReqToVQueryQ,
|
.putReqToVQueryQFp = dndPutReqToVQueryQ,
|
||||||
.sendReqToDnodeFp = dndSendReqToDnode
|
.sendReqToDnodeFp = dndSendReqToDnode
|
||||||
};
|
};
|
||||||
|
@ -295,13 +294,12 @@ int32_t dndInit(const SDnodeEnvCfg *pCfg) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&dndEnv.cfg, pCfg, sizeof(SDnodeEnvCfg));
|
|
||||||
dInfo("dnode env is initialized");
|
dInfo("dnode env is initialized");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dndCleanup() {
|
void dndCleanup() {
|
||||||
if (atomic_val_compare_exchange_8(&dndEnv.once, DND_ENV_READY, DND_ENV_CLEANUP) != DND_ENV_READY) {
|
if (atomic_val_compare_exchange_8(&once, DND_ENV_READY, DND_ENV_CLEANUP) != DND_ENV_READY) {
|
||||||
dError("dnode env is already cleaned up");
|
dError("dnode env is already cleaned up");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,13 +357,13 @@ void dndSendStatusReq(SDnode *pDnode) {
|
||||||
|
|
||||||
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
|
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
|
||||||
taosRLockLatch(&pMgmt->latch);
|
taosRLockLatch(&pMgmt->latch);
|
||||||
req.sver = pDnode->env.sver;
|
req.sver = tsVersion;
|
||||||
req.dver = pMgmt->dver;
|
req.dver = pMgmt->dver;
|
||||||
req.dnodeId = pMgmt->dnodeId;
|
req.dnodeId = pMgmt->dnodeId;
|
||||||
req.clusterId = pMgmt->clusterId;
|
req.clusterId = pMgmt->clusterId;
|
||||||
req.rebootTime = pMgmt->rebootTime;
|
req.rebootTime = pMgmt->rebootTime;
|
||||||
req.updateTime = pMgmt->updateTime;
|
req.updateTime = pMgmt->updateTime;
|
||||||
req.numOfCores = pDnode->env.numOfCores;
|
req.numOfCores = tsNumOfCores;
|
||||||
req.numOfSupportVnodes = pDnode->cfg.numOfSupportVnodes;
|
req.numOfSupportVnodes = pDnode->cfg.numOfSupportVnodes;
|
||||||
memcpy(req.dnodeEp, pDnode->cfg.localEp, TSDB_EP_LEN);
|
memcpy(req.dnodeEp, pDnode->cfg.localEp, TSDB_EP_LEN);
|
||||||
|
|
||||||
|
|
|
@ -273,8 +273,8 @@ static void dndInitMnodeOption(SDnode *pDnode, SMnodeOpt *pOption) {
|
||||||
pOption->putReqToMReadQFp = dndPutMsgToMReadQ;
|
pOption->putReqToMReadQFp = dndPutMsgToMReadQ;
|
||||||
pOption->dnodeId = dndGetDnodeId(pDnode);
|
pOption->dnodeId = dndGetDnodeId(pDnode);
|
||||||
pOption->clusterId = dndGetClusterId(pDnode);
|
pOption->clusterId = dndGetClusterId(pDnode);
|
||||||
pOption->cfg.sver = pDnode->env.sver;
|
pOption->cfg.sver = tsVersion;
|
||||||
pOption->cfg.enableTelem = pDnode->env.enableTelem;
|
pOption->cfg.enableTelem = tsEnableTelemetryReporting;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dndBuildMnodeDeployOption(SDnode *pDnode, SMnodeOpt *pOption) {
|
static void dndBuildMnodeDeployOption(SDnode *pDnode, SMnodeOpt *pOption) {
|
||||||
|
|
|
@ -185,7 +185,7 @@ static void dndBuildQnodeOption(SDnode *pDnode, SQnodeOpt *pOption) {
|
||||||
pOption->sendRedirectRspFp = dndSendRedirectRsp;
|
pOption->sendRedirectRspFp = dndSendRedirectRsp;
|
||||||
pOption->dnodeId = dndGetDnodeId(pDnode);
|
pOption->dnodeId = dndGetDnodeId(pDnode);
|
||||||
pOption->clusterId = dndGetClusterId(pDnode);
|
pOption->clusterId = dndGetClusterId(pDnode);
|
||||||
pOption->sver = pDnode->env.sver;
|
pOption->sver = tsVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t dndOpenQnode(SDnode *pDnode) {
|
static int32_t dndOpenQnode(SDnode *pDnode) {
|
||||||
|
|
|
@ -179,7 +179,7 @@ static void dndBuildSnodeOption(SDnode *pDnode, SSnodeOpt *pOption) {
|
||||||
pOption->sendRedirectRspFp = dndSendRedirectRsp;
|
pOption->sendRedirectRspFp = dndSendRedirectRsp;
|
||||||
pOption->dnodeId = dndGetDnodeId(pDnode);
|
pOption->dnodeId = dndGetDnodeId(pDnode);
|
||||||
pOption->clusterId = dndGetClusterId(pDnode);
|
pOption->clusterId = dndGetClusterId(pDnode);
|
||||||
pOption->sver = pDnode->env.sver;
|
pOption->sver = tsVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t dndOpenSnode(SDnode *pDnode) {
|
static int32_t dndOpenSnode(SDnode *pDnode) {
|
||||||
|
|
|
@ -344,7 +344,7 @@ static int32_t dndInitServer(SDnode *pDnode) {
|
||||||
STransMgmt *pMgmt = &pDnode->tmgmt;
|
STransMgmt *pMgmt = &pDnode->tmgmt;
|
||||||
dndInitMsgFp(pMgmt);
|
dndInitMsgFp(pMgmt);
|
||||||
|
|
||||||
int32_t numOfThreads = (int32_t)((pDnode->env.numOfCores * tsNumOfThreadsPerCore) / 2.0);
|
int32_t numOfThreads = (int32_t)((tsNumOfCores * tsNumOfThreadsPerCore) / 2.0);
|
||||||
if (numOfThreads < 1) {
|
if (numOfThreads < 1) {
|
||||||
numOfThreads = 1;
|
numOfThreads = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,7 +421,7 @@ static int32_t dndOpenVnodes(SDnode *pDnode) {
|
||||||
|
|
||||||
pMgmt->totalVnodes = numOfVnodes;
|
pMgmt->totalVnodes = numOfVnodes;
|
||||||
|
|
||||||
int32_t threadNum = pDnode->env.numOfCores;
|
int32_t threadNum = tsNumOfCores;
|
||||||
#if 1
|
#if 1
|
||||||
threadNum = 1;
|
threadNum = 1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -874,11 +874,11 @@ static int32_t dndInitVnodeWorkers(SDnode *pDnode) {
|
||||||
SVnodesMgmt *pMgmt = &pDnode->vmgmt;
|
SVnodesMgmt *pMgmt = &pDnode->vmgmt;
|
||||||
|
|
||||||
int32_t maxFetchThreads = 4;
|
int32_t maxFetchThreads = 4;
|
||||||
int32_t minFetchThreads = TMIN(maxFetchThreads, pDnode->env.numOfCores);
|
int32_t minFetchThreads = TMIN(maxFetchThreads, tsNumOfCores);
|
||||||
int32_t minQueryThreads = TMAX((int32_t)(pDnode->env.numOfCores * tsRatioOfQueryCores), 1);
|
int32_t minQueryThreads = TMAX((int32_t)(tsNumOfCores * tsRatioOfQueryCores), 1);
|
||||||
int32_t maxQueryThreads = minQueryThreads;
|
int32_t maxQueryThreads = minQueryThreads;
|
||||||
int32_t maxWriteThreads = TMAX(pDnode->env.numOfCores, 1);
|
int32_t maxWriteThreads = TMAX(tsNumOfCores, 1);
|
||||||
int32_t maxSyncThreads = TMAX(pDnode->env.numOfCores / 2, 1);
|
int32_t maxSyncThreads = TMAX(tsNumOfCores / 2, 1);
|
||||||
|
|
||||||
SQWorkerPool *pQPool = &pMgmt->queryPool;
|
SQWorkerPool *pQPool = &pMgmt->queryPool;
|
||||||
pQPool->name = "vnode-query";
|
pQPool->name = "vnode-query";
|
||||||
|
|
Loading…
Reference in New Issue