提交 f66ed5b6 编写于 作者: S Shengliang Guan

[TD-888] change timer init sequence

上级 59bf9107
...@@ -22,6 +22,8 @@ extern "C" { ...@@ -22,6 +22,8 @@ extern "C" {
int32_t dnodeInitMgmt(); int32_t dnodeInitMgmt();
void dnodeCleanupMgmt(); void dnodeCleanupMgmt();
int32_t dnodeInitMgmtTimer();
void dnodeCleanupMgmtTimer();
void dnodeDispatchToMgmtQueue(SRpcMsg *rpcMsg); void dnodeDispatchToMgmtQueue(SRpcMsg *rpcMsg);
void* dnodeGetVnode(int32_t vgId); void* dnodeGetVnode(int32_t vgId);
......
...@@ -57,6 +57,7 @@ static const SDnodeComponent tsDnodeComponents[] = { ...@@ -57,6 +57,7 @@ static const SDnodeComponent tsDnodeComponents[] = {
{"server", dnodeInitServer, dnodeCleanupServer}, {"server", dnodeInitServer, dnodeCleanupServer},
{"mgmt", dnodeInitMgmt, dnodeCleanupMgmt}, {"mgmt", dnodeInitMgmt, dnodeCleanupMgmt},
{"modules", dnodeInitModules, dnodeCleanupModules}, {"modules", dnodeInitModules, dnodeCleanupModules},
{"mgmt-tmr",dnodeInitMgmtTimer, dnodeCleanupMgmtTimer},
{"shell", dnodeInitShell, dnodeCleanupShell} {"shell", dnodeInitShell, dnodeCleanupShell}
}; };
......
...@@ -147,6 +147,12 @@ int32_t dnodeInitMgmt() { ...@@ -147,6 +147,12 @@ int32_t dnodeInitMgmt() {
return -1; return -1;
} }
dInfo("dnode mgmt is initialized");
return TSDB_CODE_SUCCESS;
}
int32_t dnodeInitMgmtTimer() {
tsDnodeTmr = taosTmrInit(100, 200, 60000, "DND-DM"); tsDnodeTmr = taosTmrInit(100, 200, 60000, "DND-DM");
if (tsDnodeTmr == NULL) { if (tsDnodeTmr == NULL) {
dError("failed to init dnode timer"); dError("failed to init dnode timer");
...@@ -155,13 +161,11 @@ int32_t dnodeInitMgmt() { ...@@ -155,13 +161,11 @@ int32_t dnodeInitMgmt() {
} }
taosTmrReset(dnodeSendStatusMsg, 500, NULL, tsDnodeTmr, &tsStatusTimer); taosTmrReset(dnodeSendStatusMsg, 500, NULL, tsDnodeTmr, &tsStatusTimer);
dInfo("dnode mgmt timer is initialized");
dInfo("dnode mgmt is initialized");
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
void dnodeCleanupMgmt() { void dnodeCleanupMgmtTimer() {
if (tsStatusTimer != NULL) { if (tsStatusTimer != NULL) {
taosTmrStopA(&tsStatusTimer); taosTmrStopA(&tsStatusTimer);
tsStatusTimer = NULL; tsStatusTimer = NULL;
...@@ -171,7 +175,10 @@ void dnodeCleanupMgmt() { ...@@ -171,7 +175,10 @@ void dnodeCleanupMgmt() {
taosTmrCleanUp(tsDnodeTmr); taosTmrCleanUp(tsDnodeTmr);
tsDnodeTmr = NULL; tsDnodeTmr = NULL;
} }
}
void dnodeCleanupMgmt() {
dnodeCleanupMgmtTimer();
dnodeCloseVnodes(); dnodeCloseVnodes();
if (tsMgmtQset) taosQsetThreadResume(tsMgmtQset); if (tsMgmtQset) taosQsetThreadResume(tsMgmtQset);
......
...@@ -41,7 +41,7 @@ typedef struct { ...@@ -41,7 +41,7 @@ typedef struct {
void (*cleanup)(); void (*cleanup)();
} SMnodeComponent; } SMnodeComponent;
void *tsMnodeTmr; void *tsMnodeTmr = NULL;
static bool tsMgmtIsRunning = false; static bool tsMgmtIsRunning = false;
static const SMnodeComponent tsMnodeComponents[] = { static const SMnodeComponent tsMnodeComponents[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册