Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e00f74cc
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看板
提交
e00f74cc
编写于
4月 02, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact dm
上级
7e361ebc
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
83 addition
and
59 deletion
+83
-59
source/dnode/mgmt/bm/src/bmInt.c
source/dnode/mgmt/bm/src/bmInt.c
+1
-1
source/dnode/mgmt/dm/inc/dmInt.h
source/dnode/mgmt/dm/inc/dmInt.h
+8
-1
source/dnode/mgmt/dm/src/dmHandle.c
source/dnode/mgmt/dm/src/dmHandle.c
+11
-11
source/dnode/mgmt/dm/src/dmInt.c
source/dnode/mgmt/dm/src/dmInt.c
+4
-4
source/dnode/mgmt/dm/src/dmWorker.c
source/dnode/mgmt/dm/src/dmWorker.c
+2
-12
source/dnode/mgmt/main/inc/dnd.h
source/dnode/mgmt/main/inc/dnd.h
+47
-20
source/dnode/mgmt/main/src/dndInt.c
source/dnode/mgmt/main/src/dndInt.c
+6
-6
source/dnode/mgmt/mm/src/mmInt.c
source/dnode/mgmt/mm/src/mmInt.c
+1
-1
source/dnode/mgmt/qm/src/qmInt.c
source/dnode/mgmt/qm/src/qmInt.c
+1
-1
source/dnode/mgmt/sm/src/smInt.c
source/dnode/mgmt/sm/src/smInt.c
+1
-1
source/dnode/mgmt/vm/src/vmInt.c
source/dnode/mgmt/vm/src/vmInt.c
+1
-1
未找到文件。
source/dnode/mgmt/bm/src/bmInt.c
浏览文件 @
e00f74cc
...
...
@@ -109,7 +109,7 @@ int32_t bmOpen(SMgmtWrapper *pWrapper) {
return
code
;
}
void
bm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
void
bm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
SMgmtFp
mgmtFp
=
{
0
};
mgmtFp
.
openFp
=
bmOpen
;
mgmtFp
.
closeFp
=
bmClose
;
...
...
source/dnode/mgmt/dm/inc/dmInt.h
浏览文件 @
e00f74cc
...
...
@@ -39,18 +39,25 @@ typedef struct SDnodeMgmt {
SMgmtWrapper
*
pWrapper
;
}
SDnodeMgmt
;
// dmInt.c
void
dmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
dmGetMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmUpdateMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmSendRedirectRsp
(
SDnodeMgmt
*
pMgmt
,
const
SRpcMsg
*
pMsg
);
// dmFile.c
int32_t
dmReadFile
(
SDnodeMgmt
*
pMgmt
);
int32_t
dmWriteFile
(
SDnodeMgmt
*
pMgmt
);
void
dmUpdateDnodeEps
(
SDnodeMgmt
*
pMgmt
,
SArray
*
pDnodeEps
);
// dm
Msg
.c
// dm
Handle
.c
void
dmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
void
dmSendStatusReq
(
SDnodeMgmt
*
pMgmt
);
int32_t
dmProcessConfigReq
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessStatusRsp
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessAuthRsp
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessGrantRsp
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessCDnodeMsg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
);
// dmWorker.c
int32_t
dmStartThread
(
SDnodeMgmt
*
pMgmt
);
...
...
source/dnode/mgmt/dm/src/dmHandle.c
浏览文件 @
e00f74cc
...
...
@@ -118,7 +118,7 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SNodeMsg *pMsg) {
}
static
int32_t
d
nd
ProcessCreateNodeMsg
(
SDnode
*
pDnode
,
ENodeType
ntype
,
SNodeMsg
*
pMsg
)
{
static
int32_t
d
m
ProcessCreateNodeMsg
(
SDnode
*
pDnode
,
ENodeType
ntype
,
SNodeMsg
*
pMsg
)
{
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
ntype
);
if
(
pWrapper
!=
NULL
)
{
dndReleaseWrapper
(
pWrapper
);
...
...
@@ -146,7 +146,7 @@ static int32_t dndProcessCreateNodeMsg(SDnode *pDnode, ENodeType ntype, SNodeMsg
return
code
;
}
static
int32_t
d
nd
ProcessDropNodeMsg
(
SDnode
*
pDnode
,
ENodeType
ntype
,
SNodeMsg
*
pMsg
)
{
static
int32_t
d
m
ProcessDropNodeMsg
(
SDnode
*
pDnode
,
ENodeType
ntype
,
SNodeMsg
*
pMsg
)
{
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
ntype
);
if
(
pWrapper
==
NULL
)
{
terrno
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
...
...
@@ -171,24 +171,24 @@ static int32_t dndProcessDropNodeMsg(SDnode *pDnode, ENodeType ntype, SNodeMsg *
return
code
;
}
int32_t
d
ndProcessN
odeMsg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
)
{
int32_t
d
mProcessCDn
odeMsg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
)
{
switch
(
pMsg
->
rpcMsg
.
msgType
)
{
case
TDMT_DND_CREATE_MNODE
:
return
d
nd
ProcessCreateNodeMsg
(
pDnode
,
MNODE
,
pMsg
);
return
d
m
ProcessCreateNodeMsg
(
pDnode
,
MNODE
,
pMsg
);
case
TDMT_DND_DROP_MNODE
:
return
d
nd
ProcessDropNodeMsg
(
pDnode
,
MNODE
,
pMsg
);
return
d
m
ProcessDropNodeMsg
(
pDnode
,
MNODE
,
pMsg
);
case
TDMT_DND_CREATE_QNODE
:
return
d
nd
ProcessCreateNodeMsg
(
pDnode
,
QNODE
,
pMsg
);
return
d
m
ProcessCreateNodeMsg
(
pDnode
,
QNODE
,
pMsg
);
case
TDMT_DND_DROP_QNODE
:
return
d
nd
ProcessDropNodeMsg
(
pDnode
,
QNODE
,
pMsg
);
return
d
m
ProcessDropNodeMsg
(
pDnode
,
QNODE
,
pMsg
);
case
TDMT_DND_CREATE_SNODE
:
return
d
nd
ProcessCreateNodeMsg
(
pDnode
,
SNODE
,
pMsg
);
return
d
m
ProcessCreateNodeMsg
(
pDnode
,
SNODE
,
pMsg
);
case
TDMT_DND_DROP_SNODE
:
return
d
nd
ProcessDropNodeMsg
(
pDnode
,
SNODE
,
pMsg
);
return
d
m
ProcessDropNodeMsg
(
pDnode
,
SNODE
,
pMsg
);
case
TDMT_DND_CREATE_BNODE
:
return
d
nd
ProcessCreateNodeMsg
(
pDnode
,
BNODE
,
pMsg
);
return
d
m
ProcessCreateNodeMsg
(
pDnode
,
BNODE
,
pMsg
);
case
TDMT_DND_DROP_BNODE
:
return
d
nd
ProcessDropNodeMsg
(
pDnode
,
BNODE
,
pMsg
);
return
d
m
ProcessDropNodeMsg
(
pDnode
,
BNODE
,
pMsg
);
default:
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
return
-
1
;
...
...
source/dnode/mgmt/dm/src/dmInt.c
浏览文件 @
e00f74cc
...
...
@@ -78,7 +78,7 @@ static int32_t dmStart(SMgmtWrapper *pWrapper) {
return
dmStartThread
(
pWrapper
->
pMgmt
);
}
int32_t
dmInit
(
SMgmtWrapper
*
pWrapper
)
{
static
int32_t
dmInit
(
SMgmtWrapper
*
pWrapper
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SDnodeMgmt
*
pMgmt
=
taosMemoryCalloc
(
1
,
sizeof
(
SDnodeMgmt
));
dInfo
(
"dnode-mgmt start to init"
);
...
...
@@ -124,7 +124,7 @@ int32_t dmInit(SMgmtWrapper *pWrapper) {
return
0
;
}
void
dmCleanup
(
SMgmtWrapper
*
pWrapper
)
{
static
void
dmCleanup
(
SMgmtWrapper
*
pWrapper
)
{
SDnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
if
(
pMgmt
==
NULL
)
return
;
...
...
@@ -153,12 +153,12 @@ void dmCleanup(SMgmtWrapper *pWrapper) {
dInfo
(
"dnode-mgmt is cleaned up"
);
}
int32_t
dmRequire
(
SMgmtWrapper
*
pWrapper
,
bool
*
required
)
{
static
int32_t
dmRequire
(
SMgmtWrapper
*
pWrapper
,
bool
*
required
)
{
*
required
=
true
;
return
0
;
}
void
dm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
void
dm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
SMgmtFp
mgmtFp
=
{
0
};
mgmtFp
.
openFp
=
dmInit
;
mgmtFp
.
closeFp
=
dmCleanup
;
...
...
source/dnode/mgmt/dm/src/dmWorker.c
浏览文件 @
e00f74cc
...
...
@@ -66,16 +66,6 @@ static void dmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
dTrace
(
"msg:%p, will be processed in dnode queue"
,
pMsg
);
switch
(
pRpc
->
msgType
)
{
case
TDMT_DND_CREATE_MNODE
:
case
TDMT_DND_CREATE_QNODE
:
case
TDMT_DND_CREATE_SNODE
:
case
TDMT_DND_CREATE_BNODE
:
case
TDMT_DND_DROP_MNODE
:
case
TDMT_DND_DROP_QNODE
:
case
TDMT_DND_DROP_SNODE
:
case
TDMT_DND_DROP_BNODE
:
code
=
dndProcessNodeMsg
(
pMgmt
->
pDnode
,
pMsg
);
break
;
case
TDMT_DND_CONFIG_DNODE
:
code
=
dmProcessConfigReq
(
pMgmt
,
pMsg
);
break
;
...
...
@@ -89,8 +79,8 @@ static void dmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
code
=
dmProcessGrantRsp
(
pMgmt
,
pMsg
);
break
;
default:
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
dError
(
"msg:%p, type:%s not processed in dnode queue"
,
pRpc
->
handle
,
TMSG_INFO
(
pRpc
->
msgType
))
;
code
=
dmProcessCDnodeMsg
(
pMgmt
->
pDnode
,
pMsg
)
;
break
;
}
if
(
pRpc
->
msgType
&
1u
)
{
...
...
source/dnode/mgmt/main/inc/dnd.h
浏览文件 @
e00f74cc
...
...
@@ -27,13 +27,13 @@
#include "tlockfree.h"
#include "tlog.h"
#include "tmsg.h"
#include "tmsgcb.h"
#include "tprocess.h"
#include "tqueue.h"
#include "trpc.h"
#include "tthread.h"
#include "ttime.h"
#include "tworker.h"
#include "tmsgcb.h"
#include "dnode.h"
#include "monitor.h"
...
...
@@ -42,12 +42,42 @@
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__); }}
#define dWarn(...) { if (dDebugFlag & DEBUG_WARN) { taosPrintLog("DND WARN ", DEBUG_WARN, 255, __VA_ARGS__); }}
#define dInfo(...) { if (dDebugFlag & DEBUG_INFO) { taosPrintLog("DND ", DEBUG_INFO, 255, __VA_ARGS__); }}
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); }}
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); }}
#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__); \
} \
}
#define dWarn(...) \
{ \
if (dDebugFlag & DEBUG_WARN) { \
taosPrintLog("DND WARN ", DEBUG_WARN, 255, __VA_ARGS__); \
} \
}
#define dInfo(...) \
{ \
if (dDebugFlag & DEBUG_INFO) { \
taosPrintLog("DND ", DEBUG_INFO, 255, __VA_ARGS__); \
} \
}
#define dDebug(...) \
{ \
if (dDebugFlag & DEBUG_DEBUG) { \
taosPrintLog("DND ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); \
} \
}
#define dTrace(...) \
{ \
if (dDebugFlag & DEBUG_TRACE) { \
taosPrintLog("DND ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); \
} \
}
typedef
enum
{
DNODE
,
VNODES
,
QNODE
,
SNODE
,
MNODE
,
BNODE
,
NODE_MAX
}
ENodeType
;
typedef
enum
{
DND_STAT_INIT
,
DND_STAT_RUNNING
,
DND_STAT_STOPPED
}
EDndStatus
;
...
...
@@ -73,7 +103,7 @@ typedef int32_t (*DropNodeFp)(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
typedef
int32_t
(
*
RequireNodeFp
)(
SMgmtWrapper
*
pWrapper
,
bool
*
required
);
typedef
struct
SMsgHandle
{
SMgmtWrapper
*
pQndWrapper
;
SMgmtWrapper
*
pQndWrapper
;
SMgmtWrapper
*
pMndWrapper
;
SMgmtWrapper
*
pWrapper
;
}
SMsgHandle
;
...
...
@@ -146,14 +176,11 @@ void dndSetMsgHandle(SMgmtWrapper *pWrapper, tmsg_t msgType, NodeMsgFp
SMgmtWrapper
*
dndAcquireWrapper
(
SDnode
*
pDnode
,
ENodeType
nodeType
);
int32_t
dndMarkWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndReleaseWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
// dndMonitor.h
void
dndSendMonitorReport
(
SDnode
*
pDnode
);
// dndMsg.h
void
dndReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
int32_t
dndProcessNodeMsg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
);
// dndStr.h
const
char
*
dndStatStr
(
EDndStatus
stat
);
const
char
*
dndNodeLogStr
(
ENodeType
ntype
);
...
...
@@ -168,12 +195,12 @@ SProcCfg dndGenProcCfg(SMgmtWrapper *pWrapper);
int32_t
dndInitMsgHandle
(
SDnode
*
pDnode
);
// mgmt
void
dm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
bm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
qm
G
etMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
sm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
vm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
mm
G
etMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
dm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
bm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
qm
S
etMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
sm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
vm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
mm
S
etMgmtFp
(
SMgmtWrapper
*
pMgmt
);
void
dmGetMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmUpdateMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
...
...
@@ -194,8 +221,8 @@ void vmMonitorVnodeLoads(SMgmtWrapper *pWrapper, SArray *pLoads);
int32_t
vmMonitorTfsInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
);
void
vmMonitorVnodeReqs
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
);
int32_t
mmMonitorMnodeInfo
(
SMgmtWrapper
*
pWrapper
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
);
SMonGrantInfo
*
pGrantInfo
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mgmt/main/src/dndInt.c
浏览文件 @
e00f74cc
...
...
@@ -82,12 +82,12 @@ SDnode *dndCreate(const SDnodeOpt *pOption) {
}
dndSetStatus
(
pDnode
,
DND_STAT_INIT
);
dm
G
etMgmtFp
(
&
pDnode
->
wrappers
[
DNODE
]);
mm
G
etMgmtFp
(
&
pDnode
->
wrappers
[
MNODE
]);
vm
G
etMgmtFp
(
&
pDnode
->
wrappers
[
VNODES
]);
qm
G
etMgmtFp
(
&
pDnode
->
wrappers
[
QNODE
]);
sm
G
etMgmtFp
(
&
pDnode
->
wrappers
[
SNODE
]);
bm
G
etMgmtFp
(
&
pDnode
->
wrappers
[
BNODE
]);
dm
S
etMgmtFp
(
&
pDnode
->
wrappers
[
DNODE
]);
mm
S
etMgmtFp
(
&
pDnode
->
wrappers
[
MNODE
]);
vm
S
etMgmtFp
(
&
pDnode
->
wrappers
[
VNODES
]);
qm
S
etMgmtFp
(
&
pDnode
->
wrappers
[
QNODE
]);
sm
S
etMgmtFp
(
&
pDnode
->
wrappers
[
SNODE
]);
bm
S
etMgmtFp
(
&
pDnode
->
wrappers
[
BNODE
]);
for
(
ENodeType
n
=
0
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
n
];
...
...
source/dnode/mgmt/mm/src/mmInt.c
浏览文件 @
e00f74cc
...
...
@@ -227,7 +227,7 @@ static int32_t mmStart(SMgmtWrapper *pWrapper) {
return
mndStart
(
pMgmt
->
pMnode
);
}
void
mm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
void
mm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
SMgmtFp
mgmtFp
=
{
0
};
mgmtFp
.
openFp
=
mmOpen
;
mgmtFp
.
closeFp
=
mmClose
;
...
...
source/dnode/mgmt/qm/src/qmInt.c
浏览文件 @
e00f74cc
...
...
@@ -112,7 +112,7 @@ int32_t qmOpen(SMgmtWrapper *pWrapper) {
return
code
;
}
void
qm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
void
qm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
SMgmtFp
mgmtFp
=
{
0
};
mgmtFp
.
openFp
=
qmOpen
;
mgmtFp
.
closeFp
=
qmClose
;
...
...
source/dnode/mgmt/sm/src/smInt.c
浏览文件 @
e00f74cc
...
...
@@ -109,7 +109,7 @@ int32_t smOpen(SMgmtWrapper *pWrapper) {
return
code
;
}
void
sm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
void
sm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
SMgmtFp
mgmtFp
=
{
0
};
mgmtFp
.
openFp
=
smOpen
;
mgmtFp
.
closeFp
=
smClose
;
...
...
source/dnode/mgmt/vm/src/vmInt.c
浏览文件 @
e00f74cc
...
...
@@ -333,7 +333,7 @@ static int32_t vmRequire(SMgmtWrapper *pWrapper, bool *required) {
return
0
;
}
void
vm
G
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
void
vm
S
etMgmtFp
(
SMgmtWrapper
*
pWrapper
)
{
SMgmtFp
mgmtFp
=
{
0
};
mgmtFp
.
openFp
=
vmInit
;
mgmtFp
.
closeFp
=
vmCleanup
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录