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/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 08fa89fbc06adca64131cf41898a4027c7e8967a..459a2c32beb641a03ad04e97ccce7ee3b7b11a83 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -6392,6 +6392,7 @@ int32_t validateDNodeConfig(SMiscInfo* pOptions) { const int tokenMonitor = 3; const int tokenDebugFlag = 4; const int tokenDebugFlagEnd = 20; + const int tokenOfflineInterval = 21; const SDNodeDynConfOption cfgOptions[] = { {"resetLog", 8}, {"resetQueryCache", 15}, {"balance", 7}, {"monitor", 7}, {"debugFlag", 9}, {"monDebugFlag", 12}, {"vDebugFlag", 10}, {"mDebugFlag", 10}, @@ -6399,6 +6400,7 @@ int32_t validateDNodeConfig(SMiscInfo* pOptions) { {"uDebugFlag", 10}, {"tsdbDebugFlag", 13}, {"sDebugflag", 10}, {"rpcDebugFlag", 12}, {"dDebugFlag", 10}, {"mqttDebugFlag", 13}, {"wDebugFlag", 10}, {"tmrDebugFlag", 12}, {"cqDebugFlag", 11}, + {"offlineInterval", 15}, }; SStrToken* pOptionToken = taosArrayGet(pOptions->a, 1); @@ -6430,6 +6432,14 @@ int32_t validateDNodeConfig(SMiscInfo* pOptions) { return TSDB_CODE_TSC_INVALID_OPERATION; // options value is invalid } return TSDB_CODE_SUCCESS; + } else if ((strncasecmp(cfgOptions[tokenOfflineInterval].name, pOptionToken->z, pOptionToken->n) == 0) && + (cfgOptions[tokenOfflineInterval].len == pOptionToken->n)) { + SStrToken* pValToken = taosArrayGet(pOptions->a, 2); + int32_t val = strtol(pValToken->z, NULL, 10); + if (val < 1 || val > 600) { + return TSDB_CODE_TSC_INVALID_OPERATION; // options value is invalid + } + return TSDB_CODE_SUCCESS; } else { SStrToken* pValToken = taosArrayGet(pOptions->a, 2); diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 81c6f8bd44a6453da231da649bc0323a47c9f097..c52da890fc4101e2c15038370e624f48dc503c56 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 d5b51ddcc6df2bb27bc03ec2e1ae87afa2c07e0d..53ee4fab3f244773a42b37c9bbcbe4857757ab09 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 b3d7fcd0a094f809e2cad7d65c6399ce1bab6c00..c2245333ec0aa3a89587f53a6867e256941fc381 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 diff --git a/tests/pytest/dockerCluster/insert.json b/tests/pytest/dockerCluster/insert.json index 2f3cf0f0d9c98abdb31c19ad833098e23e0541f2..60def7be5e28f5167f168735666a08db1e25ccf0 100644 --- a/tests/pytest/dockerCluster/insert.json +++ b/tests/pytest/dockerCluster/insert.json @@ -18,7 +18,7 @@ "cache": 16, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/query/nestedQuery/insertData.json b/tests/pytest/query/nestedQuery/insertData.json index d4ef8dbe97ca144f59c0b1c961fe930bfcdbfcb2..149a4b56acb69ec9a35b1c05a54d6d08803f8080 100644 --- a/tests/pytest/query/nestedQuery/insertData.json +++ b/tests/pytest/query/nestedQuery/insertData.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.json b/tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.json index 5e53bd7e7d10edea9bdbc56ef9ab737dbb34684e..aa9e93694a01d3bf8845785cd6b999f4abdcbcb3 100644 --- a/tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.json +++ b/tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/wal/insertDataDb1.json b/tests/pytest/wal/insertDataDb1.json index 1dce00a4d55aae732ae9c85033f49398a0b1a9be..1b7f757387afb8da99e7bfd7934a68ad90a6a8dd 100644 --- a/tests/pytest/wal/insertDataDb1.json +++ b/tests/pytest/wal/insertDataDb1.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/wal/insertDataDb1Replica2.json b/tests/pytest/wal/insertDataDb1Replica2.json index fec38bcdecd9b441ad1c31891e66e7245c43889f..20ea68cc06d1f3fd8ade8b0cfc95a976f339508e 100644 --- a/tests/pytest/wal/insertDataDb1Replica2.json +++ b/tests/pytest/wal/insertDataDb1Replica2.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/wal/insertDataDb2.json b/tests/pytest/wal/insertDataDb2.json index 2cf8af580570ac66049ca2248a916337517a6507..15df1350c873a4569187fe8a7cac2f6e2b474eeb 100644 --- a/tests/pytest/wal/insertDataDb2.json +++ b/tests/pytest/wal/insertDataDb2.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/wal/insertDataDb2Newstab.json b/tests/pytest/wal/insertDataDb2Newstab.json index f9d0713385265282e938838a10b485ca9cfdd603..0558c8c33d1af477ae3b0cafe9416534db44dfb0 100644 --- a/tests/pytest/wal/insertDataDb2Newstab.json +++ b/tests/pytest/wal/insertDataDb2Newstab.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/wal/insertDataDb2NewstabReplica2.json b/tests/pytest/wal/insertDataDb2NewstabReplica2.json index e052f2850fc2fe1e15c651f6150b79fa65c531c1..5bc145994d778105e10ae2631494cddfe8377cf7 100644 --- a/tests/pytest/wal/insertDataDb2NewstabReplica2.json +++ b/tests/pytest/wal/insertDataDb2NewstabReplica2.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/pytest/wal/insertDataDb2Replica2.json b/tests/pytest/wal/insertDataDb2Replica2.json index 121f70956a8f1eff31f92bc7fb904835f6bcd0de..07bbeaa632ce174aa6f1388689f15cc1c1a77b64 100644 --- a/tests/pytest/wal/insertDataDb2Replica2.json +++ b/tests/pytest/wal/insertDataDb2Replica2.json @@ -22,7 +22,7 @@ "cache": 50, "blocks": 8, "precision": "ms", - "keep": 365, + "keep": 36500, "minRows": 100, "maxRows": 4096, "comp":2, diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim index e5f2928748896a2aaa811ddc76bfb16b9626bf1d..5b1842fcf53f8a0ef8ee272f4a2690574df05a4e 100644 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim +++ b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim @@ -51,7 +51,7 @@ sleep 1000 sql connect sleep 1000 sql create dnode $hostname2 -sleep 1000 +sleep 3000 print ============== step2: create database with replica 2, and create table, insert data $totalTableNum = 10 @@ -272,4 +272,4 @@ system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode5 -s stop -x SIGINT system sh/exec.sh -n dnode6 -s stop -x SIGINT system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim index 8d063020e73be449bc95463e966d9081b0cd5be5..7a716bd065a767266c50ca34677ed34b77e89bc8 100644 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim +++ b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim @@ -51,7 +51,7 @@ sleep 1000 sql connect sleep 1000 sql create dnode $hostname2 -sleep 1000 +sleep 2000 print ============== step2: create database with replica 2, and create table, insert data $totalTableNum = 10 @@ -268,4 +268,4 @@ system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode5 -s stop -x SIGINT system sh/exec.sh -n dnode6 -s stop -x SIGINT system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim index 8f837b7e477ab801b296b32ddcf9a5c683c351f0..7581528d8237d736bb93cce200733510cb209b56 100644 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim +++ b/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim @@ -51,7 +51,7 @@ sleep 1000 sql connect sleep 1000 sql create dnode $hostname2 -sleep 1000 +sleep 2000 print ============== step2: create database with replica 2, and create table, insert data $totalTableNum = 10 @@ -266,4 +266,4 @@ system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode5 -s stop -x SIGINT system sh/exec.sh -n dnode6 -s stop -x SIGINT system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode8 -s stop -x SIGINT