From 4f501850dda71646f455e3af55e9d9554aaf4e7a Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 28 Dec 2021 16:47:45 +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 81c6f8bd44..c52da890fc 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -110,6 +110,7 @@ extern int8_t tsCacheLastRow; 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 d5b51ddcc6..53ee4fab3f 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -149,6 +149,7 @@ int32_t tsTableIncStepPerVnode = TSDB_TABLES_STEP; int8_t tsEnableBalance = 1; int8_t tsAlternativeRole = 0; int32_t tsBalanceInterval = 300; // seconds +int32_t tsOfflineInterval = 3; // seconds int32_t tsOfflineThreshold = 86400 * 10; // seconds of 10 days int32_t tsMnodeEqualVnodeNum = 4; int8_t tsEnableFlowCtrl = 1; @@ -621,6 +622,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 b3d7fcd0a0..c2245333ec 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 123 +#define TSDB_CFG_MAX_NUM 124 #define TSDB_CFG_PRINT_LEN 23 #define TSDB_CFG_OPTION_LEN 24 #define TSDB_CFG_VALUE_LEN 41 -- GitLab