From e7bd0ca7f1bff52f26280053c998efb7e8b25521 Mon Sep 17 00:00:00 2001 From: Hui Li Date: Sat, 8 Aug 2020 17:35:24 +0800 Subject: [PATCH] [TD-662] --- src/dnode/inc/dnodeCheck.h | 1 - src/dnode/src/dnodeCheck.c | 16 +++++----------- src/dnode/src/dnodeMain.c | 3 +-- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/dnode/inc/dnodeCheck.h b/src/dnode/inc/dnodeCheck.h index 73f6423134..a4880b3c11 100644 --- a/src/dnode/inc/dnodeCheck.h +++ b/src/dnode/inc/dnodeCheck.h @@ -21,7 +21,6 @@ extern "C" { #endif int32_t dnodeInitCheck(); -void dnodeStartCheck(); void dnodeCleanupCheck(); #ifdef __cplusplus diff --git a/src/dnode/src/dnodeCheck.c b/src/dnode/src/dnodeCheck.c index ce03fd093b..a5b6fa09dd 100644 --- a/src/dnode/src/dnodeCheck.c +++ b/src/dnode/src/dnodeCheck.c @@ -14,12 +14,6 @@ */ #define _DEFAULT_SOURCE -#include -#include -#include -#include -#include - #include "os.h" #include "taosdef.h" #include "tglobal.h" @@ -59,7 +53,6 @@ static int bindTcpPort(int port) { return -1; } - if (listen(serverSocket, 5) < 0) { dError("port:%d listen() fail: %s", port, strerror(errno)); close(serverSocket); @@ -101,10 +94,12 @@ static int dnodeCheckNetwork() { for (int port = startPort; port < startPort + 12; port++) { ret = bindTcpPort(port); if (0 != ret) { + dError("failed to tcp bind port %d, quit", port); return -1; } ret = bindUdpPort(port); if (0 != ret) { + dError("failed to udp bind port %d, quit", port); return -1; } } @@ -258,10 +253,6 @@ int32_t dnodeInitCheck() { } } - return 0; -} - -void dnodeStartCheck() { for (ECheckItemType index = 0; index < TSDB_CHECK_ITEM_MAX; ++index) { if (tsCheckItem[index].enable && tsCheckItem[index].startFp) { if ((*tsCheckItem[index].startFp)() != 0) { @@ -270,6 +261,9 @@ void dnodeStartCheck() { } } } + + return 0; } + diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 9d22493485..dded10bd1c 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -49,6 +49,7 @@ typedef struct { } SDnodeComponent; static const SDnodeComponent tsDnodeComponents[] = { + {"check", dnodeInitCheck, dnodeCleanupCheck}, // NOTES: dnodeInitCheck must be first component !!! {"storage", dnodeInitStorage, dnodeCleanupStorage}, {"vread", dnodeInitVnodeRead, dnodeCleanupVnodeRead}, {"vwrite", dnodeInitVnodeWrite, dnodeCleanupVnodeWrite}, @@ -62,7 +63,6 @@ static const SDnodeComponent tsDnodeComponents[] = { {"mgmt-tmr", dnodeInitMgmtTimer, dnodeCleanupMgmtTimer}, {"shell", dnodeInitShell, dnodeCleanupShell}, {"telemetry", dnodeInitTelemetry, dnodeCleanupTelemetry}, - {"check", dnodeInitCheck, dnodeCleanupCheck}, }; static int dnodeCreateDir(const char *dir) { @@ -125,7 +125,6 @@ int32_t dnodeInitSystem() { return -1; } - dnodeStartCheck(); dnodeStartModules(); dnodeSetRunStatus(TSDB_DNODE_RUN_STATUS_RUNING); -- GitLab