diff --git a/src/balance/src/bnMain.c b/src/balance/src/bnMain.c index 9997d44ca55954b120ae4849d4f68be4d23419f7..e23bdc654e02bb3d9b34f656b0b49840c97f37e8 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 cde5eab48783351d4bd8c00be9008d52b5bf6561..890bed123bb1a03c93d676b1b12495c7a8b65ade 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 8627a3153cdac2b06cd3cf15dddefad32c39c58d..b87ed82d6963c98a95e087ddad2feb8f7590a8a7 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 c52fbf208f6fbf0384ecf66650919c4d12ae352e..fd9a340a25a752b18ab07a8fbb2691038af3b71b 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