From 29d56b0a6455d9dc296a9cca5f97dc7864932568 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 2 Mar 2022 14:00:56 +0800 Subject: [PATCH 1/8] init monitor module --- include/libs/monitor/monitor.h | 139 ++++++++++++++++++++++++ source/libs/CMakeLists.txt | 1 + source/libs/monitor/CMakeLists.txt | 13 +++ source/libs/monitor/inc/monInt.h | 25 +++++ source/libs/monitor/src/monitor.c | 18 +++ source/libs/monitor/test/CMakeLists.txt | 14 +++ source/libs/monitor/test/monTest.cpp | 33 ++++++ 7 files changed, 243 insertions(+) create mode 100644 include/libs/monitor/monitor.h create mode 100644 source/libs/monitor/CMakeLists.txt create mode 100644 source/libs/monitor/inc/monInt.h create mode 100644 source/libs/monitor/src/monitor.c create mode 100644 source/libs/monitor/test/CMakeLists.txt create mode 100644 source/libs/monitor/test/monTest.cpp diff --git a/include/libs/monitor/monitor.h b/include/libs/monitor/monitor.h new file mode 100644 index 0000000000..e4c8137ea4 --- /dev/null +++ b/include/libs/monitor/monitor.h @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_MONITOR_H_ +#define _TD_MONITOR_H_ + +#include "tarray.h" +#include "tdef.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SMonitor SMonitor; + +typedef struct { + int32_t dnode_id; + char dnode_ep[TSDB_EP_LEN]; +} SMonBasicInfo; + +typedef struct { + int32_t dnode_id; + char dnode_ep[TSDB_EP_LEN]; + char status[8]; +} SMonDnodeDesc; + +typedef struct { + int32_t mnode_id; + char mnode_ep[TSDB_EP_LEN]; + char role[8]; +} SMonMnodeDesc; + +typedef struct { + char first_ep[TSDB_EP_LEN]; + int32_t first_ep_dnode_id; + char version[12]; + float master_uptime; // day + int32_t monitor_interval; // sec + int32_t vgroups_total; + int32_t vgroups_alive; + int32_t vnodes_total; + int32_t vnodes_alive; + int32_t connections_total; + SArray *dnodes; // array of SMonDnodeDesc + SArray *mnodes; // array of SMonMnodeDesc +} SMonClusterInfo; + +typedef struct { + float uptime; // day + float cpu_engine; + float cpu_system; + float cpu_cores; + float mem_engine; // MB + float mem_system; // MB + float mem_total; // MB + float disk_engine; // GB + float disk_used; // GB + float disk_total; // GB + float net_in; // Kb/s + float net_out; // Kb/s + float io_read; // Mb/s + float io_write; // Mb/s + float io_read_disk; // Mb/s + float io_write_disk; // Mb/s + int32_t req_select; + float req_select_rate; + int32_t req_insert; + int32_t req_insert_success; + float req_insert_rate; + int32_t req_insert_batch; + int32_t req_insert_batch_success; + float req_insert_batch_rate; + int32_t errors; + int32_t vnodes_num; + int32_t masters; + int32_t has_mnode; +} SMonDnodeInfo; + +typedef struct { + char name[TSDB_FILENAME_LEN]; + int32_t level; + SDiskSize size; +} SMonDiskDesc; + +typedef struct { + SArray *disks; // array of SMonDiskDesc +} SMonDiskInfo; + +typedef struct { + int32_t dnode_id; + int8_t vnode_online; + char vnode_role[8]; +} SMonVnodeDesc; + +typedef struct { + int32_t vgroup_id; + SMonVnodeDesc vnodes[TSDB_MAX_REPLICA]; +} SMonVgroupDesc; + +typedef struct { + char database_name[TSDB_DB_NAME_LEN]; + int32_t tables_num; + int8_t status; + SArray *vgroups; // array of SMonVgroupDesc +} SMonVgroupInfo; + +typedef struct { + int64_t ts; + int8_t level; + char content[1024]; +} SMonLogItem; + +typedef struct { + SArray *logs; // array of SMonLogItem +} SMonLogInfo; + +typedef struct { + int32_t expire_time; + int32_t timeseries_used; + int32_t timeseries_total; +} SMonGrantInfo; + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_MONITOR_H_*/ diff --git a/source/libs/CMakeLists.txt b/source/libs/CMakeLists.txt index e07e46948f..78625d1eed 100644 --- a/source/libs/CMakeLists.txt +++ b/source/libs/CMakeLists.txt @@ -14,5 +14,6 @@ add_subdirectory(function) add_subdirectory(qcom) add_subdirectory(qworker) add_subdirectory(tfs) +add_subdirectory(monitor) add_subdirectory(nodes) add_subdirectory(scalar) diff --git a/source/libs/monitor/CMakeLists.txt b/source/libs/monitor/CMakeLists.txt new file mode 100644 index 0000000000..309d63691c --- /dev/null +++ b/source/libs/monitor/CMakeLists.txt @@ -0,0 +1,13 @@ +aux_source_directory(src MONITOR_SRC) +add_library(monitor STATIC ${MONITOR_SRC}) +target_include_directories( + monitor + PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/monitor" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) + +target_link_libraries(monitor os util common) + +if(${BUILD_TEST}) + add_subdirectory(test) +endif(${BUILD_TEST}) \ No newline at end of file diff --git a/source/libs/monitor/inc/monInt.h b/source/libs/monitor/inc/monInt.h new file mode 100644 index 0000000000..5798f44a4d --- /dev/null +++ b/source/libs/monitor/inc/monInt.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_MONITOR_INT_H_ +#define _TD_MONITOR_INT_H_ + +#include "monitor.h" + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_MONITOR_INT_H_*/ diff --git a/source/libs/monitor/src/monitor.c b/source/libs/monitor/src/monitor.c new file mode 100644 index 0000000000..b372240bd5 --- /dev/null +++ b/source/libs/monitor/src/monitor.c @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#define _DEFAULT_SOURCE +#include "monInt.h" + diff --git a/source/libs/monitor/test/CMakeLists.txt b/source/libs/monitor/test/CMakeLists.txt new file mode 100644 index 0000000000..e3ab7e7337 --- /dev/null +++ b/source/libs/monitor/test/CMakeLists.txt @@ -0,0 +1,14 @@ +enable_testing() + +aux_source_directory(. MONITOR_TEST_SRC) +add_executable(monitor_test ${MONITOR_TEST_SRC}) +target_link_libraries( + monitor_test + PUBLIC monitor + PUBLIC gtest_main +) + +add_test( + NAME monitor_test + COMMAND monitor_test +) diff --git a/source/libs/monitor/test/monTest.cpp b/source/libs/monitor/test/monTest.cpp new file mode 100644 index 0000000000..a1805d0c9c --- /dev/null +++ b/source/libs/monitor/test/monTest.cpp @@ -0,0 +1,33 @@ +/** + * @file monTest.cpp + * @author slguan (slguan@taosdata.com) + * @brief monitor module tests + * @version 1.0 + * @date 2022-03-05 + * + * @copyright Copyright (c) 2022 + * + */ + +#include +#include "os.h" + +#include "monitor.h" + +class MonitorTest : public ::testing::Test { + protected: + static void SetUpTestSuite() { root = "/tmp/monTest"; } + static void TearDownTestSuite() {} + + public: + void SetUp() override {} + void TearDown() override {} + + static const char *root; +}; + +const char *MonitorTest::root; + +TEST_F(MonitorTest, 01_Open_Close) { + +} From 10fd86209d97edf2254d0caec646a908d4e4d8e6 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 2 Mar 2022 14:10:27 +0800 Subject: [PATCH 2/8] minor changes --- include/os/osSysinfo.h | 1 - source/dnode/mgmt/impl/src/dndEnv.c | 21 +++------------------ source/dnode/vnode/inc/vnode.h | 4 ---- source/os/src/osSysinfo.c | 3 --- 4 files changed, 3 insertions(+), 26 deletions(-) diff --git a/include/os/osSysinfo.h b/include/os/osSysinfo.h index 35ac032a8a..bf9d7662e6 100644 --- a/include/os/osSysinfo.h +++ b/include/os/osSysinfo.h @@ -42,7 +42,6 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage); bool taosGetTotalSysMemoryKB(uint64_t *kb); bool taosGetProcMemory(float *memoryUsedMB); // bool taosGetSysMemory(float *memoryUsedMB); // -void taosGetDisk(); int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize); bool taosReadProcIO(int64_t *rchars, int64_t *wchars); bool taosGetProcIO(float *readKB, float *writeKB); diff --git a/source/dnode/mgmt/impl/src/dndEnv.c b/source/dnode/mgmt/impl/src/dndEnv.c index 9467b56e6b..9f6c22067d 100644 --- a/source/dnode/mgmt/impl/src/dndEnv.c +++ b/source/dnode/mgmt/impl/src/dndEnv.c @@ -288,12 +288,9 @@ int32_t dndInit() { return -1; } - SVnodeOpt vnodeOpt = { - .sver = tsVersion, - .nthreads = tsNumOfCommitThreads, - .putReqToVQueryQFp = dndPutReqToVQueryQ, - .sendReqToDnodeFp = dndSendReqToDnode - }; + SVnodeOpt vnodeOpt = {.nthreads = tsNumOfCommitThreads, + .putReqToVQueryQFp = dndPutReqToVQueryQ, + .sendReqToDnodeFp = dndSendReqToDnode}; if (vnodeInit(&vnodeOpt) != 0) { dError("failed to init vnode since %s", terrstr()); @@ -318,15 +315,3 @@ void dndCleanup() { taosStopCacheRefreshWorker(); dInfo("dnode env is cleaned up"); } - -// OTHER FUNCTIONS =================================== -void taosGetDisk() { -#if 0 - const double unit = 1024 * 1024 * 1024; - - SDiskSize diskSize = tfsGetSize(pTfs); - - tfsUpdateSize(&fsMeta); - -#endif -} \ No newline at end of file diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 31f04e840a..b5b53d9361 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -60,10 +60,6 @@ typedef struct { } SVnodeCfg; typedef struct { - int32_t sver; - const char *timezone; - const char *locale; - const char *charset; uint16_t nthreads; // number of commit threads. 0 for no threads and a schedule queue should be given (TODO) PutReqToVQueryQFp putReqToVQueryQFp; SendReqToDnodeFp sendReqToDnodeFp; diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 163fad803f..3e761c6d91 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -167,11 +167,9 @@ void taosGetSystemInfo() { tsTotalMemoryMB = taosGetTotalMemory(); float tmp1, tmp2; - // taosGetDisk(); taosGetBandSpeed(&tmp1); taosGetCpuUsage(&tmp1, &tmp2); taosGetProcIO(&tmp1, &tmp2); - } void taosKillSystem() { @@ -712,7 +710,6 @@ void taosGetSystemInfo() { float tmp1, tmp2; taosGetSysMemory(&tmp1); taosGetProcMemory(&tmp2); - // taosGetDisk(); taosGetBandSpeed(&tmp1); taosGetCpuUsage(&tmp1, &tmp2); taosGetProcIO(&tmp1, &tmp2); From 4cf8c0acf44095185f5b554d42339d64dd6e6687 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 2 Mar 2022 14:44:04 +0800 Subject: [PATCH 3/8] monitor --- include/common/tglobal.h | 6 ++++++ source/common/src/tglobal.c | 19 ++++++++++++++++++- source/dnode/mgmt/impl/src/dndEnv.c | 9 ++++----- source/dnode/mgmt/impl/src/dndMgmt.c | 26 +++++++++++++++++++++++--- 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index e09f6d11bd..a0f83200c9 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -52,6 +52,12 @@ extern bool tsEnableSlaveQuery; extern bool tsPrintAuth; extern int64_t tsTickPerDay[3]; +// monitor +extern bool tsEnableMonitor; +extern int32_t tsMonitorInterval; +extern char tsMonitorFqdn[]; +extern uint16_t tsMonitorPort; + // query buffer management extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in byte for each data node diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index d66895888b..9905cf9833 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -46,6 +46,12 @@ int32_t tsMaxBinaryDisplayWidth = 30; bool tsEnableSlaveQuery = 1; bool tsPrintAuth = 0; +// monitor +bool tsEnableMonitor = 1; +int32_t tsMonitorInterval = 5; +char tsMonitorFqdn[TSDB_FQDN_LEN] = {0}; +uint16_t tsMonitorPort = 6043; + /* * denote if the server needs to compress response message at the application layer to client, including query rsp, * metricmeta rsp, and multi-meter query rsp message body. The client compress the submit message to server. @@ -314,6 +320,12 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "printAuth", tsPrintAuth, 0) != 0) return -1; if (cfgAddBool(pCfg, "slaveQuery", tsEnableSlaveQuery, 0) != 0) return -1; if (cfgAddBool(pCfg, "deadLockKillQuery", tsDeadLockKillQuery, 0) != 0) return -1; + + if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1; + if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 360000, 0) != 0) return -1; + if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, 0) != 0) return -1; + if (cfgAddInt32(pCfg, "monitorPort", tsMonitorPort, 1, 65056, 0) != 0) return -1; + return 0; } @@ -345,7 +357,7 @@ static void taosSetServerLogCfg(SConfig *pCfg) { } static void taosSetClientCfg(SConfig *pCfg) { - tstrncpy(tsLocalFqdn, cfgGetItem(pCfg, "fqdn")->str, TSDB_EP_LEN); + tstrncpy(tsLocalFqdn, cfgGetItem(pCfg, "fqdn")->str, TSDB_FQDN_LEN); tsServerPort = (uint16_t)cfgGetItem(pCfg, "serverPort")->i32; snprintf(tsLocalEp, sizeof(tsLocalEp), "%s:%u", tsLocalFqdn, tsServerPort); @@ -425,6 +437,11 @@ static void taosSetServerCfg(SConfig *pCfg) { tsEnableSlaveQuery = cfgGetItem(pCfg, "slaveQuery")->bval; tsDeadLockKillQuery = cfgGetItem(pCfg, "deadLockKillQuery")->bval; + tsEnableMonitor = cfgGetItem(pCfg, "monitor")->bval; + tsMonitorInterval = cfgGetItem(pCfg, "monitorInterval")->i32; + tstrncpy(tsMonitorFqdn, cfgGetItem(pCfg, "monitorFqdn")->str, TSDB_FQDN_LEN); + tsMonitorPort = (uint16_t)cfgGetItem(pCfg, "monitorPort")->i32; + if (tsQueryBufferSize >= 0) { tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL; } diff --git a/source/dnode/mgmt/impl/src/dndEnv.c b/source/dnode/mgmt/impl/src/dndEnv.c index 9f6c22067d..da75b4524a 100644 --- a/source/dnode/mgmt/impl/src/dndEnv.c +++ b/source/dnode/mgmt/impl/src/dndEnv.c @@ -140,7 +140,7 @@ static int32_t dndInitDir(SDnode *pDnode, SDnodeObjCfg *pCfg) { return 0; } -static void dndCloseImp(SDnode *pDnode) { +static void dndCloseDir(SDnode *pDnode) { tfree(pDnode->dir.mnode); tfree(pDnode->dir.vnodes); tfree(pDnode->dir.dnode); @@ -260,7 +260,7 @@ void dndClose(SDnode *pDnode) { dndCleanupMgmt(pDnode); tfsClose(pDnode->pTfs); - dndCloseImp(pDnode); + dndCloseDir(pDnode); free(pDnode); dInfo("dnode object is closed, data:%p", pDnode); } @@ -288,9 +288,8 @@ int32_t dndInit() { return -1; } - SVnodeOpt vnodeOpt = {.nthreads = tsNumOfCommitThreads, - .putReqToVQueryQFp = dndPutReqToVQueryQ, - .sendReqToDnodeFp = dndSendReqToDnode}; + SVnodeOpt vnodeOpt = { + .nthreads = tsNumOfCommitThreads, .putReqToVQueryQFp = dndPutReqToVQueryQ, .sendReqToDnodeFp = dndSendReqToDnode}; if (vnodeInit(&vnodeOpt) != 0) { dError("failed to init vnode since %s", terrstr()); diff --git a/source/dnode/mgmt/impl/src/dndMgmt.c b/source/dnode/mgmt/impl/src/dndMgmt.c index 8f18222ab6..ac9f53a935 100644 --- a/source/dnode/mgmt/impl/src/dndMgmt.c +++ b/source/dnode/mgmt/impl/src/dndMgmt.c @@ -473,19 +473,39 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) { rpcSendResponse(&rpcRsp); } +static void dndSendMonitorReport(SDnode *pDnode) { + if (!tsEnableMonitor || tsMonitorFqdn[0] == 0) return; + + dTrace("pDnode:%p, send monitor report to %s:%u", pDnode, tsMonitorFqdn, tsMonitorPort); +} + static void *dnodeThreadRoutine(void *param) { SDnode *pDnode = param; SDnodeMgmt *pMgmt = &pDnode->dmgmt; - int32_t ms = tsStatusInterval * 1000; + int64_t lastStatusTime = taosGetTimestampMs(); + int64_t lastMonitorTime = lastStatusTime; setThreadName("dnode-hb"); while (true) { pthread_testcancel(); - taosMsleep(ms); + taosMsleep(200); + if (dndGetStat(pDnode) != DND_STAT_RUNNING || pMgmt->dropped) { + continue; + } - if (dndGetStat(pDnode) == DND_STAT_RUNNING && !pMgmt->statusSent && !pMgmt->dropped) { + int64_t curTime = taosGetTimestampMs(); + + float statusInterval = (curTime - lastStatusTime) / 1000.0f; + if (statusInterval >= tsStatusInterval && !pMgmt->statusSent) { dndSendStatusReq(pDnode); + lastStatusTime = curTime; + } + + float monitorInterval = (curTime - lastMonitorTime) / 1000.0f; + if (monitorInterval >= tsMonitorInterval) { + dndSendMonitorReport(pDnode); + lastMonitorTime = curTime; } } } From 4f4100f9c6d602a06554fb0fa967f7a0d5a68137 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 2 Mar 2022 15:41:19 +0800 Subject: [PATCH 4/8] monitor --- include/common/tglobal.h | 1 + include/libs/monitor/monitor.h | 28 ++++++++-- source/common/src/tglobal.c | 3 + source/dnode/mgmt/impl/CMakeLists.txt | 1 + source/dnode/mgmt/impl/src/dndEnv.c | 9 +++ source/dnode/mgmt/impl/src/dndMgmt.c | 10 ++++ source/libs/monitor/inc/monInt.h | 17 ++++++ source/libs/monitor/src/monitor.c | 79 +++++++++++++++++++++++++++ source/util/src/tjson.c | 6 +- 9 files changed, 147 insertions(+), 7 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index a0f83200c9..2261170e63 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -57,6 +57,7 @@ extern bool tsEnableMonitor; extern int32_t tsMonitorInterval; extern char tsMonitorFqdn[]; extern uint16_t tsMonitorPort; +extern int32_t tsMonitorMaxLogs; // query buffer management extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing diff --git a/include/libs/monitor/monitor.h b/include/libs/monitor/monitor.h index e4c8137ea4..747c46c0c6 100644 --- a/include/libs/monitor/monitor.h +++ b/include/libs/monitor/monitor.h @@ -23,8 +23,6 @@ extern "C" { #endif -typedef struct SMonitor SMonitor; - typedef struct { int32_t dnode_id; char dnode_ep[TSDB_EP_LEN]; @@ -122,16 +120,34 @@ typedef struct { char content[1024]; } SMonLogItem; -typedef struct { - SArray *logs; // array of SMonLogItem -} SMonLogInfo; - typedef struct { int32_t expire_time; int32_t timeseries_used; int32_t timeseries_total; } SMonGrantInfo; +typedef struct SMonInfo SMonInfo; + +typedef struct { + const char *server; + uint16_t port; + int32_t maxLogs; +} SMonCfg; + +int32_t monInit(const SMonCfg *pCfg); +void monCleanup(); +void monAddLogItem(SMonLogItem *pItem); + +SMonInfo *monCreateMonitorInfo(); +void monSetBasicInfo(SMonInfo *pMonitor, SMonBasicInfo *pInfo); +void monSetClusterInfo(SMonInfo *pMonitor, SMonClusterInfo *pInfo); +void monSetDnodeInfo(SMonInfo *pMonitor, SMonDnodeInfo *pInfo); +void monSetDiskInfo(SMonInfo *pMonitor, SMonDiskInfo *pInfo); +void monSetVgroupInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo); +void monSetGrantInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo); +void monSendReport(SMonInfo *pMonitor); +void monCleanupMonitorInfo(SMonInfo *pMonitor); + #ifdef __cplusplus } #endif diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 9905cf9833..5998b7c9ce 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -51,6 +51,7 @@ bool tsEnableMonitor = 1; int32_t tsMonitorInterval = 5; char tsMonitorFqdn[TSDB_FQDN_LEN] = {0}; uint16_t tsMonitorPort = 6043; +int32_t tsMonitorMaxLogs = 100; /* * denote if the server needs to compress response message at the application layer to client, including query rsp, @@ -325,6 +326,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 360000, 0) != 0) return -1; if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, 0) != 0) return -1; if (cfgAddInt32(pCfg, "monitorPort", tsMonitorPort, 1, 65056, 0) != 0) return -1; + if (cfgAddInt32(pCfg, "monitorMaxLogs", tsMonitorMaxLogs, 1, 1000000, 0) != 0) return -1; return 0; } @@ -441,6 +443,7 @@ static void taosSetServerCfg(SConfig *pCfg) { tsMonitorInterval = cfgGetItem(pCfg, "monitorInterval")->i32; tstrncpy(tsMonitorFqdn, cfgGetItem(pCfg, "monitorFqdn")->str, TSDB_FQDN_LEN); tsMonitorPort = (uint16_t)cfgGetItem(pCfg, "monitorPort")->i32; + tsMonitorMaxLogs = cfgGetItem(pCfg, "monitorMaxLogs")->i32; if (tsQueryBufferSize >= 0) { tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL; diff --git a/source/dnode/mgmt/impl/CMakeLists.txt b/source/dnode/mgmt/impl/CMakeLists.txt index 171f9649fb..ec9e1be02d 100644 --- a/source/dnode/mgmt/impl/CMakeLists.txt +++ b/source/dnode/mgmt/impl/CMakeLists.txt @@ -12,6 +12,7 @@ target_link_libraries( PUBLIC sync PUBLIC taos PUBLIC tfs + PUBLIC monitor ) target_include_directories( dnode diff --git a/source/dnode/mgmt/impl/src/dndEnv.c b/source/dnode/mgmt/impl/src/dndEnv.c index da75b4524a..2539443b41 100644 --- a/source/dnode/mgmt/impl/src/dndEnv.c +++ b/source/dnode/mgmt/impl/src/dndEnv.c @@ -21,6 +21,7 @@ #include "dndSnode.h" #include "dndTransport.h" #include "dndVnodes.h" +#include "monitor.h" #include "sync.h" #include "tfs.h" #include "wal.h" @@ -297,6 +298,13 @@ int32_t dndInit() { return -1; } + SMonCfg monCfg = {.maxLogs = tsMonitorMaxLogs, .port = tsMonitorPort, .server = tsMonitorFqdn}; + if (monInit(&monCfg) != 0) { + dError("failed to init monitor since %s", terrstr()); + dndCleanup(); + return -1; + } + dInfo("dnode env is initialized"); return 0; } @@ -310,6 +318,7 @@ void dndCleanup() { walCleanUp(); vnodeCleanup(); rpcCleanup(); + monCleanup(); taosStopCacheRefreshWorker(); dInfo("dnode env is cleaned up"); diff --git a/source/dnode/mgmt/impl/src/dndMgmt.c b/source/dnode/mgmt/impl/src/dndMgmt.c index ac9f53a935..171bdc792c 100644 --- a/source/dnode/mgmt/impl/src/dndMgmt.c +++ b/source/dnode/mgmt/impl/src/dndMgmt.c @@ -22,6 +22,7 @@ #include "dndTransport.h" #include "dndVnodes.h" #include "dndWorker.h" +#include "monitor.h" static void dndProcessMgmtQueue(SDnode *pDnode, SRpcMsg *pMsg); @@ -475,8 +476,17 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) { static void dndSendMonitorReport(SDnode *pDnode) { if (!tsEnableMonitor || tsMonitorFqdn[0] == 0) return; + SMonInfo *pMonitor = monCreateMonitorInfo(); + if (pMonitor == NULL) return; dTrace("pDnode:%p, send monitor report to %s:%u", pDnode, tsMonitorFqdn, tsMonitorPort); + + SMonBasicInfo basicInfo = {.dnode_id = dndGetDnodeId(pDnode)}; + tstrncpy(basicInfo.dnode_ep, tsLocalEp, TSDB_EP_LEN); + monSetBasicInfo(pMonitor, &basicInfo); + + monSendReport(pMonitor); + monCleanupMonitorInfo(pMonitor); } static void *dnodeThreadRoutine(void *param) { diff --git a/source/libs/monitor/inc/monInt.h b/source/libs/monitor/inc/monInt.h index 5798f44a4d..61f9980e4e 100644 --- a/source/libs/monitor/inc/monInt.h +++ b/source/libs/monitor/inc/monInt.h @@ -18,6 +18,23 @@ #include "monitor.h" +#include "tarray.h" +#include "tlockfree.h" +#include "tjson.h" + +typedef struct { + SRWLatch lock; + SArray *logs; // array of SMonLogItem + int32_t maxLogs; + const char *server; + uint16_t port; +} SMonitor; + +typedef struct SMonInfo { + SArray *logs; // array of SMonLogItem + SJson *pJson; +} SMonInfo; + #ifdef __cplusplus } #endif diff --git a/source/libs/monitor/src/monitor.c b/source/libs/monitor/src/monitor.c index b372240bd5..0bb1775135 100644 --- a/source/libs/monitor/src/monitor.c +++ b/source/libs/monitor/src/monitor.c @@ -15,4 +15,83 @@ #define _DEFAULT_SOURCE #include "monInt.h" +#include "taoserror.h" +#include "thttp.h" +#include "tlog.h" +static SMonitor tsMonitor = {0}; + +int32_t monInit(const SMonCfg *pCfg) { + tsMonitor.logs = taosArrayInit(16, sizeof(SMonInfo)); + if (tsMonitor.logs == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + tsMonitor.maxLogs = pCfg->maxLogs; + tsMonitor.server = pCfg->server; + tsMonitor.port = pCfg->port; + taosInitRWLatch(&tsMonitor.lock); + return 0; +} + +void monCleanup() { + taosArrayDestroy(tsMonitor.logs); + tsMonitor.logs = NULL; +} + +void monAddLogItem(SMonLogItem *pItem) { + taosWLockLatch(&tsMonitor.lock); + int32_t size = taosArrayGetSize(tsMonitor.logs); + if (size > tsMonitor.maxLogs) { + uInfo("too many logs for monitor"); + } else { + taosArrayPush(tsMonitor.logs, pItem); + } + taosWUnLockLatch(&tsMonitor.lock); +} + +SMonInfo *monCreateMonitorInfo() { + SMonInfo *pMonitor = calloc(1, sizeof(SMonInfo)); + if (pMonitor == NULL) return NULL; + + taosWLockLatch(&tsMonitor.lock); + pMonitor->logs = taosArrayDup(pMonitor->logs); + taosArrayClear(tsMonitor.logs); + taosWUnLockLatch(&tsMonitor.lock); + + pMonitor->pJson = tjsonCreateObject(); + if (pMonitor->pJson == NULL || pMonitor->logs == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + monCleanupMonitorInfo(pMonitor); + return NULL; + } + + return pMonitor; +} + +void monCleanupMonitorInfo(SMonInfo *pMonitor) { + taosArrayDestroy(pMonitor->logs); + tjsonDelete(pMonitor->pJson); + free(pMonitor); +} + +void monSendReport(SMonInfo *pMonitor) { + char *pCont = tjsonToString(pMonitor->pJson); + if (pCont != NULL) { + taosSendHttpReport(tsMonitor.server, tsMonitor.port, pCont, strlen(pCont)); + free(pCont); + } +} + +void monSetBasicInfo(SMonInfo *pMonitor, SMonBasicInfo *pInfo) { + SJson *pJson = pMonitor->pJson; + tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id); + tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep); +} + +void monSetClusterInfo(SMonInfo *pMonitor, SMonClusterInfo *pInfo); +void monSetDnodeInfo(SMonInfo *pMonitor, SMonDnodeInfo *pInfo); +void monSetDiskInfo(SMonInfo *pMonitor, SMonDiskInfo *pInfo); +void monSetVgroupInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo); +void monSetGrantInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo); diff --git a/source/util/src/tjson.c b/source/util/src/tjson.c index 2c117771b1..27848c4e23 100644 --- a/source/util/src/tjson.c +++ b/source/util/src/tjson.c @@ -26,7 +26,11 @@ SJson* tjsonCreateObject() { return pJson; } -void tjsonDelete(SJson* pJson) { cJSON_Delete((cJSON*)pJson); } +void tjsonDelete(SJson* pJson) { + if (pJson != NULL) { + cJSON_Delete((cJSON*)pJson); + } +} int32_t tjsonAddIntegerToObject(SJson* pJson, const char* pName, const uint64_t number) { char tmp[40] = {0}; From 8b1a991186a9f8afd6a345dd4be8bd1d8c408c91 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 2 Mar 2022 16:45:37 +0800 Subject: [PATCH 5/8] send the basic information of the monitor --- include/common/ttime.h | 2 ++ source/common/src/ttime.c | 47 +++++++++++++++++++++++++++++++ source/libs/monitor/src/monitor.c | 8 +++++- source/util/src/thttp.c | 10 +++---- 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/include/common/ttime.h b/include/common/ttime.h index a4b2aa6673..b71426e312 100644 --- a/include/common/ttime.h +++ b/include/common/ttime.h @@ -52,6 +52,8 @@ void deltaToUtcInitOnce(); int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision); +void taosFormatUtcTime(char *buf, int32_t bufLen, int64_t time, int32_t precision); + #ifdef __cplusplus } #endif diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 460c4a6fc0..7a318c2eb8 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -627,3 +627,50 @@ const char* fmtts(int64_t ts) { return buf; } + +void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision) { + char ts[40] = {0}; + struct tm* ptm; + + int32_t fractionLen; + char* format = NULL; + time_t quot = 0; + long mod = 0; + + switch (precision) { + case TSDB_TIME_PRECISION_MILLI: { + quot = t / 1000; + fractionLen = 5; + format = ".%03" PRId64; + mod = t % 1000; + break; + } + + case TSDB_TIME_PRECISION_MICRO: { + quot = t / 1000000; + fractionLen = 8; + format = ".%06" PRId64; + mod = t % 1000000; + break; + } + + case TSDB_TIME_PRECISION_NANO: { + quot = t / 1000000000; + fractionLen = 11; + format = ".%09" PRId64; + mod = t % 1000000000; + break; + } + + default: + fractionLen = 0; + assert(false); + } + + ptm = localtime("); + int32_t length = (int32_t)strftime(ts, 40, "%Y-%m-%dT%H:%M:%S", ptm); + length += snprintf(ts + length, fractionLen, format, mod); + length += (int32_t)strftime(ts + length, 40 - length, "%z", ptm); + + tstrncpy(buf, ts, bufLen); +} \ No newline at end of file diff --git a/source/libs/monitor/src/monitor.c b/source/libs/monitor/src/monitor.c index 0bb1775135..f8a9039f48 100644 --- a/source/libs/monitor/src/monitor.c +++ b/source/libs/monitor/src/monitor.c @@ -18,6 +18,7 @@ #include "taoserror.h" #include "thttp.h" #include "tlog.h" +#include "ttime.h" static SMonitor tsMonitor = {0}; @@ -56,7 +57,7 @@ SMonInfo *monCreateMonitorInfo() { if (pMonitor == NULL) return NULL; taosWLockLatch(&tsMonitor.lock); - pMonitor->logs = taosArrayDup(pMonitor->logs); + pMonitor->logs = taosArrayDup(tsMonitor.logs); taosArrayClear(tsMonitor.logs); taosWUnLockLatch(&tsMonitor.lock); @@ -88,6 +89,11 @@ void monSetBasicInfo(SMonInfo *pMonitor, SMonBasicInfo *pInfo) { SJson *pJson = pMonitor->pJson; tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id); tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep); + + int64_t ms = taosGetTimestampMs(); + char buf[40] = {0}; + taosFormatUtcTime(buf, sizeof(buf), ms, TSDB_TIME_PRECISION_MILLI); + tjsonAddStringToObject(pJson, "ts", buf); } void monSetClusterInfo(SMonInfo *pMonitor, SMonClusterInfo *pInfo); diff --git a/source/util/src/thttp.c b/source/util/src/thttp.c index 14c39d3f03..aa4c795744 100644 --- a/source/util/src/thttp.c +++ b/source/util/src/thttp.c @@ -32,7 +32,7 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, const char* pCont, fd = taosOpenTcpClientSocket(ip, port, 0); if (fd < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to create http socket since %s", terrstr()); + uError("failed to create socket to %s:%u since %s", server, port, terrstr()); goto SEND_OVER; } @@ -46,24 +46,24 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, const char* pCont, if (taosWriteSocket(fd, (void*)header, headLen) < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to send http header since %s", terrstr()); + uError("failed to send http header to %s:%u since %s", server, port, terrstr()); goto SEND_OVER; } if (taosWriteSocket(fd, (void*)pCont, contLen) < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to send http content since %s", terrstr()); + uError("failed to send http content to %s:%u since %s", server, port, terrstr()); goto SEND_OVER; } // read something to avoid nginx error 499 if (taosReadSocket(fd, header, 10) < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to receive response since %s", terrstr()); + uError("failed to receive response from %s:%u since %s", server, port, terrstr()); goto SEND_OVER; } - uInfo("send http to %s:%d, len:%d content: %s", server, port, contLen, pCont); + uInfo("send http to %s:%u, len:%d content: %s", server, port, contLen, pCont); code = 0; SEND_OVER: From dc30a83f2494a1adba21435c31e176e435dda13c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 2 Mar 2022 17:48:39 +0800 Subject: [PATCH 6/8] monitor --- include/dnode/mnode/mnode.h | 25 +++------ include/libs/monitor/monitor.h | 52 +++++++++---------- source/common/CMakeLists.txt | 2 +- source/common/src/tname.c | 3 +- source/dnode/bnode/CMakeLists.txt | 2 +- source/dnode/mgmt/daemon/CMakeLists.txt | 2 +- source/dnode/mgmt/impl/CMakeLists.txt | 13 +---- source/dnode/mgmt/impl/inc/dndInt.h | 1 + source/dnode/mgmt/impl/inc/dndMnode.h | 3 ++ source/dnode/mgmt/impl/src/dndMgmt.c | 18 ++++++- source/dnode/mgmt/impl/src/dndMnode.c | 10 ++++ .../dnode/mgmt/impl/test/sut/CMakeLists.txt | 2 +- source/dnode/mnode/impl/CMakeLists.txt | 10 +--- source/dnode/mnode/impl/inc/mndInt.h | 22 ++++++-- source/dnode/mnode/impl/src/mnode.c | 10 ++-- source/dnode/mnode/sdb/CMakeLists.txt | 7 +-- source/dnode/qnode/CMakeLists.txt | 2 +- source/dnode/snode/CMakeLists.txt | 2 +- source/libs/cache/CMakeLists.txt | 2 +- source/libs/catalog/CMakeLists.txt | 2 +- source/libs/function/CMakeLists.txt | 2 +- source/libs/index/CMakeLists.txt | 2 +- source/libs/monitor/src/monitor.c | 24 +++++++-- source/libs/parser/CMakeLists.txt | 2 +- source/libs/planner/CMakeLists.txt | 2 +- source/libs/scheduler/CMakeLists.txt | 2 +- source/libs/sync/CMakeLists.txt | 2 +- source/libs/transport/CMakeLists.txt | 2 +- source/libs/wal/CMakeLists.txt | 2 +- source/os/CMakeLists.txt | 8 +-- source/util/src/thttp.c | 2 +- 31 files changed, 135 insertions(+), 105 deletions(-) diff --git a/include/dnode/mnode/mnode.h b/include/dnode/mnode/mnode.h index 2680bb83ed..d295e772e8 100644 --- a/include/dnode/mnode/mnode.h +++ b/include/dnode/mnode/mnode.h @@ -16,6 +16,8 @@ #ifndef _TD_MND_H_ #define _TD_MND_H_ +#include "monitor.h" + #ifdef __cplusplus extern "C" { #endif @@ -30,20 +32,6 @@ typedef int32_t (*PutReqToMWriteQFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); typedef int32_t (*PutReqToMReadQFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); typedef void (*SendRedirectRspFp)(SDnode *pDnode, struct SRpcMsg *rpcMsg); -typedef struct SMnodeLoad { - int64_t numOfDnode; - int64_t numOfMnode; - int64_t numOfVgroup; - int64_t numOfDatabase; - int64_t numOfSuperTable; - int64_t numOfChildTable; - int64_t numOfNormalTable; - int64_t numOfColumn; - int64_t totalPoints; - int64_t totalStorage; - int64_t compStorage; -} SMnodeLoad; - typedef struct { int32_t dnodeId; int64_t clusterId; @@ -92,13 +80,16 @@ int32_t mndAlter(SMnode *pMnode, const SMnodeOpt *pOption); void mndDestroy(const char *path); /** - * @brief Get mnode statistics info. + * @brief Get mnode monitor info. * * @param pMnode The mnode object. - * @param pLoad Statistics of the mnode. + * @param pClusterInfo + * @param pVgroupInfo + * @param pGrantInfo * @return int32_t 0 for success, -1 for failure. */ -int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad); +int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo, + SMonGrantInfo *pGrantInfo); /** * @brief Get user authentication info. diff --git a/include/libs/monitor/monitor.h b/include/libs/monitor/monitor.h index 747c46c0c6..4b7c6a9bc9 100644 --- a/include/libs/monitor/monitor.h +++ b/include/libs/monitor/monitor.h @@ -55,6 +55,30 @@ typedef struct { SArray *mnodes; // array of SMonMnodeDesc } SMonClusterInfo; +typedef struct { + int32_t dnode_id; + int8_t vnode_online; + char vnode_role[8]; +} SMonVnodeDesc; + +typedef struct { + int32_t vgroup_id; + SMonVnodeDesc vnodes[TSDB_MAX_REPLICA]; +} SMonVgroupDesc; + +typedef struct { + char database_name[TSDB_DB_NAME_LEN]; + int32_t tables_num; + int8_t status; + SArray *vgroups; // array of SMonVgroupDesc +} SMonVgroupInfo; + +typedef struct { + int32_t expire_time; + int32_t timeseries_used; + int32_t timeseries_total; +} SMonGrantInfo; + typedef struct { float uptime; // day float cpu_engine; @@ -96,36 +120,12 @@ typedef struct { SArray *disks; // array of SMonDiskDesc } SMonDiskInfo; -typedef struct { - int32_t dnode_id; - int8_t vnode_online; - char vnode_role[8]; -} SMonVnodeDesc; - -typedef struct { - int32_t vgroup_id; - SMonVnodeDesc vnodes[TSDB_MAX_REPLICA]; -} SMonVgroupDesc; - -typedef struct { - char database_name[TSDB_DB_NAME_LEN]; - int32_t tables_num; - int8_t status; - SArray *vgroups; // array of SMonVgroupDesc -} SMonVgroupInfo; - typedef struct { int64_t ts; int8_t level; char content[1024]; } SMonLogItem; -typedef struct { - int32_t expire_time; - int32_t timeseries_used; - int32_t timeseries_total; -} SMonGrantInfo; - typedef struct SMonInfo SMonInfo; typedef struct { @@ -141,10 +141,10 @@ void monAddLogItem(SMonLogItem *pItem); SMonInfo *monCreateMonitorInfo(); void monSetBasicInfo(SMonInfo *pMonitor, SMonBasicInfo *pInfo); void monSetClusterInfo(SMonInfo *pMonitor, SMonClusterInfo *pInfo); +void monSetVgroupInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo); +void monSetGrantInfo(SMonInfo *pMonitor, SMonGrantInfo *pInfo); void monSetDnodeInfo(SMonInfo *pMonitor, SMonDnodeInfo *pInfo); void monSetDiskInfo(SMonInfo *pMonitor, SMonDiskInfo *pInfo); -void monSetVgroupInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo); -void monSetGrantInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo); void monSendReport(SMonInfo *pMonitor); void monCleanupMonitorInfo(SMonInfo *pMonitor); diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt index 04e5a36e86..1e4ad95504 100644 --- a/source/common/CMakeLists.txt +++ b/source/common/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src COMMON_SRC) -add_library(common ${COMMON_SRC}) +add_library(common STATIC ${COMMON_SRC}) target_include_directories( common PUBLIC "${CMAKE_SOURCE_DIR}/include/common" diff --git a/source/common/src/tname.c b/source/common/src/tname.c index e061862856..fb77417cac 100644 --- a/source/common/src/tname.c +++ b/source/common/src/tname.c @@ -22,6 +22,7 @@ bool tscValidateTableNameLength(size_t len) { return len < TSDB_TABLE_NAME_LEN; } +#if 0 // TODO refactor SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFilters) { if (numOfFilters == 0 || src == NULL) { @@ -46,7 +47,7 @@ SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFil return pFilter; } - +#endif #if 0 int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, int64_t intervalTime, char timeUnit, int16_t precision) { if (slidingTime == 0) { diff --git a/source/dnode/bnode/CMakeLists.txt b/source/dnode/bnode/CMakeLists.txt index a284437450..f51969f6bf 100644 --- a/source/dnode/bnode/CMakeLists.txt +++ b/source/dnode/bnode/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src BNODE_SRC) -add_library(bnode ${BNODE_SRC}) +add_library(bnode STATIC ${BNODE_SRC}) target_include_directories( bnode PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/bnode" diff --git a/source/dnode/mgmt/daemon/CMakeLists.txt b/source/dnode/mgmt/daemon/CMakeLists.txt index e07c15c95a..3238bbf3f0 100644 --- a/source/dnode/mgmt/daemon/CMakeLists.txt +++ b/source/dnode/mgmt/daemon/CMakeLists.txt @@ -6,4 +6,4 @@ target_include_directories( PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) -target_link_libraries(taosd dnode util os) +target_link_libraries(taosd dnode) diff --git a/source/dnode/mgmt/impl/CMakeLists.txt b/source/dnode/mgmt/impl/CMakeLists.txt index ec9e1be02d..c99a405527 100644 --- a/source/dnode/mgmt/impl/CMakeLists.txt +++ b/source/dnode/mgmt/impl/CMakeLists.txt @@ -1,18 +1,7 @@ aux_source_directory(src DNODE_SRC) add_library(dnode STATIC ${DNODE_SRC}) target_link_libraries( - dnode - PUBLIC cjson - PUBLIC mnode - PUBLIC vnode - PUBLIC qnode - PUBLIC snode - PUBLIC bnode - PUBLIC wal - PUBLIC sync - PUBLIC taos - PUBLIC tfs - PUBLIC monitor + dnode cjson mnode vnode qnode snode bnode wal sync taos tfs monitor ) target_include_directories( dnode diff --git a/source/dnode/mgmt/impl/inc/dndInt.h b/source/dnode/mgmt/impl/inc/dndInt.h index 417bc1e041..9fabe40186 100644 --- a/source/dnode/mgmt/impl/inc/dndInt.h +++ b/source/dnode/mgmt/impl/inc/dndInt.h @@ -36,6 +36,7 @@ extern "C" { #include "ttime.h" #include "tworker.h" #include "tglobal.h" +#include "monitor.h" #include "dnode.h" diff --git a/source/dnode/mgmt/impl/inc/dndMnode.h b/source/dnode/mgmt/impl/inc/dndMnode.h index dafbae10ad..0f03bb3832 100644 --- a/source/dnode/mgmt/impl/inc/dndMnode.h +++ b/source/dnode/mgmt/impl/inc/dndMnode.h @@ -32,6 +32,9 @@ int32_t dndProcessCreateMnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg); int32_t dndProcessAlterMnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg); int32_t dndProcessDropMnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg); +int32_t dndGetMnodeMonitorInfo(SDnode *pDnode, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo, + SMonGrantInfo *pGrantInfo); + #ifdef __cplusplus } #endif diff --git a/source/dnode/mgmt/impl/src/dndMgmt.c b/source/dnode/mgmt/impl/src/dndMgmt.c index 171bdc792c..4bf8b82043 100644 --- a/source/dnode/mgmt/impl/src/dndMgmt.c +++ b/source/dnode/mgmt/impl/src/dndMgmt.c @@ -474,6 +474,11 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) { rpcSendResponse(&rpcRsp); } +void dndGetBasicInfo(SDnode *pDnode, SMonBasicInfo *pInfo) { + pInfo->dnode_id = dndGetDnodeId(pDnode); + tstrncpy(pInfo->dnode_ep, tsLocalEp, TSDB_EP_LEN); +} + static void dndSendMonitorReport(SDnode *pDnode) { if (!tsEnableMonitor || tsMonitorFqdn[0] == 0) return; SMonInfo *pMonitor = monCreateMonitorInfo(); @@ -481,10 +486,19 @@ static void dndSendMonitorReport(SDnode *pDnode) { dTrace("pDnode:%p, send monitor report to %s:%u", pDnode, tsMonitorFqdn, tsMonitorPort); - SMonBasicInfo basicInfo = {.dnode_id = dndGetDnodeId(pDnode)}; - tstrncpy(basicInfo.dnode_ep, tsLocalEp, TSDB_EP_LEN); + SMonBasicInfo basicInfo = {0}; + dndGetBasicInfo(pDnode, &basicInfo); monSetBasicInfo(pMonitor, &basicInfo); + SMonClusterInfo clusterInfo = {0}; + SMonVgroupInfo vgroupInfo = {0}; + SMonGrantInfo grantInfo = {0}; + if (dndGetMnodeMonitorInfo(pDnode, &clusterInfo, &vgroupInfo, &grantInfo) == 0) { + monSetClusterInfo(pMonitor, &clusterInfo); + monSetVgroupInfo(pMonitor, &vgroupInfo); + monSetGrantInfo(pMonitor, &grantInfo); + } + monSendReport(pMonitor); monCleanupMonitorInfo(pMonitor); } diff --git a/source/dnode/mgmt/impl/src/dndMnode.c b/source/dnode/mgmt/impl/src/dndMnode.c index e1b16a188f..6cb117867f 100644 --- a/source/dnode/mgmt/impl/src/dndMnode.c +++ b/source/dnode/mgmt/impl/src/dndMnode.c @@ -630,3 +630,13 @@ int32_t dndGetUserAuthFromMnode(SDnode *pDnode, char *user, char *spi, char *enc dTrace("user:%s, retrieve auth spi:%d encrypt:%d", user, *spi, *encrypt); return code; } + +int32_t dndGetMnodeMonitorInfo(SDnode *pDnode, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo, + SMonGrantInfo *pGrantInfo) { + SMnode *pMnode = dndAcquireMnode(pDnode); + if (pMnode == NULL) return -1; + + int32_t code = mndGetMonitorInfo(pMnode, pClusterInfo, pVgroupInfo, pGrantInfo); + dndReleaseMnode(pDnode, pMnode); + return code; +} \ No newline at end of file diff --git a/source/dnode/mgmt/impl/test/sut/CMakeLists.txt b/source/dnode/mgmt/impl/test/sut/CMakeLists.txt index d20c680fad..3a993986fe 100644 --- a/source/dnode/mgmt/impl/test/sut/CMakeLists.txt +++ b/source/dnode/mgmt/impl/test/sut/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src SUT_SRC) -add_library(sut STATIC ${SUT_SRC}) +add_library(sut STATIC STATIC ${SUT_SRC}) target_link_libraries( sut PUBLIC dnode diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 3aad002d40..514bba19f4 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -1,18 +1,12 @@ aux_source_directory(src MNODE_SRC) -add_library(mnode ${MNODE_SRC}) +add_library(mnode STATIC ${MNODE_SRC}) target_include_directories( mnode PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/mnode" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - mnode - PRIVATE scheduler - PRIVATE sdb - PRIVATE wal - PRIVATE transport - PRIVATE cjson - PRIVATE sync + mnode scheduler sdb wal transport cjson sync monitor ) if(${BUILD_TEST}) diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index 54595fb105..929d47184b 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -21,11 +21,11 @@ #include "sdb.h" #include "tcache.h" #include "tep.h" +#include "tglobal.h" #include "tqueue.h" #include "ttime.h" -#include "wal.h" #include "version.h" -#include "tglobal.h" +#include "wal.h" #ifdef __cplusplus extern "C" { @@ -38,6 +38,20 @@ typedef int32_t (*ShowMetaFp)(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaRsp *p typedef int32_t (*ShowRetrieveFp)(SMnodeMsg *pMsg, SShowObj *pShow, char *data, int32_t rows); typedef void (*ShowFreeIterFp)(SMnode *pMnode, void *pIter); +typedef struct SMnodeLoad { + int64_t numOfDnode; + int64_t numOfMnode; + int64_t numOfVgroup; + int64_t numOfDatabase; + int64_t numOfSuperTable; + int64_t numOfChildTable; + int64_t numOfNormalTable; + int64_t numOfColumn; + int64_t totalPoints; + int64_t totalStorage; + int64_t compStorage; +} SMnodeLoad; + typedef struct { const char *name; MndInitFp initFp; @@ -104,7 +118,9 @@ int32_t mndSendReqToMnode(SMnode *pMnode, SRpcMsg *pMsg); void mndSendRedirectRsp(SMnode *pMnode, SRpcMsg *pMsg); void mndSetMsgHandle(SMnode *pMnode, tmsg_t msgType, MndMsgFp fp); -uint64_t mndGenerateUid(char *name, int32_t len) ; +uint64_t mndGenerateUid(char *name, int32_t len); + +int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad); #ifdef __cplusplus } diff --git a/source/dnode/mnode/impl/src/mnode.c b/source/dnode/mnode/impl/src/mnode.c index ab5d0d794b..9478fd7d5a 100644 --- a/source/dnode/mnode/impl/src/mnode.c +++ b/source/dnode/mnode/impl/src/mnode.c @@ -22,6 +22,7 @@ #include "mndDb.h" #include "mndDnode.h" #include "mndFunc.h" +#include "mndInfoSchema.h" #include "mndMnode.h" #include "mndOffset.h" #include "mndProfile.h" @@ -36,7 +37,6 @@ #include "mndTrans.h" #include "mndUser.h" #include "mndVgroup.h" -#include "mndInfoSchema.h" #define MQ_TIMER_MS 3000 #define TRNAS_TIMER_MS 6000 @@ -400,6 +400,11 @@ int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad) { return 0; } +int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo, + SMonGrantInfo *pGrantInfo) { + return 0; + } + SMnodeMsg *mndInitMsg(SMnode *pMnode, SRpcMsg *pRpcMsg) { SMnodeMsg *pMsg = taosAllocateQitem(sizeof(SMnodeMsg)); if (pMsg == NULL) { @@ -505,10 +510,9 @@ void mndSetMsgHandle(SMnode *pMnode, tmsg_t msgType, MndMsgFp fp) { } } - // Note: uid 0 is reserved uint64_t mndGenerateUid(char *name, int32_t len) { - int32_t hashval = MurmurHash3_32(name, len); + int32_t hashval = MurmurHash3_32(name, len); do { int64_t us = taosGetTimestampUs(); diff --git a/source/dnode/mnode/sdb/CMakeLists.txt b/source/dnode/mnode/sdb/CMakeLists.txt index b6620f8be4..168d5063c2 100644 --- a/source/dnode/mnode/sdb/CMakeLists.txt +++ b/source/dnode/mnode/sdb/CMakeLists.txt @@ -1,13 +1,10 @@ aux_source_directory(src MNODE_SRC) -add_library(sdb ${MNODE_SRC}) +add_library(sdb STATIC ${MNODE_SRC}) target_include_directories( sdb PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/mnode/sdb" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" ) target_link_libraries( - sdb - PRIVATE os - PRIVATE common - PRIVATE util + sdb os common util ) \ No newline at end of file diff --git a/source/dnode/qnode/CMakeLists.txt b/source/dnode/qnode/CMakeLists.txt index f6f78f7357..92cd8fcb5c 100644 --- a/source/dnode/qnode/CMakeLists.txt +++ b/source/dnode/qnode/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src QNODE_SRC) -add_library(qnode ${QNODE_SRC}) +add_library(qnode STATIC ${QNODE_SRC}) target_include_directories( qnode PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/qnode" diff --git a/source/dnode/snode/CMakeLists.txt b/source/dnode/snode/CMakeLists.txt index a94dd9edd8..dafd5d6594 100644 --- a/source/dnode/snode/CMakeLists.txt +++ b/source/dnode/snode/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src SNODE_SRC) -add_library(snode ${SNODE_SRC}) +add_library(snode STATIC ${SNODE_SRC}) target_include_directories( snode PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/snode" diff --git a/source/libs/cache/CMakeLists.txt b/source/libs/cache/CMakeLists.txt index 5ba59ef160..c99b5602ad 100644 --- a/source/libs/cache/CMakeLists.txt +++ b/source/libs/cache/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src CACHE_SRC) -add_library(cache ${CACHE_SRC}) +add_library(cache STATIC ${CACHE_SRC}) target_include_directories( cache PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/cache" diff --git a/source/libs/catalog/CMakeLists.txt b/source/libs/catalog/CMakeLists.txt index bb9ed686a7..09cd252a89 100644 --- a/source/libs/catalog/CMakeLists.txt +++ b/source/libs/catalog/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src CATALOG_SRC) -add_library(catalog ${CATALOG_SRC}) +add_library(catalog STATIC ${CATALOG_SRC}) target_include_directories( catalog PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/catalog" diff --git a/source/libs/function/CMakeLists.txt b/source/libs/function/CMakeLists.txt index 9f700dbb3c..a10a542b6b 100644 --- a/source/libs/function/CMakeLists.txt +++ b/source/libs/function/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src FUNCTION_SRC) -add_library(function ${FUNCTION_SRC}) +add_library(function STATIC ${FUNCTION_SRC}) target_include_directories( function PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/function" diff --git a/source/libs/index/CMakeLists.txt b/source/libs/index/CMakeLists.txt index 50e76abd3f..047fc555a0 100644 --- a/source/libs/index/CMakeLists.txt +++ b/source/libs/index/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src INDEX_SRC) -add_library(index ${INDEX_SRC}) +add_library(index STATIC ${INDEX_SRC}) target_include_directories( index PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/index" diff --git a/source/libs/monitor/src/monitor.c b/source/libs/monitor/src/monitor.c index f8a9039f48..811ee40dc8 100644 --- a/source/libs/monitor/src/monitor.c +++ b/source/libs/monitor/src/monitor.c @@ -96,8 +96,22 @@ void monSetBasicInfo(SMonInfo *pMonitor, SMonBasicInfo *pInfo) { tjsonAddStringToObject(pJson, "ts", buf); } -void monSetClusterInfo(SMonInfo *pMonitor, SMonClusterInfo *pInfo); -void monSetDnodeInfo(SMonInfo *pMonitor, SMonDnodeInfo *pInfo); -void monSetDiskInfo(SMonInfo *pMonitor, SMonDiskInfo *pInfo); -void monSetVgroupInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo); -void monSetGrantInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo); +void monSetClusterInfo(SMonInfo *pMonitor, SMonClusterInfo *pInfo) { + +} + +void monSetVgroupInfo(SMonInfo *pMonitor, SMonVgroupInfo *pInfo) { + +} + +void monSetGrantInfo(SMonInfo *pMonitor, SMonGrantInfo *pInfo) { + +} + +void monSetDnodeInfo(SMonInfo *pMonitor, SMonDnodeInfo *pInfo) { + +} + +void monSetDiskInfo(SMonInfo *pMonitor, SMonDiskInfo *pInfo) { + +} diff --git a/source/libs/parser/CMakeLists.txt b/source/libs/parser/CMakeLists.txt index 417c56aba1..5d02868657 100644 --- a/source/libs/parser/CMakeLists.txt +++ b/source/libs/parser/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src PARSER_SRC) -add_library(parser ${PARSER_SRC}) +add_library(parser STATIC ${PARSER_SRC}) target_include_directories( parser PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/parser" diff --git a/source/libs/planner/CMakeLists.txt b/source/libs/planner/CMakeLists.txt index 14b4488e6a..db5d31f22b 100644 --- a/source/libs/planner/CMakeLists.txt +++ b/source/libs/planner/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src PLANNER_SRC) -add_library(planner ${PLANNER_SRC}) +add_library(planner STATIC ${PLANNER_SRC}) target_include_directories( planner PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/planner" diff --git a/source/libs/scheduler/CMakeLists.txt b/source/libs/scheduler/CMakeLists.txt index 1b4aee3ccf..862ae7ccae 100644 --- a/source/libs/scheduler/CMakeLists.txt +++ b/source/libs/scheduler/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src SCHEDULER_SRC) -add_library(scheduler ${SCHEDULER_SRC}) +add_library(scheduler STATIC ${SCHEDULER_SRC}) target_include_directories( scheduler diff --git a/source/libs/sync/CMakeLists.txt b/source/libs/sync/CMakeLists.txt index cb38d7e363..cb196acc02 100644 --- a/source/libs/sync/CMakeLists.txt +++ b/source/libs/sync/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src SYNC_SRC) -add_library(sync ${SYNC_SRC}) +add_library(sync STATIC ${SYNC_SRC}) target_link_libraries( sync diff --git a/source/libs/transport/CMakeLists.txt b/source/libs/transport/CMakeLists.txt index a2e82201bf..465646ac95 100644 --- a/source/libs/transport/CMakeLists.txt +++ b/source/libs/transport/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src TRANSPORT_SRC) -add_library(transport ${TRANSPORT_SRC}) +add_library(transport STATIC ${TRANSPORT_SRC}) target_include_directories( transport PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/transport" diff --git a/source/libs/wal/CMakeLists.txt b/source/libs/wal/CMakeLists.txt index bcf759e04f..4cf7cff818 100644 --- a/source/libs/wal/CMakeLists.txt +++ b/source/libs/wal/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src WAL_SRC) -add_library(wal ${WAL_SRC}) +add_library(wal STATIC ${WAL_SRC}) target_include_directories( wal PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/wal" diff --git a/source/os/CMakeLists.txt b/source/os/CMakeLists.txt index 0eda9d637d..c3bf94e888 100644 --- a/source/os/CMakeLists.txt +++ b/source/os/CMakeLists.txt @@ -1,14 +1,10 @@ aux_source_directory(src OS_SRC) -add_library(os ${OS_SRC}) +add_library(os STATIC ${OS_SRC}) target_include_directories( os PUBLIC "${CMAKE_SOURCE_DIR}/include/os" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" ) target_link_libraries( - os - PUBLIC pthread - PUBLIC dl - PUBLIC rt - PUBLIC m + os pthread dl rt m ) \ No newline at end of file diff --git a/source/util/src/thttp.c b/source/util/src/thttp.c index aa4c795744..adf29b1aa9 100644 --- a/source/util/src/thttp.c +++ b/source/util/src/thttp.c @@ -32,7 +32,7 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, const char* pCont, fd = taosOpenTcpClientSocket(ip, port, 0); if (fd < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to create socket to %s:%u since %s", server, port, terrstr()); + uError("failed to create http socket to %s:%u since %s", server, port, terrstr()); goto SEND_OVER; } From 926934f52207989653ca3080dc49581d4f402676 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 2 Mar 2022 17:50:05 +0800 Subject: [PATCH 7/8] static library --- contrib/test/craft/CMakeLists.txt | 2 +- contrib/test/tdev/CMakeLists.txt | 2 +- contrib/test/traft/single_node/CMakeLists.txt | 2 +- example/CMakeLists.txt | 6 +----- source/libs/qcom/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/contrib/test/craft/CMakeLists.txt b/contrib/test/craft/CMakeLists.txt index e0f6ae64bd..d4d5a6365f 100644 --- a/contrib/test/craft/CMakeLists.txt +++ b/contrib/test/craft/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(simulate_vnode "simulate_vnode.c") -target_link_libraries(simulate_vnode PUBLIC craft lz4 uv_a) \ No newline at end of file +target_link_libraries(simulate_vnode craft lz4 uv_a) \ No newline at end of file diff --git a/contrib/test/tdev/CMakeLists.txt b/contrib/test/tdev/CMakeLists.txt index d173e8d24a..a1657a7a69 100644 --- a/contrib/test/tdev/CMakeLists.txt +++ b/contrib/test/tdev/CMakeLists.txt @@ -1,4 +1,4 @@ aux_source_directory(src TDEV_SRC) add_executable(tdev ${TDEV_SRC}) -target_include_directories(tdev PUBLIC inc) \ No newline at end of file +target_include_directories(tdev inc) \ No newline at end of file diff --git a/contrib/test/traft/single_node/CMakeLists.txt b/contrib/test/traft/single_node/CMakeLists.txt index 666ce271b8..84b65978b9 100644 --- a/contrib/test/traft/single_node/CMakeLists.txt +++ b/contrib/test/traft/single_node/CMakeLists.txt @@ -3,4 +3,4 @@ target_sources(singleNode PRIVATE "singleNode.c" ) -target_link_libraries(singleNode PUBLIC traft lz4 uv_a) +target_link_libraries(singleNode traft lz4 uv_a) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 71a9f9f4c5..51e1e996dc 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -2,11 +2,7 @@ aux_source_directory(src TMQ_DEMO_SRC) add_executable(tmq ${TMQ_DEMO_SRC}) target_link_libraries( - tmq - PUBLIC taos - #PUBLIC util - #PUBLIC common - #PUBLIC os + tmq taos ) target_include_directories( tmq diff --git a/source/libs/qcom/CMakeLists.txt b/source/libs/qcom/CMakeLists.txt index c63e54fb9b..a9bf0f5594 100644 --- a/source/libs/qcom/CMakeLists.txt +++ b/source/libs/qcom/CMakeLists.txt @@ -1,5 +1,5 @@ aux_source_directory(src QUERY_SRC) -add_library(qcom ${QUERY_SRC}) +add_library(qcom STATIC ${QUERY_SRC}) target_include_directories( qcom PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/qcom" From 5dc2cfffded8e4e6d27ea605ca4b01d7de8fbfb8 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 2 Mar 2022 17:53:44 +0800 Subject: [PATCH 8/8] minor changes --- contrib/test/tdev/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/test/tdev/CMakeLists.txt b/contrib/test/tdev/CMakeLists.txt index a1657a7a69..d173e8d24a 100644 --- a/contrib/test/tdev/CMakeLists.txt +++ b/contrib/test/tdev/CMakeLists.txt @@ -1,4 +1,4 @@ aux_source_directory(src TDEV_SRC) add_executable(tdev ${TDEV_SRC}) -target_include_directories(tdev inc) \ No newline at end of file +target_include_directories(tdev PUBLIC inc) \ No newline at end of file