Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c8a4d491
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c8a4d491
编写于
3月 14, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
e7ed5e3d
变更
31
显示空白变更内容
内联
并排
Showing
31 changed file
with
373 addition
and
293 deletion
+373
-293
source/dnode/mgmt/bnode/inc/bmInt.h
source/dnode/mgmt/bnode/inc/bmInt.h
+15
-0
source/dnode/mgmt/bnode/src/bmMgmt.c
source/dnode/mgmt/bnode/src/bmMgmt.c
+5
-5
source/dnode/mgmt/container/inc/dndInt.h
source/dnode/mgmt/container/inc/dndInt.h
+63
-129
source/dnode/mgmt/container/inc/dndNode.h
source/dnode/mgmt/container/inc/dndNode.h
+5
-1
source/dnode/mgmt/container/inc/dndWorker.h
source/dnode/mgmt/container/inc/dndWorker.h
+0
-5
source/dnode/mgmt/container/src/dndInt.c
source/dnode/mgmt/container/src/dndInt.c
+0
-27
source/dnode/mgmt/container/src/dndMonitor.c
source/dnode/mgmt/container/src/dndMonitor.c
+11
-23
source/dnode/mgmt/container/src/dndNode.c
source/dnode/mgmt/container/src/dndNode.c
+7
-0
source/dnode/mgmt/container/src/dndTransport.c
source/dnode/mgmt/container/src/dndTransport.c
+12
-12
source/dnode/mgmt/dnode/inc/dmFile.h
source/dnode/mgmt/dnode/inc/dmFile.h
+1
-1
source/dnode/mgmt/dnode/inc/dmHandle.h
source/dnode/mgmt/dnode/inc/dmHandle.h
+3
-4
source/dnode/mgmt/dnode/inc/dmInt.h
source/dnode/mgmt/dnode/inc/dmInt.h
+9
-3
source/dnode/mgmt/dnode/inc/dmMgmt.h
source/dnode/mgmt/dnode/inc/dmMgmt.h
+9
-9
source/dnode/mgmt/dnode/src/dmFile.c
source/dnode/mgmt/dnode/src/dmFile.c
+1
-1
source/dnode/mgmt/dnode/src/dmHandle.c
source/dnode/mgmt/dnode/src/dmHandle.c
+20
-20
source/dnode/mgmt/dnode/src/dmMgmt.c
source/dnode/mgmt/dnode/src/dmMgmt.c
+19
-20
source/dnode/mgmt/dnode/src/dmWorker.c
source/dnode/mgmt/dnode/src/dmWorker.c
+1
-1
source/dnode/mgmt/mnode/inc/mmInt.h
source/dnode/mgmt/mnode/inc/mmInt.h
+21
-0
source/dnode/mgmt/mnode/src/mmHandle.c
source/dnode/mgmt/mnode/src/mmHandle.c
+3
-3
source/dnode/mgmt/mnode/src/mmMgmt.c
source/dnode/mgmt/mnode/src/mmMgmt.c
+7
-7
source/dnode/mgmt/mnode/src/mmWorker.c
source/dnode/mgmt/mnode/src/mmWorker.c
+1
-1
source/dnode/mgmt/qnode/inc/qmInt.h
source/dnode/mgmt/qnode/inc/qmInt.h
+17
-1
source/dnode/mgmt/qnode/src/qmMgmt.c
source/dnode/mgmt/qnode/src/qmMgmt.c
+5
-5
source/dnode/mgmt/snode/inc/smHandle.h
source/dnode/mgmt/snode/inc/smHandle.h
+1
-1
source/dnode/mgmt/snode/inc/smInt.h
source/dnode/mgmt/snode/inc/smInt.h
+17
-1
source/dnode/mgmt/snode/src/smHandle.c
source/dnode/mgmt/snode/src/smHandle.c
+1
-1
source/dnode/mgmt/snode/src/smMgmt.c
source/dnode/mgmt/snode/src/smMgmt.c
+5
-5
source/dnode/mgmt/vnode/inc/vmInt.h
source/dnode/mgmt/vnode/inc/vmInt.h
+28
-1
source/dnode/mgmt/vnode/inc/vmMgmt.h
source/dnode/mgmt/vnode/inc/vmMgmt.h
+32
-0
source/dnode/mgmt/vnode/src/vmInt.c
source/dnode/mgmt/vnode/src/vmInt.c
+29
-4
source/dnode/mgmt/vnode/src/vmMgmt.c
source/dnode/mgmt/vnode/src/vmMgmt.c
+25
-2
未找到文件。
source/dnode/mgmt/bnode/inc/bmInt.h
浏览文件 @
c8a4d491
...
...
@@ -22,6 +22,21 @@
extern
"C"
{
#endif
typedef
struct
SBnodeMgmt
{
int32_t
refCount
;
int8_t
deployed
;
int8_t
dropped
;
SBnode
*
pBnode
;
SRWLatch
latch
;
SDnodeWorker
writeWorker
;
//
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SBnodeMgmt
;
SMgmtFp
bmGetMgmtFp
();
int32_t
dndInitBnode
(
SDnode
*
pDnode
);
...
...
source/dnode/mgmt/bnode/src/bmMgmt.c
浏览文件 @
c8a4d491
...
...
@@ -179,9 +179,9 @@ static void dndBuildBnodeOption(SDnode *pDnode, SBnodeOpt *pOption) {
pOption->pDnode = pDnode;
pOption->sendReqToDnodeFp = dndSendReqToDnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendRedirectRspFp = d
nd
SendRedirectRsp;
pOption->dnodeId = d
nd
GetDnodeId(pDnode);
pOption->clusterId = d
nd
GetClusterId(pDnode);
pOption->sendRedirectRspFp = d
m
SendRedirectRsp;
pOption->dnodeId = d
m
GetDnodeId(pDnode);
pOption->clusterId = d
m
GetClusterId(pDnode);
pOption->sver = tsVersion;
}
...
...
@@ -268,7 +268,7 @@ int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return -1;
}
if (createReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (createReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_BNODE_INVALID_OPTION;
dError("failed to create bnode since %s", terrstr());
return -1;
...
...
@@ -284,7 +284,7 @@ int32_t dndProcessDropBnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return -1;
}
if (dropReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (dropReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_BNODE_INVALID_OPTION;
dError("failed to drop bnode since %s", terrstr());
return -1;
...
...
source/dnode/mgmt/container/inc/dndInt.h
浏览文件 @
c8a4d491
...
...
@@ -16,10 +16,6 @@
#ifndef _TD_DND_INT_H_
#define _TD_DND_INT_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#include "os.h"
#include "cJSON.h"
...
...
@@ -47,6 +43,11 @@ extern "C" {
#include "snode.h"
#include "tfs.h"
#include "vnode.h"
#include "monitor.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
#define dError(...) { if (dDebugFlag & DEBUG_ERROR) { taosPrintLog("DND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }}
...
...
@@ -61,11 +62,15 @@ typedef enum { DND_STAT_INIT, DND_STAT_RUNNING, DND_STAT_STOPPED } EDndStatus;
typedef
enum
{
DND_WORKER_SINGLE
,
DND_WORKER_MULTI
}
EWorkerType
;
typedef
enum
{
DND_ENV_INIT
,
DND_ENV_READY
,
DND_ENV_CLEANUP
}
EEnvStat
;
typedef
struct
SDnodeMgmt
SDnodeMgmt
;
typedef
struct
SMgmtFp
SMgmtFp
;
typedef
struct
SMgmtWrapper
SMgmtWrapper
;
typedef
struct
SMsgHandle
SMsgHandle
;
typedef
struct
SDnodeMgmt
SDnodeMgmt
;
typedef
struct
SVnodesMgmt
SVnodesMgmt
;
typedef
struct
SMnodeMgmt
SMnodeMgmt
;
typedef
struct
SQnodeMgmt
SQnodeMgmt
;
typedef
struct
SSnodeMgmt
SSnodeMgmt
;
typedef
struct
SBnodeMgmt
SBnodeMgmt
;
typedef
void
(
*
RpcMsgFp
)(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEps
);
typedef
void
(
*
NodeMsgFp
)(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
...
...
@@ -80,6 +85,24 @@ typedef struct SMsgHandle {
SMgmtWrapper
*
pWrapper
;
}
SMsgHandle
;
typedef
struct
SMgmtFp
{
OpenNodeFp
openFp
;
CloseNodeFp
closeFp
;
RequireNodeFp
requiredFp
;
GetMsgHandleFp
getMsgHandleFp
;
}
SMgmtFp
;
typedef
struct
SMgmtWrapper
{
const
char
*
name
;
char
*
path
;
bool
required
;
EProcType
procType
;
SProcObj
*
pProc
;
void
*
pMgmt
;
SDnode
*
pDnode
;
SMgmtFp
fp
;
}
SMgmtWrapper
;
typedef
struct
{
EWorkerType
type
;
const
char
*
name
;
...
...
@@ -94,144 +117,55 @@ typedef struct {
};
}
SDnodeWorker
;
typedef
struct
{
int32_t
refCount
;
int8_t
deployed
;
int8_t
dropped
;
SMnode
*
pMnode
;
SRWLatch
latch
;
SDnodeWorker
readWorker
;
SDnodeWorker
writeWorker
;
SDnodeWorker
syncWorker
;
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
//
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SMnodeMgmt
;
typedef
struct
{
int32_t
refCount
;
int8_t
deployed
;
int8_t
dropped
;
SQnode
*
pQnode
;
SRWLatch
latch
;
SDnodeWorker
queryWorker
;
SDnodeWorker
fetchWorker
;
//
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SQnodeMgmt
;
typedef
struct
{
int32_t
refCount
;
int8_t
deployed
;
int8_t
dropped
;
SSnode
*
pSnode
;
SRWLatch
latch
;
SDnodeWorker
writeWorker
;
//
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SSnodeMgmt
;
typedef
struct
{
int32_t
openVnodes
;
int32_t
totalVnodes
;
int32_t
masterNum
;
int64_t
numOfSelectReqs
;
int64_t
numOfInsertReqs
;
int64_t
numOfInsertSuccessReqs
;
int64_t
numOfBatchInsertReqs
;
int64_t
numOfBatchInsertSuccessReqs
;
}
SVnodesStat
;
typedef
struct
{
int32_t
refCount
;
int8_t
deployed
;
int8_t
dropped
;
SBnode
*
pBnode
;
SRWLatch
latch
;
SDnodeWorker
writeWorker
;
//
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SBnodeMgmt
;
typedef
struct
{
SVnodesStat
stat
;
SHashObj
*
hash
;
SRWLatch
latch
;
SQWorkerPool
queryPool
;
SFWorkerPool
fetchPool
;
SWWorkerPool
syncPool
;
SWWorkerPool
writePool
;
//
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SVnodesMgmt
;
typedef
struct
{
void
*
serverRpc
;
void
*
clientRpc
;
SMsgHandle
msgHandles
[
TDMT_MAX
];
}
STransMgmt
;
typedef
struct
SMgmtFp
{
OpenNodeFp
openFp
;
CloseNodeFp
closeFp
;
RequireNodeFp
requiredFp
;
GetMsgHandleFp
getMsgHandleFp
;
}
SMgmtFp
;
typedef
struct
SMgmtWrapper
{
const
char
*
name
;
char
*
path
;
bool
required
;
EProcType
procType
;
SProcObj
*
pProc
;
void
*
pMgmt
;
SDnode
*
pDnode
;
SMgmtFp
fp
;
}
SMgmtWrapper
;
typedef
struct
SDnode
{
int64_t
rebootTime
;
EDndStatus
status
;
EDndEvent
event
;
EProcType
procType
;
SDndCfg
cfg
;
SStartupReq
startup
;
TdFilePtr
pLockFile
;
STransMgmt
tmgmt
;
STfs
*
pTfs
;
STransMgmt
trans
;
SMgmtFp
fps
[
NODE_MAX
];
SMgmtWrapper
wrappers
[
NODE_MAX
];
}
SDnode
;
// dndInt.h
int32_t
dndInit
();
void
dndCleanup
();
EDndStatus
dndGetStatus
(
SDnode
*
pDnode
);
void
dndSetStatus
(
SDnode
*
pDnode
,
EDndStatus
stat
);
const
char
*
dndStatStr
(
EDndStatus
stat
);
void
dndReportStartup
(
SDnode
*
pDnode
,
char
*
pName
,
char
*
pDesc
);
void
dndGetStartup
(
SDnode
*
pDnode
,
SStartupReq
*
pStartup
);
TdFilePtr
dndCheckRunning
(
char
*
dataDir
);
SMgmtWrapper
*
dndGetWrapper
(
SDnode
*
pDnode
,
ENodeType
nodeType
);
SMgmtWrapper
*
dndGetWrapper
(
SDnode
*
pDnode
,
ENodeType
nodeType
)
;
// dndMonitor.h
void
dndSendMonitorReport
(
SDnode
*
pDnode
);
// dndNode.h
SDnode
*
dndCreate
(
SDndCfg
*
pCfg
);
void
dndClose
(
SDnode
*
pDnode
);
int32_t
dndRun
(
SDnode
*
pDnode
);
void
dndeHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
void
dndProcessRpcMsg
(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
SMgmtFp
dmGetMgmtFp
();
// dndTransport.h
int32_t
dndSendReqToMnode
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
int32_t
dndSendReqToDnode
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pRpcMsg
);
// dndWorker.h
int32_t
dndInitWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
EWorkerType
type
,
const
char
*
name
,
int32_t
minNum
,
int32_t
maxNum
,
void
*
queueFp
);
void
dndCleanupWorker
(
SDnodeWorker
*
pWorker
);
int32_t
dndWriteMsgToWorker
(
SDnodeWorker
*
pWorker
,
void
*
pCont
,
int32_t
contLen
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/container/inc/dndNode.h
浏览文件 @
c8a4d491
...
...
@@ -22,6 +22,10 @@
extern
"C"
{
#endif
SDnode
*
dndCreate
(
SDndCfg
*
pCfg
);
void
dndClose
(
SDnode
*
pDnode
);
int32_t
dndRun
(
SDnode
*
pDnode
);
void
dndeHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
void
dndProcessRpcMsg
(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
#ifdef __cplusplus
...
...
source/dnode/mgmt/container/inc/dndWorker.h
浏览文件 @
c8a4d491
...
...
@@ -27,11 +27,6 @@ int32_t dndInitWorker(SDnode *pDnode, SDnodeWorker *pWorker, EWorkerType type, c
void
dndCleanupWorker
(
SDnodeWorker
*
pWorker
);
int32_t
dndWriteMsgToWorker
(
SDnodeWorker
*
pWorker
,
void
*
pCont
,
int32_t
contLen
);
void
dndProcessMsg
(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mgmt/container/src/dndInt.c
浏览文件 @
c8a4d491
...
...
@@ -15,9 +15,6 @@
#define _DEFAULT_SOURCE
#include "dndInt.h"
#include "dmHandle.h"
#include "dndTransport.h"
#include "vmInt.h"
static
int8_t
once
=
DND_ENV_INIT
;
...
...
@@ -38,22 +35,6 @@ int32_t dndInit() {
return
-
1
;
}
if
(
walInit
()
!=
0
)
{
dError
(
"failed to init wal since %s"
,
terrstr
());
dndCleanup
();
return
-
1
;
}
SVnodeOpt
vnodeOpt
=
{
0
};
vnodeOpt
.
nthreads
=
tsNumOfCommitThreads
;
vnodeOpt
.
putReqToVQueryQFp
=
dndPutReqToVQueryQ
;
vnodeOpt
.
sendReqToDnodeFp
=
dndSendReqToDnode
;
if
(
vnodeInit
(
&
vnodeOpt
)
!=
0
)
{
dError
(
"failed to init vnode since %s"
,
terrstr
());
dndCleanup
();
return
-
1
;
}
SMonCfg
monCfg
=
{
0
};
monCfg
.
maxLogs
=
tsMonitorMaxLogs
;
monCfg
.
port
=
tsMonitorPort
;
...
...
@@ -76,10 +57,7 @@ void dndCleanup() {
}
monCleanup
();
vnodeCleanup
();
walCleanUp
();
rpcCleanup
();
taosStopCacheRefreshWorker
();
dInfo
(
"dnode env is cleaned up"
);
}
...
...
@@ -141,8 +119,3 @@ TdFilePtr dndCheckRunning(char *dataDir) {
return
pFile
;
}
void
dndeHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
)
{
dInfo
(
"dnode object receive event %d, data:%p"
,
event
,
pDnode
);
pDnode
->
event
=
event
;
}
source/dnode/mgmt/container/src/dndMonitor.c
浏览文件 @
c8a4d491
...
...
@@ -15,7 +15,9 @@
#define _DEFAULT_SOURCE
#include "dndMonitor.h"
#include "dmMgmt.h"
#include "dmInt.h"
#include "mmInt.h"
#include "vmInt.h"
static
int32_t
dndGetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
)
{
tstrncpy
(
pInfo
->
logdir
.
name
,
tsLogDir
,
sizeof
(
pInfo
->
logdir
.
name
));
...
...
@@ -23,23 +25,18 @@ static int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) {
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
pInfo
->
tempdir
.
size
=
tsTempSpace
.
size
;
if
(
pDnode
->
pTfs
!=
NULL
)
{
return
tfsGetMonitorInfo
(
NULL
,
pInfo
);
}
return
0
;
return
vmGetTfsMonitorInfo
(
dndGetWrapper
(
pDnode
,
VNODES
),
pInfo
);
}
static
void
dndGetMonitorBasicInfo
(
SDnode
*
pDnode
,
SMonBasicInfo
*
pInfo
)
{
pInfo
->
dnode_id
=
d
nd
GetDnodeId
(
pDnode
);
pInfo
->
dnode_id
=
d
m
GetDnodeId
(
pDnode
);
tstrncpy
(
pInfo
->
dnode_ep
,
tsLocalEp
,
TSDB_EP_LEN
);
pInfo
->
cluster_id
=
d
nd
GetClusterId
(
pDnode
);
pInfo
->
cluster_id
=
d
m
GetClusterId
(
pDnode
);
pInfo
->
protocol
=
1
;
}
static
void
dndGetMonitorDnodeInfo
(
SDnode
*
pDnode
,
SMonDnodeInfo
*
pInfo
)
{
#if 0
pInfo->uptime = (taosGetTimestampMs() - pDnode->dmgmt.rebootTime) / (86400000.0f);
pInfo
->
uptime
=
(
taosGetTimestampMs
()
-
pDnode
->
rebootTime
)
/
(
86400000
.
0
f
);
taosGetCpuUsage
(
&
pInfo
->
cpu_engine
,
&
pInfo
->
cpu_system
);
pInfo
->
cpu_cores
=
tsNumOfCores
;
taosGetProcMemory
(
&
pInfo
->
mem_engine
);
...
...
@@ -51,17 +48,8 @@ static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
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;
#endif
vmGetVndMonitorInfo
(
dndGetWrapper
(
pDnode
,
VNODES
),
pInfo
);
pInfo
->
has_mnode
=
(
dndGetWrapper
(
pDnode
,
MNODE
)
->
required
);
}
void
dndSendMonitorReport
(
SDnode
*
pDnode
)
{
...
...
@@ -74,7 +62,7 @@ void dndSendMonitorReport(SDnode *pDnode) {
SMonBasicInfo
basicInfo
=
{
0
};
dndGetMonitorBasicInfo
(
pDnode
,
&
basicInfo
);
monSetBasicInfo
(
pMonitor
,
&
basicInfo
);
#if 0
SMonClusterInfo
clusterInfo
=
{
0
};
SMonVgroupInfo
vgroupInfo
=
{
0
};
SMonGrantInfo
grantInfo
=
{
0
};
...
...
@@ -97,7 +85,7 @@ void dndSendMonitorReport(SDnode *pDnode) {
taosArrayDestroy
(
clusterInfo
.
mnodes
);
taosArrayDestroy
(
vgroupInfo
.
vgroups
);
taosArrayDestroy
(
diskInfo
.
datadirs
);
#endif
monSendReport
(
pMonitor
);
monCleanupMonitorInfo
(
pMonitor
);
}
\ No newline at end of file
source/dnode/mgmt/container/src/dndNode.c
浏览文件 @
c8a4d491
...
...
@@ -74,6 +74,7 @@ SDnode *dndCreate(SDndCfg *pCfg) {
}
dndSetStatus
(
pDnode
,
DND_STAT_INIT
);
pDnode
->
rebootTime
=
taosGetTimestampMs
();
pDnode
->
pLockFile
=
dndCheckRunning
(
pCfg
->
dataDir
);
if
(
pDnode
->
pLockFile
==
NULL
)
{
goto
_OVER
;
...
...
@@ -257,4 +258,10 @@ int32_t dndRun(SDnode *pDnode) {
return
0
;
}
void
dndeHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
)
{
dInfo
(
"dnode object receive event %d, data:%p"
,
event
,
pDnode
);
pDnode
->
event
=
event
;
}
void
dndProcessRpcMsg
(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{}
\ No newline at end of file
source/dnode/mgmt/container/src/dndTransport.c
浏览文件 @
c8a4d491
...
...
@@ -24,7 +24,7 @@
static
void
dndProcessResponse
(
void
*
parent
,
SRpcMsg
*
pRsp
,
SEpSet
*
pEpSet
)
{
SDnode
*
pDnode
=
parent
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
mgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
rans
;
tmsg_t
msgType
=
pRsp
->
msgType
;
...
...
@@ -47,7 +47,7 @@ static void dndProcessResponse(void *parent, SRpcMsg *pRsp, SEpSet *pEpSet) {
}
int32_t
dndInitClient
(
SDnode
*
pDnode
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
t
mgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
rans
;
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
...
...
@@ -77,7 +77,7 @@ int32_t dndInitClient(SDnode *pDnode) {
}
void
dndCleanupClient
(
SDnode
*
pDnode
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
t
mgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
rans
;
if
(
pMgmt
->
clientRpc
)
{
rpcClose
(
pMgmt
->
clientRpc
);
pMgmt
->
clientRpc
=
NULL
;
...
...
@@ -87,12 +87,12 @@ void dndCleanupClient(SDnode *pDnode) {
static
void
dndProcessRequest
(
void
*
param
,
SRpcMsg
*
pReq
,
SEpSet
*
pEpSet
)
{
SDnode
*
pDnode
=
param
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
mgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
rans
;
tmsg_t
msgType
=
pReq
->
msgType
;
if
(
msgType
==
TDMT_DND_NETWORK_TEST
)
{
dTrace
(
"RPC %p, network test req will be processed, app:%p"
,
pReq
->
handle
,
pReq
->
ahandle
);
d
nd
ProcessStartupReq
(
pDnode
,
pReq
);
d
m
ProcessStartupReq
(
pDnode
,
pReq
);
return
;
}
...
...
@@ -131,10 +131,10 @@ static void dndProcessRequest(void *param, SRpcMsg *pReq, SEpSet *pEpSet) {
}
static
void
dndSendMsgToMnodeRecv
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
,
SRpcMsg
*
pRpcRsp
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
t
mgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
rans
;
SEpSet
epSet
=
{
0
};
d
nd
GetMnodeEpSet
(
pDnode
,
&
epSet
);
d
m
GetMnodeEpSet
(
pDnode
,
&
epSet
);
rpcSendRecv
(
pMgmt
->
clientRpc
,
&
epSet
,
pRpcMsg
,
pRpcRsp
);
}
...
...
@@ -208,7 +208,7 @@ static int32_t dndRetrieveUserAuthInfo(void *parent, char *user, char *spi, char
}
int32_t
dndInitServer
(
SDnode
*
pDnode
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
t
mgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
rans
;
int32_t
numOfThreads
=
(
int32_t
)((
tsNumOfCores
*
tsNumOfThreadsPerCore
)
/
2
.
0
);
if
(
numOfThreads
<
1
)
{
...
...
@@ -238,7 +238,7 @@ int32_t dndInitServer(SDnode *pDnode) {
}
void
dndCleanupServer
(
SDnode
*
pDnode
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
t
mgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
rans
;
if
(
pMgmt
->
serverRpc
)
{
rpcClose
(
pMgmt
->
serverRpc
);
pMgmt
->
serverRpc
=
NULL
;
...
...
@@ -247,7 +247,7 @@ void dndCleanupServer(SDnode *pDnode) {
}
int32_t
dndSetMsgHandle
(
SDnode
*
pDnode
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
t
mgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
rans
;
for
(
ENodeType
nodeType
=
0
;
nodeType
<
NODE_MAX
;
++
nodeType
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
nodeType
];
...
...
@@ -274,7 +274,7 @@ int32_t dndSetMsgHandle(SDnode *pDnode) {
}
int32_t
dndSendReqToDnode
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
t
mgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
t
rans
;
if
(
pMgmt
->
clientRpc
==
NULL
)
{
terrno
=
TSDB_CODE_DND_OFFLINE
;
return
-
1
;
...
...
@@ -286,6 +286,6 @@ int32_t dndSendReqToDnode(SDnode *pDnode, SEpSet *pEpSet, SRpcMsg *pReq) {
int32_t
dndSendReqToMnode
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SEpSet
epSet
=
{
0
};
d
nd
GetMnodeEpSet
(
pDnode
,
&
epSet
);
d
m
GetMnodeEpSet
(
pDnode
,
&
epSet
);
return
dndSendReqToDnode
(
pDnode
,
&
epSet
,
pReq
);
}
source/dnode/mgmt/dnode/inc/dmFile.h
浏览文件 @
c8a4d491
...
...
@@ -24,7 +24,7 @@ extern "C" {
int32_t
dmReadFile
(
SDnodeMgmt
*
pMgmt
);
int32_t
dmWriteFile
(
SDnodeMgmt
*
pMgmt
);
void
d
nd
UpdateDnodeEps
(
SDnodeMgmt
*
pMgmt
,
SArray
*
pDnodeEps
);
void
d
m
UpdateDnodeEps
(
SDnodeMgmt
*
pMgmt
,
SArray
*
pDnodeEps
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/dnode/inc/dmHandle.h
浏览文件 @
c8a4d491
...
...
@@ -22,12 +22,11 @@
extern
"C"
{
#endif
void
d
nd
InitMsgHandles
(
SMgmtWrapper
*
pWrapper
);
void
d
m
InitMsgHandles
(
SMgmtWrapper
*
pWrapper
);
SMsgHandle
dmGetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
int32_t
msgIndex
);
void
dndSendStatusReq
(
SDnode
*
pDnode
);
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dmSendStatusReq
(
SDnode
*
pDnode
);
void
dmProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/dnode/inc/dmInt.h
浏览文件 @
c8a4d491
...
...
@@ -27,7 +27,6 @@ typedef struct SDnodeMgmt {
int32_t
dropped
;
int64_t
clusterId
;
int64_t
dver
;
int64_t
rebootTime
;
int64_t
updateTime
;
int8_t
statusSent
;
SEpSet
mnodeEpSet
;
...
...
@@ -42,9 +41,16 @@ typedef struct SDnodeMgmt {
SDnode
*
pDnode
;
}
SDnodeMgmt
;
// dmFile.h
void
dmGetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
);
// dmHandle.h
void
dmProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
// dmInt.h
SMgmtFp
dmGetMgmtFp
();
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dndGetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
);
int32_t
dmGetDnodeId
(
SDnode
*
pDnode
);
int64_t
dmGetClusterId
(
SDnode
*
pDnode
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/dnode/inc/dmMgmt.h
浏览文件 @
c8a4d491
...
...
@@ -22,18 +22,18 @@
extern
"C"
{
#endif
int32_t
d
nd
InitMgmt
(
SDnode
*
pDnode
);
void
d
nd
StopMgmt
(
SDnode
*
pDnode
);
void
d
nd
CleanupMgmt
(
SDnode
*
pDnode
);
int32_t
d
m
InitMgmt
(
SDnode
*
pDnode
);
void
d
m
StopMgmt
(
SDnode
*
pDnode
);
void
d
m
CleanupMgmt
(
SDnode
*
pDnode
);
int32_t
d
nd
GetDnodeId
(
SDnode
*
pDnode
);
int64_t
d
nd
GetClusterId
(
SDnode
*
pDnode
);
void
d
nd
GetDnodeEp
(
SDnode
*
pDnode
,
int32_t
dnodeId
,
char
*
pEp
,
char
*
pFqdn
,
uint16_t
*
pPort
);
void
d
nd
GetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
);
int32_t
d
m
GetDnodeId
(
SDnode
*
pDnode
);
int64_t
d
m
GetClusterId
(
SDnode
*
pDnode
);
void
d
m
GetDnodeEp
(
SDnode
*
pDnode
,
int32_t
dnodeId
,
char
*
pEp
,
char
*
pFqdn
,
uint16_t
*
pPort
);
void
d
m
GetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
);
void
dndSendRedirectRsp
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dmSendRedirectRsp
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dmProcessMgmtMsg
(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
;
void
dndProcessMgmtMsg
(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
;
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mgmt/dnode/src/dmFile.c
浏览文件 @
c8a4d491
...
...
@@ -210,7 +210,7 @@ int32_t dmWriteFile(SDnodeMgmt *pMgmt) {
return
0
;
}
void
d
nd
UpdateDnodeEps
(
SDnodeMgmt
*
pMgmt
,
SArray
*
pDnodeEps
)
{
void
d
m
UpdateDnodeEps
(
SDnodeMgmt
*
pMgmt
,
SArray
*
pDnodeEps
)
{
int32_t
numOfEps
=
taosArrayGetSize
(
pDnodeEps
);
if
(
numOfEps
<=
0
)
return
;
...
...
source/dnode/mgmt/dnode/src/dmHandle.c
浏览文件 @
c8a4d491
...
...
@@ -27,29 +27,29 @@ static void dndSetMsgHandle(SMgmtWrapper *pWrapper, int32_t msgType, NodeMsgFp n
pHandle
->
rpcMsgFp
=
dndProcessRpcMsg
;
}
void
d
nd
InitMsgHandles
(
SMgmtWrapper
*
pWrapper
)
{
void
d
m
InitMsgHandles
(
SMgmtWrapper
*
pWrapper
)
{
// Requests handled by DNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_MNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_ALTER_MNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_MNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_QNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_QNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_SNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_SNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_BNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_BNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_VNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_ALTER_VNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_VNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_SYNC_VNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_COMPACT_VNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CONFIG_DNODE
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_NETWORK_TEST
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_MNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_ALTER_MNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_MNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_QNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_QNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_SNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_SNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_BNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_BNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_VNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_ALTER_VNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_VNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_SYNC_VNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_COMPACT_VNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CONFIG_DNODE
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_NETWORK_TEST
,
d
m
ProcessMgmtMsg
);
// Requests handled by MNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_STATUS_RSP
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_GRANT_RSP
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_AUTH_RSP
,
d
nd
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_STATUS_RSP
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_GRANT_RSP
,
d
m
ProcessMgmtMsg
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_AUTH_RSP
,
d
m
ProcessMgmtMsg
);
}
SMsgHandle
dmGetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
int32_t
msgIndex
)
{
...
...
source/dnode/mgmt/dnode/src/dmMgmt.c
浏览文件 @
c8a4d491
...
...
@@ -38,7 +38,7 @@ static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp);
static void dndProcessAuthRsp(SDnode *pDnode, SRpcMsg *pRsp);
static void dndProcessGrantRsp(SDnode *pDnode, SRpcMsg *pRsp);
int32_t d
nd
GetDnodeId(SDnode *pDnode) {
int32_t d
m
GetDnodeId(SDnode *pDnode) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
taosRLockLatch(&pMgmt->latch);
int32_t dnodeId = pMgmt->dnodeId;
...
...
@@ -46,7 +46,7 @@ int32_t dndGetDnodeId(SDnode *pDnode) {
return dnodeId;
}
int64_t d
nd
GetClusterId(SDnode *pDnode) {
int64_t d
m
GetClusterId(SDnode *pDnode) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
taosRLockLatch(&pMgmt->latch);
int64_t clusterId = pMgmt->clusterId;
...
...
@@ -54,7 +54,7 @@ int64_t dndGetClusterId(SDnode *pDnode) {
return clusterId;
}
void d
nd
GetDnodeEp(SDnode *pDnode, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort) {
void d
m
GetDnodeEp(SDnode *pDnode, int32_t dnodeId, char *pEp, char *pFqdn, uint16_t *pPort) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
taosRLockLatch(&pMgmt->latch);
...
...
@@ -74,18 +74,18 @@ void dndGetDnodeEp(SDnode *pDnode, int32_t dnodeId, char *pEp, char *pFqdn, uint
taosRUnLockLatch(&pMgmt->latch);
}
void d
nd
GetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {
void d
m
GetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
taosRLockLatch(&pMgmt->latch);
*pEpSet = pMgmt->mnodeEpSet;
taosRUnLockLatch(&pMgmt->latch);
}
void d
nd
SendRedirectRsp(SDnode *pDnode, SRpcMsg *pReq) {
void d
m
SendRedirectRsp(SDnode *pDnode, SRpcMsg *pReq) {
tmsg_t msgType = pReq->msgType;
SEpSet epSet = {0};
d
nd
GetMnodeEpSet(pDnode, &epSet);
d
m
GetMnodeEpSet(pDnode, &epSet);
dDebug("RPC %p, req:%s is redirected, num:%d use:%d", pReq->handle, TMSG_INFO(msgType), epSet.numOfEps, epSet.inUse);
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
...
...
@@ -115,7 +115,7 @@ static void dndUpdateMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {
}
void d
nd
SendStatusReq(SDnode *pDnode) {
void d
m
SendStatusReq(SDnode *pDnode) {
SStatusReq req = {0};
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
...
...
@@ -183,7 +183,7 @@ static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp) {
tDeserializeSStatusRsp(pRsp->pCont, pRsp->contLen, &statusRsp) == 0) {
pMgmt->dver = statusRsp.dver;
dndUpdateDnodeCfg(pDnode, &statusRsp.dnodeCfg);
d
nd
UpdateDnodeEps(pDnode, statusRsp.pDnodeEps);
d
m
UpdateDnodeEps(pDnode, statusRsp.pDnodeEps);
}
taosArrayDestroy(statusRsp.pDnodeEps);
}
...
...
@@ -203,7 +203,7 @@ static int32_t dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return TSDB_CODE_OPS_NOT_SUPPORT;
}
void d
nd
ProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) {
void d
m
ProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) {
dDebug("startup req is received");
SStartupReq *pStartup = rpcMallocCont(sizeof(SStartupReq));
...
...
@@ -215,7 +215,7 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) {
rpcSendResponse(&rpcRsp);
}
void d
nd
StopMgmt(SDnode *pDnode) {
void d
m
StopMgmt(SDnode *pDnode) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
dndCleanupWorker(&pMgmt->mgmtWorker);
dndCleanupWorker(&pMgmt->statusWorker);
...
...
@@ -226,7 +226,7 @@ void dndStopMgmt(SDnode *pDnode) {
}
}
void d
nd
CleanupMgmt(SDnode *pDnode) {
void d
m
CleanupMgmt(SDnode *pDnode) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
taosWLockLatch(&pMgmt->latch);
...
...
@@ -249,7 +249,7 @@ void dndCleanupMgmt(SDnode *pDnode) {
dInfo("dnode-mgmt is cleaned up");
}
void d
nd
ProcessMgmtMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
void d
m
ProcessMgmtMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
if (pEpSet && pEpSet->numOfEps > 0 && pMsg->msgType == TDMT_MND_STATUS_RSP) {
...
...
@@ -275,25 +275,24 @@ void dndProcessMgmtMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
void
d
nd
StopMgmt
(
SDnode
*
pDnode
)
{}
void
d
m
StopMgmt
(
SDnode
*
pDnode
)
{}
void
d
nd
CleanupMgmt
(
SDnode
*
pDnode
){}
void
d
m
CleanupMgmt
(
SDnode
*
pDnode
){}
void
d
nd
SendStatusReq
(
SDnode
*
pDnode
){}
void
d
m
SendStatusReq
(
SDnode
*
pDnode
){}
void
d
nd
GetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
)
{}
void
d
m
GetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
)
{}
void
d
nd
ProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
){}
void
d
nd
ProcessMgmtMsg
(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){}
void
d
m
ProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
){}
void
d
m
ProcessMgmtMsg
(
SDnode
*
pDnode
,
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){}
static
int32_t
dmInit
(
SMgmtWrapper
*
pWrapper
)
{
SDnodeMgmt
*
pMgmt
=
calloc
(
1
,
sizeof
(
SDnodeMgmt
));
pMgmt
->
dnodeId
=
0
;
pMgmt
->
rebootTime
=
taosGetTimestampMs
();
pMgmt
->
dropped
=
0
;
pMgmt
->
clusterId
=
0
;
pMgmt
->
path
=
pWrapper
->
path
;
...
...
@@ -325,7 +324,7 @@ static int32_t dmInit(SMgmtWrapper *pWrapper) {
return
0
;
// dndSetStatus(pDnode, DND_STAT_RUNNING);
// d
nd
SendStatusReq(pDnode);
// d
m
SendStatusReq(pDnode);
// dndReportStartup(pDnode, "TDengine", "initialized successfully");
#if 0
...
...
source/dnode/mgmt/dnode/src/dmWorker.c
浏览文件 @
c8a4d491
...
...
@@ -37,7 +37,7 @@ static void *dnodeThreadRoutine(void *param) {
float
statusInterval
=
(
curTime
-
lastStatusTime
)
/
1000
.
0
f
;
if
(
statusInterval
>=
tsStatusInterval
&&
!
pMgmt
->
statusSent
)
{
d
nd
SendStatusReq
(
pDnode
);
d
m
SendStatusReq
(
pDnode
);
lastStatusTime
=
curTime
;
}
...
...
source/dnode/mgmt/mnode/inc/mmInt.h
浏览文件 @
c8a4d491
...
...
@@ -23,6 +23,27 @@ extern "C" {
#endif
typedef
struct
SMnodeMgmt
{
int32_t
refCount
;
int8_t
deployed
;
int8_t
dropped
;
SMnode
*
pMnode
;
SRWLatch
latch
;
SDnodeWorker
readWorker
;
SDnodeWorker
writeWorker
;
SDnodeWorker
syncWorker
;
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
//
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SMnodeMgmt
;
// interface
SMgmtFp
mmGetMgmtFp
();
...
...
source/dnode/mgmt/mnode/src/mmHandle.c
浏览文件 @
c8a4d491
...
...
@@ -27,7 +27,7 @@ int32_t mmProcessCreateMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return -1;
}
if (createReq.replica <= 1 || createReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (createReq.replica <= 1 || createReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_MNODE_INVALID_OPTION;
dError("failed to create mnode since %s", terrstr());
return -1;
...
...
@@ -59,7 +59,7 @@ int32_t mmProcessAlterMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return -1;
}
if (alterReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (alterReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_MNODE_INVALID_OPTION;
dError("failed to alter mnode since %s", terrstr());
return -1;
...
...
@@ -93,7 +93,7 @@ int32_t mmProcessDropMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return -1;
}
if (dropReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (dropReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_MNODE_INVALID_OPTION;
dError("failed to drop mnode since %s", terrstr());
return -1;
...
...
source/dnode/mgmt/mnode/src/mmMgmt.c
浏览文件 @
c8a4d491
...
...
@@ -204,11 +204,11 @@ int32_t mmDrop(SDnode *pDnode) {
}
static bool mmDeployRequired(SDnode *pDnode) {
if (d
nd
GetDnodeId(pDnode) > 0) {
if (d
m
GetDnodeId(pDnode) > 0) {
return false;
}
if (d
nd
GetClusterId(pDnode) > 0) {
if (d
m
GetClusterId(pDnode) > 0) {
return false;
}
...
...
@@ -223,11 +223,11 @@ static void mmInitOption(SDnode *pDnode, SMnodeOpt *pOption) {
pOption->pDnode = pDnode;
pOption->sendReqToDnodeFp = dndSendReqToDnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendRedirectRspFp = d
nd
SendRedirectRsp;
pOption->sendRedirectRspFp = d
m
SendRedirectRsp;
pOption->putReqToMWriteQFp = mmPutMsgToWriteQueue;
pOption->putReqToMReadQFp = mmPutMsgToReadQueue;
pOption->dnodeId = d
nd
GetDnodeId(pDnode);
pOption->clusterId = d
nd
GetClusterId(pDnode);
pOption->dnodeId = d
m
GetDnodeId(pDnode);
pOption->clusterId = d
m
GetClusterId(pDnode);
}
static void mmBuildOptionForDeploy(SDnode *pDnode, SMnodeOpt *pOption) {
...
...
@@ -255,8 +255,8 @@ static void mmBuildOptionForOpen(SDnode *pDnode, SMnodeOpt *pOption) {
int32_t mmBuildOptionFromReq(SDnode *pDnode, SMnodeOpt *pOption, SDCreateMnodeReq *pCreate) {
mmInitOption(pDnode, pOption);
pOption->dnodeId = d
nd
GetDnodeId(pDnode);
pOption->clusterId = d
nd
GetClusterId(pDnode);
pOption->dnodeId = d
m
GetDnodeId(pDnode);
pOption->clusterId = d
m
GetClusterId(pDnode);
pOption->replica = pCreate->replica;
pOption->selfIndex = -1;
...
...
source/dnode/mgmt/mnode/src/mmWorker.c
浏览文件 @
c8a4d491
...
...
@@ -70,7 +70,7 @@ void mmInitMsgFp(SMnodeMgmt *pMgmt) {
static void mmSendRpcRsp(SDnode *pDnode, SRpcMsg *pRpc) {
if (pRpc->code == TSDB_CODE_DND_MNODE_NOT_DEPLOYED || pRpc->code == TSDB_CODE_APP_NOT_READY) {
d
nd
SendRedirectRsp(pDnode, pRpc);
d
m
SendRedirectRsp(pDnode, pRpc);
} else {
rpcSendResponse(pRpc);
}
...
...
source/dnode/mgmt/qnode/inc/qmInt.h
浏览文件 @
c8a4d491
...
...
@@ -16,10 +16,26 @@
#ifndef _TD_DND_QNODE_INT_H_
#define _TD_DND_QNODE_INT_H_
#include "dndInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#include "dndInt.h"
typedef
struct
SQnodeMgmt
{
int32_t
refCount
;
int8_t
deployed
;
int8_t
dropped
;
SQnode
*
pQnode
;
SRWLatch
latch
;
SDnodeWorker
queryWorker
;
SDnodeWorker
fetchWorker
;
//
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SQnodeMgmt
;
SMgmtFp
qmGetMgmtFp
();
...
...
source/dnode/mgmt/qnode/src/qmMgmt.c
浏览文件 @
c8a4d491
...
...
@@ -185,9 +185,9 @@ static void dndBuildQnodeOption(SDnode *pDnode, SQnodeOpt *pOption) {
pOption->pDnode = pDnode;
pOption->sendReqToDnodeFp = dndSendReqToDnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendRedirectRspFp = d
nd
SendRedirectRsp;
pOption->dnodeId = d
nd
GetDnodeId(pDnode);
pOption->clusterId = d
nd
GetClusterId(pDnode);
pOption->sendRedirectRspFp = d
m
SendRedirectRsp;
pOption->dnodeId = d
m
GetDnodeId(pDnode);
pOption->clusterId = d
m
GetClusterId(pDnode);
pOption->sver = tsVersion;
}
...
...
@@ -274,7 +274,7 @@ int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return -1;
}
if (createReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (createReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_QNODE_INVALID_OPTION;
dError("failed to create qnode since %s", terrstr());
return -1;
...
...
@@ -290,7 +290,7 @@ int32_t dndProcessDropQnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return -1;
}
if (dropReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (dropReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_QNODE_INVALID_OPTION;
dError("failed to drop qnode since %s", terrstr());
return -1;
...
...
source/dnode/mgmt/snode/inc/smHandle.h
浏览文件 @
c8a4d491
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_DND_SNODE_HANDLE_H_
#define _TD_DND_SNODE_HANDLE_H_
#include "
m
mInt.h"
#include "
s
mInt.h"
#ifdef __cplusplus
extern
"C"
{
...
...
source/dnode/mgmt/snode/inc/smInt.h
浏览文件 @
c8a4d491
...
...
@@ -16,10 +16,26 @@
#ifndef _TD_DND_SNODE_INT_H_
#define _TD_DND_SNODE_INT_H_
#include "dndInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#include "dndInt.h"
typedef
struct
SSnodeMgmt
{
int32_t
refCount
;
int8_t
deployed
;
int8_t
dropped
;
SSnode
*
pSnode
;
SRWLatch
latch
;
SDnodeWorker
writeWorker
;
//
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SSnodeMgmt
;
SMgmtFp
smGetMgmtFp
();
...
...
source/dnode/mgmt/snode/src/smHandle.c
浏览文件 @
c8a4d491
...
...
@@ -21,6 +21,6 @@ void smInitMsgHandles(SMgmtWrapper *pWrapper) {
}
SMsgHandle
smGetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
int32_t
msgIndex
)
{
S
B
nodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
S
S
nodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
return
pMgmt
->
msgHandles
[
msgIndex
];
}
source/dnode/mgmt/snode/src/smMgmt.c
浏览文件 @
c8a4d491
...
...
@@ -179,9 +179,9 @@ static void dndBuildSnodeOption(SDnode *pDnode, SSnodeOpt *pOption) {
pOption->pDnode = pDnode;
pOption->sendReqToDnodeFp = dndSendReqToDnode;
pOption->sendReqToMnodeFp = dndSendReqToMnode;
pOption->sendRedirectRspFp = d
nd
SendRedirectRsp;
pOption->dnodeId = d
nd
GetDnodeId(pDnode);
pOption->clusterId = d
nd
GetClusterId(pDnode);
pOption->sendRedirectRspFp = d
m
SendRedirectRsp;
pOption->dnodeId = d
m
GetDnodeId(pDnode);
pOption->clusterId = d
m
GetClusterId(pDnode);
pOption->sver = tsVersion;
}
...
...
@@ -268,7 +268,7 @@ int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return -1;
}
if (createReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (createReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_SNODE_INVALID_OPTION;
dError("failed to create snode since %s", terrstr());
return -1;
...
...
@@ -284,7 +284,7 @@ int32_t dndProcessDropSnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return -1;
}
if (dropReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (dropReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_SNODE_INVALID_OPTION;
dError("failed to drop snode since %s", terrstr());
return -1;
...
...
source/dnode/mgmt/vnode/inc/vmInt.h
浏览文件 @
c8a4d491
...
...
@@ -22,6 +22,32 @@
extern
"C"
{
#endif
typedef
struct
{
int32_t
openVnodes
;
int32_t
totalVnodes
;
int32_t
masterNum
;
int64_t
numOfSelectReqs
;
int64_t
numOfInsertReqs
;
int64_t
numOfInsertSuccessReqs
;
int64_t
numOfBatchInsertReqs
;
int64_t
numOfBatchInsertSuccessReqs
;
}
SVnodesStat
;
typedef
struct
SVnodesMgmt
{
SVnodesStat
stat
;
SHashObj
*
hash
;
SRWLatch
latch
;
SQWorkerPool
queryPool
;
SFWorkerPool
fetchPool
;
SWWorkerPool
syncPool
;
SWWorkerPool
writePool
;
STfs
*
pTfs
;
SMsgHandle
msgHandles
[
TDMT_MAX
];
SProcObj
*
pProcess
;
bool
singleProc
;
}
SVnodesMgmt
;
SMgmtFp
vmGetMgmtFp
()
;
int32_t
dndInitVnodes
(
SDnode
*
pDnode
);
...
...
@@ -39,7 +65,8 @@ int32_t dndProcessAuthVnodeReq(SDnode *pDnode, SRpcMsg *pReq);
int32_t
dndProcessSyncVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
dndProcessCompactVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
dndPutReqToVQueryQ
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
vmGetTfsMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
);
void
vmGetVndMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/vnode/inc/vmMgmt.h
浏览文件 @
c8a4d491
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_DND_VNODE_MGMT_H_
#define _TD_DND_VNODE_MGMT_H_
#include "vmInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
dndPutReqToVQueryQ
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_DND_VNODE_MGMT_H_*/
source/dnode/mgmt/vnode/src/vmInt.c
浏览文件 @
c8a4d491
...
...
@@ -16,15 +16,40 @@
#define _DEFAULT_SOURCE
#include "vmInt.h"
#include "vmHandle.h"
#include "vmMgmt.h"
bool
vmRequireNode
(
SMgmtWrapper
*
pWrapper
)
{
return
false
;
}
static
int32_t
vmInit
(
SMgmtWrapper
*
pWrapper
)
{
SVnodeOpt
vnodeOpt
=
{
0
};
vnodeOpt
.
nthreads
=
tsNumOfCommitThreads
;
vnodeOpt
.
putReqToVQueryQFp
=
dndPutReqToVQueryQ
;
vnodeOpt
.
sendReqToDnodeFp
=
dndSendReqToDnode
;
if
(
vnodeInit
(
&
vnodeOpt
)
!=
0
)
{
dError
(
"failed to init vnode since %s"
,
terrstr
());
dndCleanup
();
return
-
1
;
}
if
(
walInit
()
!=
0
)
{
dError
(
"failed to init wal since %s"
,
terrstr
());
dndCleanup
();
return
-
1
;
}
return
0
;
}
static
void
vmCleanup
(
SMgmtWrapper
*
pWrapper
)
{
walCleanUp
();
vnodeCleanup
();
}
static
bool
vmRequire
(
SMgmtWrapper
*
pWrapper
)
{
return
false
;
}
SMgmtFp
vmGetMgmtFp
()
{
SMgmtFp
mgmtFp
=
{
0
};
mgmtFp
.
openFp
=
NULL
;
mgmtFp
.
closeFp
=
NULL
;
mgmtFp
.
requiredFp
=
vmRequire
Node
;
mgmtFp
.
openFp
=
vmInit
;
mgmtFp
.
closeFp
=
vmCleanup
;
mgmtFp
.
requiredFp
=
vmRequire
;
mgmtFp
.
getMsgHandleFp
=
vmGetMsgHandle
;
return
mgmtFp
;
}
source/dnode/mgmt/vnode/src/vmMgmt.c
浏览文件 @
c8a4d491
...
...
@@ -554,7 +554,7 @@ int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
SWrapperCfg wrapperCfg = {0};
dndGenerateWrapperCfg(pDnode, &createReq, &wrapperCfg);
if (createReq.dnodeId != d
nd
GetDnodeId(pDnode)) {
if (createReq.dnodeId != d
m
GetDnodeId(pDnode)) {
terrno = TSDB_CODE_DND_VNODE_INVALID_OPTION;
dDebug("vgId:%d, failed to create vnode since %s", createReq.vgId, terrstr());
return -1;
...
...
@@ -1056,3 +1056,26 @@ void dndGetVnodeLoads(SDnode *pDnode, SArray *pLoads) {
// }
int32_t
dndPutReqToVQueryQ
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
){
return
0
;}
int32_t
vmGetTfsMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
){
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
if
(
pMgmt
==
NULL
)
return
-
1
;
return
tfsGetMonitorInfo
(
pMgmt
->
pTfs
,
pInfo
);;
}
void
vmGetVndMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
if
(
pMgmt
==
NULL
)
return
;
SVnodesStat
*
pStat
=
&
pMgmt
->
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
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录