refactor: make more object global
This commit is contained in:
parent
34fd89aa23
commit
69728a9987
|
@ -32,6 +32,7 @@ extern char tsLocalEp[];
|
||||||
extern uint16_t tsServerPort;
|
extern uint16_t tsServerPort;
|
||||||
extern int32_t tsVersion;
|
extern int32_t tsVersion;
|
||||||
extern int32_t tsStatusInterval;
|
extern int32_t tsStatusInterval;
|
||||||
|
extern int32_t tsNumOfSupportVnodes;
|
||||||
|
|
||||||
// common
|
// common
|
||||||
extern int32_t tsMaxShellConns;
|
extern int32_t tsMaxShellConns;
|
||||||
|
|
|
@ -30,6 +30,7 @@ char tsLocalEp[TSDB_EP_LEN] = {0}; // Local End Point, hostname:port
|
||||||
uint16_t tsServerPort = 6030;
|
uint16_t tsServerPort = 6030;
|
||||||
int32_t tsVersion = 30000000;
|
int32_t tsVersion = 30000000;
|
||||||
int32_t tsStatusInterval = 1; // second
|
int32_t tsStatusInterval = 1; // second
|
||||||
|
int32_t tsNumOfSupportVnodes = 256;
|
||||||
|
|
||||||
// common
|
// common
|
||||||
int32_t tsMaxShellConns = 50000;
|
int32_t tsMaxShellConns = 50000;
|
||||||
|
@ -355,7 +356,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
|
||||||
static int32_t taosAddServerCfg(SConfig *pCfg) {
|
static int32_t taosAddServerCfg(SConfig *pCfg) {
|
||||||
if (cfgAddDir(pCfg, "dataDir", tsDataDir, 0) != 0) return -1;
|
if (cfgAddDir(pCfg, "dataDir", tsDataDir, 0) != 0) return -1;
|
||||||
if (cfgAddFloat(pCfg, "minimalDataDirGB", 2.0f, 0.001f, 10000000, 0) != 0) return -1;
|
if (cfgAddFloat(pCfg, "minimalDataDirGB", 2.0f, 0.001f, 10000000, 0) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "supportVnodes", 256, 0, 4096, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "supportVnodes", tsNumOfSupportVnodes, 0, 4096, 0) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "maxShellConns", tsMaxShellConns, 10, 50000000, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "maxShellConns", tsMaxShellConns, 10, 50000000, 0) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "statusInterval", tsStatusInterval, 1, 30, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "statusInterval", tsStatusInterval, 1, 30, 0) != 0) return -1;
|
||||||
if (cfgAddInt32(pCfg, "minSlidingTime", tsMinSlidingTime, 10, 1000000, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "minSlidingTime", tsMinSlidingTime, 10, 1000000, 0) != 0) return -1;
|
||||||
|
@ -541,6 +542,7 @@ static void taosSetSystemCfg(SConfig *pCfg) {
|
||||||
|
|
||||||
static int32_t taosSetServerCfg(SConfig *pCfg) {
|
static int32_t taosSetServerCfg(SConfig *pCfg) {
|
||||||
tsDataSpace.reserved = cfgGetItem(pCfg, "minimalDataDirGB")->fval;
|
tsDataSpace.reserved = cfgGetItem(pCfg, "minimalDataDirGB")->fval;
|
||||||
|
tsNumOfSupportVnodes = cfgGetItem(pCfg, "supportVnodes")->i32;
|
||||||
tsMaxShellConns = cfgGetItem(pCfg, "maxShellConns")->i32;
|
tsMaxShellConns = cfgGetItem(pCfg, "maxShellConns")->i32;
|
||||||
tsStatusInterval = cfgGetItem(pCfg, "statusInterval")->i32;
|
tsStatusInterval = cfgGetItem(pCfg, "statusInterval")->i32;
|
||||||
tsMinSlidingTime = cfgGetItem(pCfg, "minSlidingTime")->i32;
|
tsMinSlidingTime = cfgGetItem(pCfg, "minSlidingTime")->i32;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
static bool mmDeployRequired(const SMgmtInputOpt *pInput) {
|
static bool mmDeployRequired(const SMgmtInputOpt *pInput) {
|
||||||
if (pInput->pData->dnodeId > 0) return false;
|
if (pInput->pData->dnodeId > 0) return false;
|
||||||
if (pInput->pData->clusterId > 0) return false;
|
if (pInput->pData->clusterId > 0) return false;
|
||||||
if (strcmp(pInput->pData->localEp, pInput->pData->firstEp) != 0) return false;
|
if (strcmp(tsLocalEp, tsFirst) != 0) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ static void mmBuildOptionForDeploy(SMnodeMgmt *pMgmt, const SMgmtInputOpt *pInpu
|
||||||
pOption->selfIndex = 0;
|
pOption->selfIndex = 0;
|
||||||
SReplica *pReplica = &pOption->replicas[0];
|
SReplica *pReplica = &pOption->replicas[0];
|
||||||
pReplica->id = 1;
|
pReplica->id = 1;
|
||||||
pReplica->port = pInput->pData->serverPort;
|
pReplica->port = tsServerPort;
|
||||||
tstrncpy(pReplica->fqdn, pInput->pData->localFqdn, TSDB_FQDN_LEN);
|
tstrncpy(pReplica->fqdn, tsLocalFqdn, TSDB_FQDN_LEN);
|
||||||
pOption->deploy = true;
|
pOption->deploy = true;
|
||||||
|
|
||||||
pMgmt->selfIndex = pOption->selfIndex;
|
pMgmt->selfIndex = pOption->selfIndex;
|
||||||
|
|
|
@ -262,11 +262,11 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
|
||||||
taosInitRWLatch(&pMgmt->latch);
|
taosInitRWLatch(&pMgmt->latch);
|
||||||
|
|
||||||
SDiskCfg dCfg = {0};
|
SDiskCfg dCfg = {0};
|
||||||
tstrncpy(dCfg.dir, pInput->pData->dataDir, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg.dir, tsDataDir, TSDB_FILENAME_LEN);
|
||||||
dCfg.level = 0;
|
dCfg.level = 0;
|
||||||
dCfg.primary = 1;
|
dCfg.primary = 1;
|
||||||
SDiskCfg *pDisks = pInput->pData->disks;
|
SDiskCfg *pDisks = tsDiskCfg;
|
||||||
int32_t numOfDisks = pInput->pData->numOfDisks;
|
int32_t numOfDisks = tsDiskCfgNum;
|
||||||
if (numOfDisks <= 0 || pDisks == NULL) {
|
if (numOfDisks <= 0 || pDisks == NULL) {
|
||||||
pDisks = &dCfg;
|
pDisks = &dCfg;
|
||||||
numOfDisks = 1;
|
numOfDisks = 1;
|
||||||
|
@ -328,7 +328,7 @@ _OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t vmRequire(const SMgmtInputOpt *pInput, bool *required) {
|
static int32_t vmRequire(const SMgmtInputOpt *pInput, bool *required) {
|
||||||
*required = pInput->pData->supportVnodes > 0;
|
*required = tsNumOfSupportVnodes > 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue