remove mnode cfg
This commit is contained in:
parent
5e3e048569
commit
6aab93803c
|
@ -44,21 +44,12 @@ typedef struct SMnodeLoad {
|
|||
int64_t compStorage;
|
||||
} SMnodeLoad;
|
||||
|
||||
typedef struct SMnodeCfg {
|
||||
int32_t sver;
|
||||
bool enableTelem;
|
||||
bool printAuth;
|
||||
int32_t statusInterval;
|
||||
int32_t shellActivityTimer;
|
||||
} SMnodeCfg;
|
||||
|
||||
typedef struct {
|
||||
int32_t dnodeId;
|
||||
int64_t clusterId;
|
||||
int8_t replica;
|
||||
int8_t selfIndex;
|
||||
SReplica replicas[TSDB_MAX_REPLICA];
|
||||
SMnodeCfg cfg;
|
||||
SDnode *pDnode;
|
||||
PutReqToMWriteQFp putReqToMWriteQFp;
|
||||
PutReqToMReadQFp putReqToMReadQFp;
|
||||
|
|
|
@ -47,6 +47,7 @@ void osSetLogReservedSpace(float sizeInGB);
|
|||
void osSetTempReservedSpace(float sizeInGB);
|
||||
void osSetDataReservedSpace(float sizeInGB);
|
||||
void osSetTimezone(const char *timezone);
|
||||
void osSetLocale(const char *locale, const char *charset);
|
||||
bool osSetEnableCore(bool enable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -246,9 +246,9 @@ static void taosAddClientCfg(SConfig *pCfg) {
|
|||
cfgAddString(pCfg, "secondEp", defaultSecondEp, 1);
|
||||
cfgAddString(pCfg, "fqdn", defaultFqdn, 1);
|
||||
cfgAddInt32(pCfg, "serverPort", defaultServerPort, 1, 65056, 1);
|
||||
cfgAddDir(pCfg, "tempDir", osTempDir(), 1);
|
||||
cfgAddString(pCfg, "configDir", configDir, 1);
|
||||
cfgAddString(pCfg, "scriptDir", configDir, 1);
|
||||
cfgAddDir(pCfg, "tempDir", osTempDir(), 1);
|
||||
cfgAddFloat(pCfg, "minimalTempDirGB", 1.0f, 0.001f, 10000000, 1);
|
||||
cfgAddFloat(pCfg, "numOfThreadsPerCore", tsNumOfThreadsPerCore, 0, 10, 1);
|
||||
cfgAddInt32(pCfg, "maxTmrCtrl", tsMaxTmrCtrl, 8, 2048, 1);
|
||||
|
@ -262,17 +262,17 @@ static void taosAddClientCfg(SConfig *pCfg) {
|
|||
cfgAddInt32(pCfg, "maxRegexStringLen", tsMaxRegexStringLen, 0, TSDB_MAX_FIELD_LEN, 1);
|
||||
cfgAddInt32(pCfg, "maxNumOfOrderedRes", tsMaxNumOfOrderedResults, 128, TSDB_MAX_ALLOWED_SQL_LEN, 1);
|
||||
cfgAddBool(pCfg, "keepColumnName", tsKeepOriginalColumnName, 1);
|
||||
cfgAddInt32(pCfg, "numOfCores", 1, 1, 100000, 1);
|
||||
cfgAddBool(pCfg, "enableCoreFile", 0, 1);
|
||||
cfgAddInt32(pCfg, "maxBinaryDisplayWidth", tsMaxBinaryDisplayWidth, 1, 65536, 1);
|
||||
cfgAddTimezone(pCfg, "timezone", osTimezone());
|
||||
cfgAddLocale(pCfg, "locale", osLocale());
|
||||
cfgAddCharset(pCfg, "charset", osCharset());
|
||||
cfgAddBool(pCfg, "enableCoreFile", 0, 1);
|
||||
cfgAddInt32(pCfg, "numOfCores", tsNumOfCores, 1, 100000, 1);
|
||||
cfgAddString(pCfg, "version", version, 1);
|
||||
cfgAddString(pCfg, "compatible_version", compatible_version, 1);
|
||||
cfgAddString(pCfg, "gitinfo", gitinfo, 1);
|
||||
cfgAddString(pCfg, "gitinfoOfInternal", gitinfoOfInternal, 1);
|
||||
cfgAddString(pCfg, "buildinfo", buildinfo, 1);
|
||||
cfgAddTimezone(pCfg, "timezone", osTimezone());
|
||||
cfgAddLocale(pCfg, "locale", osLocale());
|
||||
cfgAddCharset(pCfg, "charset", osCharset());
|
||||
}
|
||||
|
||||
static void taosAddServerCfg(SConfig *pCfg) {
|
||||
|
@ -325,20 +325,37 @@ static void taosSetServerLogCfg(SConfig *pCfg) {
|
|||
}
|
||||
|
||||
static void taosSetClientCfg(SConfig *pCfg) {
|
||||
osSetTempDir(cfgGetItem(pCfg, "tempDir")->str);
|
||||
osSetDataReservedSpace(cfgGetItem(pCfg, "minimalTempDirGB")->fval);
|
||||
tstrncpy(tsFirst, cfgGetItem(pCfg, "firstEp")->str, TSDB_EP_LEN);
|
||||
tstrncpy(tsSecond, cfgGetItem(pCfg, "secondEp")->str, TSDB_EP_LEN);
|
||||
tstrncpy(tsLocalFqdn, cfgGetItem(pCfg, "fqdn")->str, TSDB_EP_LEN);
|
||||
tsServerPort = (uint16_t)cfgGetItem(pCfg, "serverPort")->i32;
|
||||
snprintf(tsLocalEp, sizeof(tsLocalEp), "%s:%u", tsLocalFqdn, tsServerPort);
|
||||
osSetTempDir(cfgGetItem(pCfg, "tempDir")->str);
|
||||
osSetDataReservedSpace(cfgGetItem(pCfg, "minimalTempDirGB")->fval);
|
||||
|
||||
tsNumOfThreadsPerCore = cfgGetItem(pCfg, "maxTmrCtrl")->fval;
|
||||
tsMaxTmrCtrl = cfgGetItem(pCfg, "maxTmrCtrl")->i32;
|
||||
tsRpcTimer = cfgGetItem(pCfg, "rpcTimer")->i32;
|
||||
tsRpcMaxTime = cfgGetItem(pCfg, "rpcMaxTime")->i32;
|
||||
tsRpcForceTcp = cfgGetItem(pCfg, "rpcForceTcp")->i32;
|
||||
tsShellActivityTimer = cfgGetItem(pCfg, "shellActivityTimer")->bval;
|
||||
tsCompressMsgSize = cfgGetItem(pCfg, "compressMsgSize")->i32;
|
||||
tsCompressColData = cfgGetItem(pCfg, "compressColData")->i32;
|
||||
tsMaxWildCardsLen = cfgGetItem(pCfg, "maxWildCardsLength")->i32;
|
||||
tsMaxRegexStringLen = cfgGetItem(pCfg, "maxRegexStringLen")->i32;
|
||||
tsMaxNumOfOrderedResults = cfgGetItem(pCfg, "maxNumOfOrderedRes")->i32;
|
||||
tsKeepOriginalColumnName = cfgGetItem(pCfg, "keepColumnName")->bval;
|
||||
tsMaxBinaryDisplayWidth = cfgGetItem(pCfg, "maxBinaryDisplayWidth")->i32;
|
||||
|
||||
SConfigItem *pItem = cfgGetItem(pCfg, "timezone");
|
||||
osSetTimezone(pItem->str);
|
||||
uDebug("timezone format changed from %s to %s", pItem->str, osTimezone());
|
||||
cfgSetItem(pCfg, "timezone", osTimezone(), pItem->stype);
|
||||
|
||||
taosGetSystemInfo();
|
||||
const char *locale = cfgGetItem(pCfg, "locale")->str;
|
||||
const char *charset = cfgGetItem(pCfg, "charset")->str;
|
||||
osSetLocale(locale, charset);
|
||||
|
||||
if (tsNumOfCores <= 1) {
|
||||
tsNumOfCores = 2;
|
||||
}
|
||||
|
@ -354,7 +371,25 @@ static void taosSetServerCfg(SConfig *pCfg) {
|
|||
osSetDataDir(cfgGetItem(pCfg, "dataDir")->str);
|
||||
osSetTempReservedSpace(cfgGetItem(pCfg, "minimalDataDirGB")->fval);
|
||||
|
||||
tsNumOfCommitThreads = cfgGetItem(pCfg, "numOfCommitThreads")->i32;
|
||||
tsRatioOfQueryCores = cfgGetItem(pCfg, "ratioOfQueryCores")->fval;
|
||||
tsMaxNumOfDistinctResults = cfgGetItem(pCfg, "maxNumOfDistinctRes")->i32;
|
||||
tsEnableTelemetryReporting = cfgGetItem(pCfg, "telemetryReporting")->bval;
|
||||
tsMaxConnections = cfgGetItem(pCfg, "maxConnections")->i32;
|
||||
tsMaxShellConns = cfgGetItem(pCfg, "maxShellConns")->i32;
|
||||
tsStatusInterval = cfgGetItem(pCfg, "statusInterval")->i32;
|
||||
tsMinSlidingTime = cfgGetItem(pCfg, "minSlidingTime")->i32;
|
||||
tsMinIntervalTime = cfgGetItem(pCfg, "minIntervalTime")->i32;
|
||||
tsMaxStreamComputDelay = cfgGetItem(pCfg, "maxStreamCompDelay")->i32;
|
||||
tsStreamCompStartDelay = cfgGetItem(pCfg, "maxFirstStreamCompDelay")->i32;
|
||||
tsRetryStreamCompDelay = cfgGetItem(pCfg, "retryStreamCompDelay")->i32;
|
||||
tsStreamComputDelayRatio = cfgGetItem(pCfg, "streamCompDelayRatio")->fval;
|
||||
tsQueryBufferSize = cfgGetItem(pCfg, "queryBufferSize")->i32;
|
||||
tsRetrieveBlockingModel = cfgGetItem(pCfg, "retrieveBlockingModel")->bval;
|
||||
tsPrintAuth = cfgGetItem(pCfg, "printAuth")->bval;
|
||||
tsEnableSlaveQuery = cfgGetItem(pCfg, "slaveQuery")->bval;
|
||||
tsDeadLockKillQuery = cfgGetItem(pCfg, "deadLockKillQuery")->bval;
|
||||
|
||||
if (tsQueryBufferSize >= 0) {
|
||||
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
|
||||
}
|
||||
|
|
|
@ -273,8 +273,6 @@ static void dndInitMnodeOption(SDnode *pDnode, SMnodeOpt *pOption) {
|
|||
pOption->putReqToMReadQFp = dndPutMsgToMReadQ;
|
||||
pOption->dnodeId = dndGetDnodeId(pDnode);
|
||||
pOption->clusterId = dndGetClusterId(pDnode);
|
||||
pOption->cfg.sver = tsVersion;
|
||||
pOption->cfg.enableTelem = tsEnableTelemetryReporting;
|
||||
}
|
||||
|
||||
static void dndBuildMnodeDeployOption(SDnode *pDnode, SMnodeOpt *pOption) {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "ttime.h"
|
||||
#include "wal.h"
|
||||
#include "version.h"
|
||||
#include "tglobal.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -81,7 +82,6 @@ typedef struct SMnode {
|
|||
tmr_h mqTimer;
|
||||
tmr_h telemTimer;
|
||||
char *path;
|
||||
SMnodeCfg cfg;
|
||||
int64_t checkTime;
|
||||
SSdb *pSdb;
|
||||
SDnode *pDnode;
|
||||
|
|
|
@ -237,7 +237,7 @@ int32_t mndGetDnodeSize(SMnode *pMnode) {
|
|||
|
||||
bool mndIsDnodeOnline(SMnode *pMnode, SDnodeObj *pDnode, int64_t curMs) {
|
||||
int64_t interval = TABS(pDnode->lastAccessTime - curMs);
|
||||
if (interval > 3500 * pMnode->cfg.statusInterval) {
|
||||
if (interval > 3500 * tsStatusInterval) {
|
||||
if (pDnode->rebootTime > 0) {
|
||||
pDnode->offlineReason = DND_REASON_STATUS_MSG_TIMEOUT;
|
||||
}
|
||||
|
@ -272,8 +272,8 @@ static void mndGetDnodeData(SMnode *pMnode, SArray *pDnodeEps) {
|
|||
}
|
||||
|
||||
static int32_t mndCheckClusterCfgPara(SMnode *pMnode, const SClusterCfg *pCfg) {
|
||||
if (pCfg->statusInterval != pMnode->cfg.statusInterval) {
|
||||
mError("statusInterval [%d - %d] cfg inconsistent", pCfg->statusInterval, pMnode->cfg.statusInterval);
|
||||
if (pCfg->statusInterval != tsStatusInterval) {
|
||||
mError("statusInterval [%d - %d] cfg inconsistent", pCfg->statusInterval, tsStatusInterval);
|
||||
return DND_REASON_STATUS_INTERVAL_NOT_MATCH;
|
||||
}
|
||||
|
||||
|
@ -355,12 +355,11 @@ static int32_t mndProcessStatusReq(SMnodeMsg *pReq) {
|
|||
bool needCheck = !online || dnodeChanged || reboot;
|
||||
|
||||
if (needCheck) {
|
||||
if (statusReq.sver != pMnode->cfg.sver) {
|
||||
if (statusReq.sver != tsVersion) {
|
||||
if (pDnode != NULL) {
|
||||
pDnode->offlineReason = DND_REASON_VERSION_NOT_MATCH;
|
||||
}
|
||||
mError("dnode:%d, status msg version:%d not match cluster:%d", statusReq.dnodeId, statusReq.sver,
|
||||
pMnode->cfg.sver);
|
||||
mError("dnode:%d, status msg version:%d not match cluster:%d", statusReq.dnodeId, statusReq.sver, tsVersion);
|
||||
terrno = TSDB_CODE_MND_INVALID_MSG_VERSION;
|
||||
goto PROCESS_STATUS_MSG_OVER;
|
||||
}
|
||||
|
@ -666,7 +665,7 @@ static int32_t mndRetrieveConfigs(SMnodeMsg *pReq, SShowObj *pShow, char *data,
|
|||
int32_t cols = 0;
|
||||
|
||||
cfgOpts[numOfRows] = "statusInterval";
|
||||
snprintf(cfgVals[numOfRows], TSDB_CONIIG_VALUE_LEN, "%d", pMnode->cfg.statusInterval);
|
||||
snprintf(cfgVals[numOfRows], TSDB_CONIIG_VALUE_LEN, "%d", tsStatusInterval);
|
||||
numOfRows++;
|
||||
|
||||
cfgOpts[numOfRows] = "timezone";
|
||||
|
|
|
@ -63,7 +63,7 @@ static void mndCancelGetNextQuery(SMnode *pMnode, void *pIter);
|
|||
int32_t mndInitProfile(SMnode *pMnode) {
|
||||
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
||||
|
||||
int32_t connCheckTime = pMnode->cfg.shellActivityTimer * 2;
|
||||
int32_t connCheckTime = tsShellActivityTimer * 2;
|
||||
pMgmt->cache = taosCacheInit(TSDB_DATA_TYPE_INT, connCheckTime, true, (__cache_free_fn_t)mndFreeConn, "conn");
|
||||
if (pMgmt->cache == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -117,7 +117,7 @@ static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid,
|
|||
tstrncpy(connObj.user, pInfo->user, TSDB_USER_LEN);
|
||||
tstrncpy(connObj.app, app, TSDB_APP_NAME_LEN);
|
||||
|
||||
int32_t keepTime = pMnode->cfg.shellActivityTimer * 3;
|
||||
int32_t keepTime = tsShellActivityTimer * 3;
|
||||
SConnObj *pConn = taosCachePut(pMgmt->cache, &connId, sizeof(int32_t), &connObj, sizeof(connObj), keepTime * 1000);
|
||||
if (pConn == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -143,7 +143,7 @@ static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int32_t keepTime = pMnode->cfg.shellActivityTimer * 3;
|
||||
int32_t keepTime = tsShellActivityTimer * 3;
|
||||
pConn->lastAccessTimeMs = keepTime * 1000 + (uint64_t)taosGetTimestampMs();
|
||||
|
||||
mTrace("conn:%d, acquired from cache, data:%p", pConn->id, pConn);
|
||||
|
|
|
@ -64,7 +64,7 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SShowReq *pReq) {
|
|||
memcpy(showObj.db, pReq->db, TSDB_DB_FNAME_LEN);
|
||||
memcpy(showObj.payload, pReq->payload, pReq->payloadLen);
|
||||
|
||||
int32_t keepTime = pMnode->cfg.shellActivityTimer * 6 * 1000;
|
||||
int32_t keepTime = tsShellActivityTimer * 6 * 1000;
|
||||
SShowObj *pShow = taosCachePut(pMgmt->cache, &showId, sizeof(int64_t), &showObj, size, keepTime);
|
||||
if (pShow == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
|
|
@ -266,7 +266,7 @@ static void mndGetEmail(SMnode* pMnode, char* filepath) {
|
|||
|
||||
int32_t mndInitTelem(SMnode* pMnode) {
|
||||
STelemMgmt* pMgmt = &pMnode->telemMgmt;
|
||||
pMgmt->enable = pMnode->cfg.enableTelem;
|
||||
pMgmt->enable = tsEnableTelemetryReporting;
|
||||
taosInitRWLatch(&pMgmt->lock);
|
||||
mndGetEmail(pMnode, "/usr/local/taos/email");
|
||||
|
||||
|
|
|
@ -290,14 +290,9 @@ static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
|
|||
pMnode->sendReqToDnodeFp = pOption->sendReqToDnodeFp;
|
||||
pMnode->sendReqToMnodeFp = pOption->sendReqToMnodeFp;
|
||||
pMnode->sendRedirectRspFp = pOption->sendRedirectRspFp;
|
||||
pMnode->cfg.sver = pOption->cfg.sver;
|
||||
pMnode->cfg.enableTelem = pOption->cfg.enableTelem;
|
||||
pMnode->cfg.statusInterval = pOption->cfg.statusInterval;
|
||||
pMnode->cfg.shellActivityTimer = pOption->cfg.shellActivityTimer;
|
||||
|
||||
if (pMnode->sendReqToDnodeFp == NULL || pMnode->sendReqToMnodeFp == NULL || pMnode->sendRedirectRspFp == NULL ||
|
||||
pMnode->putReqToMWriteQFp == NULL || pMnode->dnodeId < 0 || pMnode->clusterId < 0 ||
|
||||
pMnode->cfg.statusInterval < 1) {
|
||||
pMnode->putReqToMWriteQFp == NULL || pMnode->dnodeId < 0 || pMnode->clusterId < 0) {
|
||||
terrno = TSDB_CODE_MND_INVALID_OPTIONS;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -74,10 +74,12 @@ void osSetLogReservedSpace(float sizeInGB) { env.logSpace.reserved = sizeInGB; }
|
|||
void osSetTempReservedSpace(float sizeInGB) { env.tempSpace.reserved = sizeInGB; }
|
||||
void osSetDataReservedSpace(float sizeInGB) { env.dataSpace.reserved = sizeInGB; }
|
||||
void osSetTimezone(const char *timezone) { taosSetSystemTimezone(timezone, env.timezone, &env.daylight); }
|
||||
void osSetLocale(const char *locale, const char *charset) { taosSetSystemLocale(locale, charset); }
|
||||
bool osSetEnableCore(bool enable) { env.enableCoreFile = enable; }
|
||||
|
||||
void osInit() {
|
||||
srand(taosSafeRand());
|
||||
taosGetSystemInfo();
|
||||
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
taosWinSocketInit();
|
||||
|
|
|
@ -75,15 +75,10 @@ void taosSetSystemLocale(const char *inLocale, const char *inCharSet) {
|
|||
char *locale = setlocale(LC_CTYPE, inLocale);
|
||||
|
||||
// default locale or user specified locale is not valid, abort launch
|
||||
if (inLocale == NULL) {
|
||||
if (inLocale == NULL || strlen(inCharSet) == 0) {
|
||||
printf("Invalid locale:%s, please set the valid locale in config file\n", inLocale);
|
||||
}
|
||||
|
||||
if (strlen(inCharSet) == 0) {
|
||||
printf("failed to get charset, please set the valid charset in config file\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (!taosValidateEncodec(inCharSet)) {
|
||||
printf("Invalid charset:%s, please set the valid charset in config file", inCharSet);
|
||||
exit(-1);
|
||||
|
|
|
@ -20,7 +20,7 @@ int32_t tsTotalMemoryMB = 0;
|
|||
int64_t tsPageSize = 0;
|
||||
int64_t tsOpenMax = 0;
|
||||
int64_t tsStreamMax = 0;
|
||||
int32_t tsNumOfCores = 1;
|
||||
int32_t tsNumOfCores = 2;
|
||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||
|
||||
/*
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "tutil.h"
|
||||
#include "ulog.h"
|
||||
|
||||
#define CFG_NAME_PRINT_LEN 22
|
||||
#define CFG_NAME_PRINT_LEN 24
|
||||
#define CFG_SRC_PRINT_LEN 12
|
||||
|
||||
typedef struct SConfig {
|
||||
|
|
Loading…
Reference in New Issue