提交 7c7d8b33 编写于 作者: S Shengliang Guan

rename files

上级 f40383e4
aux_source_directory(src DNODE_SRC)
aux_source_directory(dnode/src DNODE_SRC)
aux_source_directory(qnode/src DNODE_SRC)
aux_source_directory(bnode/src DNODE_SRC)
aux_source_directory(snode/src DNODE_SRC)
aux_source_directory(vnode/src DNODE_SRC)
aux_source_directory(mnode/src DNODE_SRC)
add_library(dnode STATIC ${DNODE_SRC})
target_link_libraries(
......@@ -8,8 +13,12 @@ target_link_libraries(
target_include_directories(
dnode
PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/mgmt"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/dnode/inc"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/qnode/inc"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/bnode/inc"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/snode/inc"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/vnode/inc"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/mnode/inc"
)
add_subdirectory(exec)
......
......@@ -16,12 +16,12 @@
#ifndef _TD_DND_MAIN_H_
#define _TD_DND_MAIN_H_
#include "dndInt.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "dndInt.h"
#ifdef __cplusplus
}
#endif
......
......@@ -16,10 +16,11 @@
#ifndef _TD_DND_MGMT_H_
#define _TD_DND_MGMT_H_
#include "dndInt.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "dndInt.h.h"
int32_t dndInitMgmt(SDnode *pDnode);
void dndStopMgmt(SDnode *pDnode);
......
......@@ -22,7 +22,7 @@
extern "C" {
#endif
int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo);
void dndSendMonitorReport(SDnode *pDnode);
#ifdef __cplusplus
}
......
......@@ -16,12 +16,14 @@
#ifndef _TD_DND_TRANSPORT_H_
#define _TD_DND_TRANSPORT_H_
#include "dndInt.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "dndEnv.h"
int32_t dndInitTrans(SDnode *pDnode);
void dndCleanupTransClient(SDnode *pDnode);
void dndCleanupTrans(SDnode *pDnode);
int32_t dndSendReqToMnode(SDnode *pDnode, SRpcMsg *pRpcMsg);
int32_t dndSendReqToDnode(SDnode *pDnode, SEpSet *pEpSet, SRpcMsg *pRpcMsg);
......
......@@ -16,10 +16,11 @@
#ifndef _TD_DND_WORKER_H_
#define _TD_DND_WORKER_H_
#include "dndInt.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "dndEnv.h"
int32_t dndInitWorker(SDnode *pDnode, SDnodeWorker *pWorker, EWorkerType type, const char *name, int32_t minNum,
int32_t maxNum, void *queueFp);
......
......@@ -16,11 +16,11 @@
#define _DEFAULT_SOURCE
#include "dndMain.h"
// #include "dndBnode.h"
// #include "dndMgmt.h"
#include "dndMgmt.h"
// #include "mm.h"
// #include "dndQnode.h"
// #include "dndSnode.h"
// #include "dndTransport.h"
#include "dndTransport.h"
// #include "dndVnodes.h"
// #include "monitor.h"
// #include "sync.h"
......@@ -122,6 +122,7 @@ static int32_t dndInitDnodeResource(SDnode *pDnode) {
static void dndClearDnodeResource(SDnode *pDnode) {
dndCleanupTrans(pDnode);
dndStopMgmt(pDnode);
dndCleanupMgmt(pDnode);
tfsClose(pDnode->pTfs);
dDebug("dnode object resource is cleared, data:%p", pDnode);
}
......@@ -238,7 +239,6 @@ _OVER:
// dndCleanupSnode(pDnode);
// dndCleanupQnode(pDnode);
// dndCleanupVnodes(pDnode);
// dndCleanupMgmt(pDnode);
return pDnode;
......
......@@ -24,6 +24,8 @@
#include "dndWorker.h"
#include "monitor.h"
#include "dndMonitor.h"
static void dndProcessMgmtQueue(SDnode *pDnode, SRpcMsg *pMsg);
static int32_t dndReadDnodes(SDnode *pDnode);
......@@ -472,76 +474,6 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) {
rpcSendResponse(&rpcRsp);
}
static void dndGetMonitorBasicInfo(SDnode *pDnode, SMonBasicInfo *pInfo) {
pInfo->dnode_id = dndGetDnodeId(pDnode);
tstrncpy(pInfo->dnode_ep, tsLocalEp, TSDB_EP_LEN);
pInfo->cluster_id = dndGetClusterId(pDnode);
pInfo->protocol = 1;
}
static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
pInfo->uptime = (taosGetTimestampMs() - pDnode->dmgmt.rebootTime) / (86400000.0f);
taosGetCpuUsage(&pInfo->cpu_engine, &pInfo->cpu_system);
pInfo->cpu_cores = tsNumOfCores;
taosGetProcMemory(&pInfo->mem_engine);
taosGetSysMemory(&pInfo->mem_system);
pInfo->mem_total = tsTotalMemoryKB;
pInfo->disk_engine = 0;
pInfo->disk_used = tsDataSpace.size.used;
pInfo->disk_total = tsDataSpace.size.total;
taosGetCardInfo(&pInfo->net_in, &pInfo->net_out);
taosGetProcIO(&pInfo->io_read, &pInfo->io_write, &pInfo->io_read_disk, &pInfo->io_write_disk);
SVnodesStat *pStat = &pDnode->vmgmt.stat;
pInfo->req_select = pStat->numOfSelectReqs;
pInfo->req_insert = pStat->numOfInsertReqs;
pInfo->req_insert_success = pStat->numOfInsertSuccessReqs;
pInfo->req_insert_batch = pStat->numOfBatchInsertReqs;
pInfo->req_insert_batch_success = pStat->numOfBatchInsertSuccessReqs;
pInfo->errors = tsNumOfErrorLogs;
pInfo->vnodes_num = pStat->totalVnodes;
pInfo->masters = pStat->masterNum;
pInfo->has_mnode = pDnode->mmgmt.deployed;
}
static void dndSendMonitorReport(SDnode *pDnode) {
if (!tsEnableMonitor || tsMonitorFqdn[0] == 0 || tsMonitorPort == 0) return;
dTrace("pDnode:%p, send monitor report to %s:%u", pDnode, tsMonitorFqdn, tsMonitorPort);
SMonInfo *pMonitor = monCreateMonitorInfo();
if (pMonitor == NULL) return;
SMonBasicInfo basicInfo = {0};
dndGetMonitorBasicInfo(pDnode, &basicInfo);
monSetBasicInfo(pMonitor, &basicInfo);
SMonClusterInfo clusterInfo = {0};
SMonVgroupInfo vgroupInfo = {0};
SMonGrantInfo grantInfo = {0};
if (mmGetMonitorInfo(pDnode, &clusterInfo, &vgroupInfo, &grantInfo) == 0) {
monSetClusterInfo(pMonitor, &clusterInfo);
monSetVgroupInfo(pMonitor, &vgroupInfo);
monSetGrantInfo(pMonitor, &grantInfo);
}
SMonDnodeInfo dnodeInfo = {0};
dndGetMonitorDnodeInfo(pDnode, &dnodeInfo);
monSetDnodeInfo(pMonitor, &dnodeInfo);
SMonDiskInfo diskInfo = {0};
if (dndGetMonitorDiskInfo(pDnode, &diskInfo) == 0) {
monSetDiskInfo(pMonitor, &diskInfo);
}
taosArrayDestroy(clusterInfo.dnodes);
taosArrayDestroy(clusterInfo.mnodes);
taosArrayDestroy(vgroupInfo.vgroups);
taosArrayDestroy(diskInfo.datadirs);
monSendReport(pMonitor);
monCleanupMonitorInfo(pMonitor);
}
static void *dnodeThreadRoutine(void *param) {
SDnode *pDnode = param;
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
......
......@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "dndMonitor.h"
int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) {
static int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) {
tstrncpy(pInfo->logdir.name, tsLogDir, sizeof(pInfo->logdir.name));
pInfo->logdir.size = tsLogSpace.size;
tstrncpy(pInfo->tempdir.name, tsTempDir, sizeof(pInfo->tempdir.name));
......@@ -27,3 +27,75 @@ int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) {
}
return 0;
}
static void dndGetMonitorBasicInfo(SDnode *pDnode, SMonBasicInfo *pInfo) {
pInfo->dnode_id = dndGetDnodeId(pDnode);
tstrncpy(pInfo->dnode_ep, tsLocalEp, TSDB_EP_LEN);
pInfo->cluster_id = dndGetClusterId(pDnode);
pInfo->protocol = 1;
}
static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
pInfo->uptime = (taosGetTimestampMs() - pDnode->dmgmt.rebootTime) / (86400000.0f);
taosGetCpuUsage(&pInfo->cpu_engine, &pInfo->cpu_system);
pInfo->cpu_cores = tsNumOfCores;
taosGetProcMemory(&pInfo->mem_engine);
taosGetSysMemory(&pInfo->mem_system);
pInfo->mem_total = tsTotalMemoryKB;
pInfo->disk_engine = 0;
pInfo->disk_used = tsDataSpace.size.used;
pInfo->disk_total = tsDataSpace.size.total;
taosGetCardInfo(&pInfo->net_in, &pInfo->net_out);
taosGetProcIO(&pInfo->io_read, &pInfo->io_write, &pInfo->io_read_disk, &pInfo->io_write_disk);
#if 0
SVnodesStat *pStat = &pDnode->vmgmt.stat;
pInfo->req_select = pStat->numOfSelectReqs;
pInfo->req_insert = pStat->numOfInsertReqs;
pInfo->req_insert_success = pStat->numOfInsertSuccessReqs;
pInfo->req_insert_batch = pStat->numOfBatchInsertReqs;
pInfo->req_insert_batch_success = pStat->numOfBatchInsertSuccessReqs;
pInfo->errors = tsNumOfErrorLogs;
pInfo->vnodes_num = pStat->totalVnodes;
pInfo->masters = pStat->masterNum;
pInfo->has_mnode = pDnode->mmgmt.deployed;
#endif
}
void dndSendMonitorReport(SDnode *pDnode) {
if (!tsEnableMonitor || tsMonitorFqdn[0] == 0 || tsMonitorPort == 0) return;
dTrace("pDnode:%p, send monitor report to %s:%u", pDnode, tsMonitorFqdn, tsMonitorPort);
SMonInfo *pMonitor = monCreateMonitorInfo();
if (pMonitor == NULL) return;
SMonBasicInfo basicInfo = {0};
dndGetMonitorBasicInfo(pDnode, &basicInfo);
monSetBasicInfo(pMonitor, &basicInfo);
SMonClusterInfo clusterInfo = {0};
SMonVgroupInfo vgroupInfo = {0};
SMonGrantInfo grantInfo = {0};
if (mmGetMonitorInfo(pDnode, &clusterInfo, &vgroupInfo, &grantInfo) == 0) {
monSetClusterInfo(pMonitor, &clusterInfo);
monSetVgroupInfo(pMonitor, &vgroupInfo);
monSetGrantInfo(pMonitor, &grantInfo);
}
SMonDnodeInfo dnodeInfo = {0};
dndGetMonitorDnodeInfo(pDnode, &dnodeInfo);
monSetDnodeInfo(pMonitor, &dnodeInfo);
SMonDiskInfo diskInfo = {0};
if (dndGetMonitorDiskInfo(pDnode, &diskInfo) == 0) {
monSetDiskInfo(pMonitor, &diskInfo);
}
taosArrayDestroy(clusterInfo.dnodes);
taosArrayDestroy(clusterInfo.mnodes);
taosArrayDestroy(vgroupInfo.vgroups);
taosArrayDestroy(diskInfo.datadirs);
monSendReport(pMonitor);
monCleanupMonitorInfo(pMonitor);
}
\ No newline at end of file
aux_source_directory(src DNODE_SRC)
aux_source_directory(mnodeMgmt/src DNODE_SRC)
add_library(dnode STATIC ${DNODE_SRC})
target_link_libraries(
dnode cjson mnode vnode qnode snode bnode wal sync taos tfs monitor
)
target_include_directories(
dnode
PUBLIC "${CMAKE_SOURCE_DIR}/include/dnode/mgmt"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/mnodeMgmt/inc"
)
if(${BUILD_TEST})
add_subdirectory(test)
endif(${BUILD_TEST})
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册