未验证 提交 8f86b514 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #9074 from taosdata/feature/TD-11377

[TD-11377]<feature>: added a parameter for helping k8s to correctly drop a dnode
......@@ -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;
......
......@@ -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;
......
......@@ -19,6 +19,7 @@
#include "tconfig.h"
#include "dnodeMain.h"
bool dnodeExit = false;
static tsem_t exitSem;
static void siguser1Handler(int32_t signum, void *sigInfo, void *context);
static void siguser2Handler(int32_t signum, void *sigInfo, void *context);
......@@ -182,6 +183,8 @@ static void sigintHandler(int32_t signum, void *sigInfo, void *context) {
syslog(LOG_INFO, "Shut down signal is %d", signum);
syslog(LOG_INFO, "Shutting down TDengine service...");
dnodeExit = true;
// inform main thread to exit
tsem_post(&exitSem);
#ifdef WINDOWS
......
......@@ -30,6 +30,7 @@ typedef struct {
int32_t * vnodeList;
} SOpenVnodeThread;
extern bool dnodeExit;
extern void * tsDnodeTmr;
static void * tsStatusTimer = NULL;
static uint32_t tsRebootTime = 0;
......@@ -222,6 +223,22 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
if (clusterId[0] != '\0') {
dnodeSetDropped();
dError("exit zombie dropped dnode");
// warning: only for k8s!
while (tsDnodeNopLoop) {
if (dnodeExit) {
dInfo("Break loop");
return;
}
dInfo("Nop loop");
#ifdef WINDOWS
Sleep(100);
#else
usleep(100000);
#endif
}
exit(EXIT_FAILURE);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册