[TD-468] add configs
This commit is contained in:
parent
0beaad37b7
commit
fbbe08ffbd
|
@ -600,7 +600,7 @@ static void doInitGlobalConfig() {
|
||||||
taosInitConfigOption(cfg);
|
taosInitConfigOption(cfg);
|
||||||
|
|
||||||
// database configs
|
// database configs
|
||||||
cfg.option = "maxtablesPerVnode";
|
cfg.option = "maxTablesPerVnode";
|
||||||
cfg.ptr = &tsMaxTablePerVnode;
|
cfg.ptr = &tsMaxTablePerVnode;
|
||||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
|
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
|
||||||
|
|
|
@ -681,10 +681,12 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
|
||||||
pStatus->alternativeRole = (uint8_t) tsAlternativeRole;
|
pStatus->alternativeRole = (uint8_t) tsAlternativeRole;
|
||||||
|
|
||||||
// fill cluster cfg parameters
|
// fill cluster cfg parameters
|
||||||
pStatus->clusterCfg.numOfMnodes = tsNumOfMnodes;
|
pStatus->clusterCfg.numOfMnodes = htonl(tsNumOfMnodes);
|
||||||
pStatus->clusterCfg.mnodeEqualVnodeNum = tsMnodeEqualVnodeNum;
|
pStatus->clusterCfg.mnodeEqualVnodeNum = htonl(tsMnodeEqualVnodeNum);
|
||||||
pStatus->clusterCfg.offlineThreshold = tsOfflineThreshold;
|
pStatus->clusterCfg.offlineThreshold = htonl(tsOfflineThreshold);
|
||||||
pStatus->clusterCfg.statusInterval = tsStatusInterval;
|
pStatus->clusterCfg.statusInterval = htonl(tsStatusInterval);
|
||||||
|
pStatus->clusterCfg.maxtablesPerVnode = htonl(tsMaxTablePerVnode);
|
||||||
|
pStatus->clusterCfg.maxVgroupsPerDb = htonl(tsMaxVgroupsPerDb);
|
||||||
strcpy(pStatus->clusterCfg.arbitrator, tsArbitrator);
|
strcpy(pStatus->clusterCfg.arbitrator, tsArbitrator);
|
||||||
strcpy(pStatus->clusterCfg.timezone, tsTimezone);
|
strcpy(pStatus->clusterCfg.timezone, tsTimezone);
|
||||||
strcpy(pStatus->clusterCfg.locale, tsLocale);
|
strcpy(pStatus->clusterCfg.locale, tsLocale);
|
||||||
|
|
|
@ -568,6 +568,8 @@ typedef struct {
|
||||||
char timezone[64]; // tsTimezone
|
char timezone[64]; // tsTimezone
|
||||||
char locale[TSDB_LOCALE_LEN]; // tsLocale
|
char locale[TSDB_LOCALE_LEN]; // tsLocale
|
||||||
char charset[TSDB_LOCALE_LEN]; // tsCharset
|
char charset[TSDB_LOCALE_LEN]; // tsCharset
|
||||||
|
int32_t maxtablesPerVnode;
|
||||||
|
int32_t maxVgroupsPerDb;
|
||||||
} SClusterCfg;
|
} SClusterCfg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -302,10 +302,12 @@ static void mnodeProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool mnodeCheckClusterCfgPara(const SClusterCfg *clusterCfg) {
|
static bool mnodeCheckClusterCfgPara(const SClusterCfg *clusterCfg) {
|
||||||
if (clusterCfg->numOfMnodes != tsNumOfMnodes) return false;
|
if (clusterCfg->numOfMnodes != htonl(tsNumOfMnodes)) return false;
|
||||||
if (clusterCfg->mnodeEqualVnodeNum != tsMnodeEqualVnodeNum) return false;
|
if (clusterCfg->mnodeEqualVnodeNum != htonl(tsMnodeEqualVnodeNum)) return false;
|
||||||
if (clusterCfg->offlineThreshold != tsOfflineThreshold) return false;
|
if (clusterCfg->offlineThreshold != htonl(tsOfflineThreshold)) return false;
|
||||||
if (clusterCfg->statusInterval != tsStatusInterval) return false;
|
if (clusterCfg->statusInterval != htonl(tsStatusInterval)) return false;
|
||||||
|
if (clusterCfg->maxtablesPerVnode != htonl(tsMaxTablePerVnode)) return false;
|
||||||
|
if (clusterCfg->maxVgroupsPerDb != htonl(tsMaxVgroupsPerDb)) return false;
|
||||||
|
|
||||||
if (0 != strncasecmp(clusterCfg->arbitrator, tsArbitrator, strlen(tsArbitrator))) return false;
|
if (0 != strncasecmp(clusterCfg->arbitrator, tsArbitrator, strlen(tsArbitrator))) return false;
|
||||||
if (0 != strncasecmp(clusterCfg->timezone, tsTimezone, strlen(tsTimezone))) return false;
|
if (0 != strncasecmp(clusterCfg->timezone, tsTimezone, strlen(tsTimezone))) return false;
|
||||||
|
|
|
@ -1552,8 +1552,8 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) {
|
||||||
SChildTableObj *pTable = (SChildTableObj *)pMsg->pTable;
|
SChildTableObj *pTable = (SChildTableObj *)pMsg->pTable;
|
||||||
assert(pTable);
|
assert(pTable);
|
||||||
|
|
||||||
mDebug("app:%p:%p, table:%s, create table in id:%d, uid:%" PRIu64 ", result:%s", pMsg->rpcMsg.ahandle, pMsg,
|
mDebug("app:%p:%p, table:%s, created in mnode, vgId:%d sid:%d, uid:%" PRIu64 ", result:%s", pMsg->rpcMsg.ahandle,
|
||||||
pTable->info.tableId, pTable->sid, pTable->uid, tstrerror(code));
|
pMsg, pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid, tstrerror(code));
|
||||||
|
|
||||||
if (code != TSDB_CODE_SUCCESS) return code;
|
if (code != TSDB_CODE_SUCCESS) return code;
|
||||||
|
|
||||||
|
@ -1693,7 +1693,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
|
||||||
mnodeIncVgroupRef(pVgroup);
|
mnodeIncVgroupRef(pVgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("app:%p:%p, table:%s, create table in vgroup, vgId:%d sid:%d", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId,
|
mDebug("app:%p:%p, table:%s, allocated in vgroup, vgId:%d sid:%d", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId,
|
||||||
pVgroup->vgId, sid);
|
pVgroup->vgId, sid);
|
||||||
|
|
||||||
return mnodeDoCreateChildTable(pMsg, sid);
|
return mnodeDoCreateChildTable(pMsg, sid);
|
||||||
|
|
|
@ -332,7 +332,7 @@ static int32_t mnodeAllocVgroupIdPool(SVgObj *pInputVgroup) {
|
||||||
|
|
||||||
// realloc all vgroups in db
|
// realloc all vgroups in db
|
||||||
int32_t newIdPoolSize;
|
int32_t newIdPoolSize;
|
||||||
if (minIdPoolSize < TSDB_TABLES_STEP) {
|
if (minIdPoolSize * 2 < TSDB_TABLES_STEP) {
|
||||||
newIdPoolSize = minIdPoolSize * 2;
|
newIdPoolSize = minIdPoolSize * 2;
|
||||||
} else {
|
} else {
|
||||||
newIdPoolSize = ((minIdPoolSize / TSDB_TABLES_STEP) + 1) * TSDB_TABLES_STEP;
|
newIdPoolSize = ((minIdPoolSize / TSDB_TABLES_STEP) + 1) * TSDB_TABLES_STEP;
|
||||||
|
|
Loading…
Reference in New Issue