From 8dac1555a0049c51d528f31b6e010337eed1b9fe Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 28 Dec 2021 17:10:51 +0800 Subject: [PATCH] [TS-981](other): new config parameter offlineInterval --- src/balance/src/bnMain.c | 2 +- src/common/inc/tglobal.h | 1 + src/common/src/tglobal.c | 11 +++++++++++ src/util/inc/tconfig.h | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/balance/src/bnMain.c b/src/balance/src/bnMain.c index 9997d44ca5..e23bdc654e 100644 --- a/src/balance/src/bnMain.c +++ b/src/balance/src/bnMain.c @@ -567,7 +567,7 @@ void bnCheckStatus() { while (1) { pIter = mnodeGetNextDnode(pIter, &pDnode); if (pDnode == NULL) break; - if (tsAccessSquence - pDnode->lastAccess > 3) { + if (tsAccessSquence - pDnode->lastAccess > tsOfflineInterval) { if (pDnode->status != TAOS_DN_STATUS_DROPPING && pDnode->status != TAOS_DN_STATUS_OFFLINE) { pDnode->status = TAOS_DN_STATUS_OFFLINE; pDnode->offlineReason = TAOS_DN_OFF_STATUS_MSG_TIMEOUT; diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index cde5eab487..890bed123b 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -119,6 +119,7 @@ extern int32_t tsdbWalFlushSize; extern int8_t tsEnableBalance; extern int8_t tsAlternativeRole; extern int32_t tsBalanceInterval; +extern int32_t tsOfflineInterval; extern int32_t tsOfflineThreshold; extern int32_t tsMnodeEqualVnodeNum; extern int8_t tsEnableFlowCtrl; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 8627a3153c..b87ed82d69 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -164,6 +164,7 @@ int32_t tsdbWalFlushSize = TSDB_DEFAULT_WAL_FLUSH_SIZE; // MB int8_t tsEnableBalance = 1; int8_t tsAlternativeRole = 0; int32_t tsBalanceInterval = 300; // seconds +int32_t tsOfflineInterval = 3; int32_t tsOfflineThreshold = 86400 * 10; // seconds of 10 days int32_t tsMnodeEqualVnodeNum = 4; int8_t tsEnableFlowCtrl = 1; @@ -653,6 +654,16 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + cfg.option = "offlineInterval"; + cfg.ptr = &tsOfflineInterval; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; + cfg.minValue = 1; + cfg.maxValue = 600; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + // 0-any; 1-mnode; 2-vnode cfg.option = "role"; cfg.ptr = &tsAlternativeRole; diff --git a/src/util/inc/tconfig.h b/src/util/inc/tconfig.h index c52fbf208f..fd9a340a25 100644 --- a/src/util/inc/tconfig.h +++ b/src/util/inc/tconfig.h @@ -20,7 +20,7 @@ extern "C" { #endif -#define TSDB_CFG_MAX_NUM 130 +#define TSDB_CFG_MAX_NUM 131 #define TSDB_CFG_PRINT_LEN 23 #define TSDB_CFG_OPTION_LEN 24 #define TSDB_CFG_VALUE_LEN 41 -- GitLab