From 43abbcbf55b851a643f8d4cfbca14a4b3e5f4afe Mon Sep 17 00:00:00 2001 From: xywang Date: Tue, 7 Dec 2021 19:56:40 +0800 Subject: [PATCH] [TD-11377]: added a parameter for k8s --- src/common/inc/tglobal.h | 1 + src/common/src/tglobal.c | 11 +++++++++++ src/dnode/src/dnodeVnodes.c | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 49ca1e31c5..cde5eab487 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -42,6 +42,7 @@ extern int8_t tsArbOnline; extern int64_t tsArbOnlineTimestamp; extern int32_t tsDnodeId; extern int64_t tsDnodeStartTime; +extern int8_t tsDnodeNopLoop; // common extern int tsRpcTimer; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 83026a3774..d29eb09ae1 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -47,6 +47,7 @@ int64_t tsArbOnlineTimestamp = TSDB_ARB_DUMMY_TIME; char tsEmail[TSDB_FQDN_LEN] = {0}; int32_t tsDnodeId = 0; int64_t tsDnodeStartTime = 0; +int8_t tsDnodeNopLoop = 0; // common int32_t tsRpcTimer = 300; @@ -622,6 +623,16 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + cfg.option = "dnodeNopLoop"; + cfg.ptr = &tsDnodeNopLoop; + cfg.valType = TAOS_CFG_VTYPE_INT8; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.minValue = 0; + cfg.maxValue = 1; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + cfg.option = "balance"; cfg.ptr = &tsEnableBalance; cfg.valType = TAOS_CFG_VTYPE_INT8; diff --git a/src/dnode/src/dnodeVnodes.c b/src/dnode/src/dnodeVnodes.c index 93d218581c..47ef92a6e0 100644 --- a/src/dnode/src/dnodeVnodes.c +++ b/src/dnode/src/dnodeVnodes.c @@ -222,6 +222,17 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { if (clusterId[0] != '\0') { dnodeSetDropped(); dError("exit zombie dropped dnode"); + + // warning: only for k8s! + while (tsDnodeNopLoop) { + dInfo("Nop loop"); +#ifdef WINDOWS + Sleep(100); +#else + usleep(100000); +#endif + } + exit(EXIT_FAILURE); } } -- GitLab