Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bcad6bb5
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看板
提交
bcad6bb5
编写于
1月 04, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
restore from wal
上级
5f70d7b2
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
130 addition
and
107 deletion
+130
-107
include/dnode/bnode/bnode.h
include/dnode/bnode/bnode.h
+6
-6
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+8
-6
include/dnode/qnode/qnode.h
include/dnode/qnode/qnode.h
+6
-6
include/dnode/snode/snode.h
include/dnode/snode/snode.h
+6
-6
include/util/taoserror.h
include/util/taoserror.h
+1
-1
source/dnode/bnode/inc/bndInt.h
source/dnode/bnode/inc/bndInt.h
+3
-3
source/dnode/mgmt/impl/inc/dndDnode.h
source/dnode/mgmt/impl/inc/dndDnode.h
+2
-2
source/dnode/mgmt/impl/inc/dndTransport.h
source/dnode/mgmt/impl/inc/dndTransport.h
+2
-2
source/dnode/mgmt/impl/src/dndBnode.c
source/dnode/mgmt/impl/src/dndBnode.c
+3
-3
source/dnode/mgmt/impl/src/dndDnode.c
source/dnode/mgmt/impl/src/dndDnode.c
+4
-4
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+9
-3
source/dnode/mgmt/impl/src/dndQnode.c
source/dnode/mgmt/impl/src/dndQnode.c
+3
-3
source/dnode/mgmt/impl/src/dndSnode.c
source/dnode/mgmt/impl/src/dndSnode.c
+3
-3
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+10
-7
source/dnode/mgmt/impl/src/dnode.c
source/dnode/mgmt/impl/src/dnode.c
+1
-1
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+8
-7
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+1
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+1
-1
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+2
-0
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+14
-11
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+26
-21
source/dnode/mnode/impl/test/trans/trans.cpp
source/dnode/mnode/impl/test/trans/trans.cpp
+3
-3
source/dnode/qnode/inc/qndInt.h
source/dnode/qnode/inc/qndInt.h
+3
-3
source/dnode/snode/inc/sndInt.h
source/dnode/snode/inc/sndInt.h
+3
-3
source/libs/transport/src/rpcMain.c
source/libs/transport/src/rpcMain.c
+1
-1
source/util/src/terror.c
source/util/src/terror.c
+1
-1
未找到文件。
include/dnode/bnode/bnode.h
浏览文件 @
bcad6bb5
...
...
@@ -23,9 +23,9 @@ extern "C" {
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef
struct
SDnode
SDnode
;
typedef
struct
SBnode
SBnode
;
typedef
void
(
*
SendMsg
ToDnodeFp
)(
SDnode
*
pDnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendMsg
ToMnodeFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendRedirect
Msg
Fp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
SendReq
ToDnodeFp
)(
SDnode
*
pDnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
SendReq
ToMnodeFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendRedirect
Rsp
Fp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
struct
{
int64_t
numOfErrors
;
...
...
@@ -40,9 +40,9 @@ typedef struct {
int64_t
clusterId
;
SBnodeCfg
cfg
;
SDnode
*
pDnode
;
Send
MsgToDnodeFp
sendMsg
ToDnodeFp
;
Send
MsgToMnodeFp
sendMsg
ToMnodeFp
;
SendRedirect
MsgFp
sendRedirectMsg
Fp
;
Send
ReqToDnodeFp
sendReq
ToDnodeFp
;
Send
ReqToMnodeFp
sendReq
ToMnodeFp
;
SendRedirect
RspFp
sendRedirectRsp
Fp
;
}
SBnodeOpt
;
/* ------------------------ SBnode ------------------------ */
...
...
include/dnode/mnode/mnode.h
浏览文件 @
bcad6bb5
...
...
@@ -24,9 +24,10 @@ extern "C" {
typedef
struct
SDnode
SDnode
;
typedef
struct
SMnode
SMnode
;
typedef
struct
SMnodeMsg
SMnodeMsg
;
typedef
void
(
*
SendMsgToDnodeFp
)(
SDnode
*
pDnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendMsgToMnodeFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendRedirectMsgFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
SendReqToDnodeFp
)(
SDnode
*
pDnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
SendReqToMnodeFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
PutReqToMWriteQFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendRedirectRspFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
struct
SMnodeLoad
{
int64_t
numOfDnode
;
...
...
@@ -62,9 +63,10 @@ typedef struct {
SReplica
replicas
[
TSDB_MAX_REPLICA
];
SMnodeCfg
cfg
;
SDnode
*
pDnode
;
SendMsgToDnodeFp
sendMsgToDnodeFp
;
SendMsgToMnodeFp
sendMsgToMnodeFp
;
SendRedirectMsgFp
sendRedirectMsgFp
;
PutReqToMWriteQFp
putReqToMWriteQFp
;
SendReqToDnodeFp
sendReqToDnodeFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendRedirectRspFp
sendRedirectRspFp
;
}
SMnodeOpt
;
/* ------------------------ SMnode ------------------------ */
...
...
include/dnode/qnode/qnode.h
浏览文件 @
bcad6bb5
...
...
@@ -23,9 +23,9 @@ extern "C" {
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef
struct
SDnode
SDnode
;
typedef
struct
SQnode
SQnode
;
typedef
void
(
*
SendMsg
ToDnodeFp
)(
SDnode
*
pDnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendMsg
ToMnodeFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendRedirect
Msg
Fp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
SendReq
ToDnodeFp
)(
SDnode
*
pDnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
SendReq
ToMnodeFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendRedirect
Rsp
Fp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
struct
{
int64_t
numOfStartTask
;
...
...
@@ -47,9 +47,9 @@ typedef struct {
int64_t
clusterId
;
SQnodeCfg
cfg
;
SDnode
*
pDnode
;
Send
MsgToDnodeFp
sendMsg
ToDnodeFp
;
Send
MsgToMnodeFp
sendMsg
ToMnodeFp
;
SendRedirect
MsgFp
sendRedirectMsg
Fp
;
Send
ReqToDnodeFp
sendReq
ToDnodeFp
;
Send
ReqToMnodeFp
sendReq
ToMnodeFp
;
SendRedirect
RspFp
sendRedirectRsp
Fp
;
}
SQnodeOpt
;
/* ------------------------ SQnode ------------------------ */
...
...
include/dnode/snode/snode.h
浏览文件 @
bcad6bb5
...
...
@@ -23,9 +23,9 @@ extern "C" {
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef
struct
SDnode
SDnode
;
typedef
struct
SSnode
SSnode
;
typedef
void
(
*
SendMsg
ToDnodeFp
)(
SDnode
*
pDnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendMsg
ToMnodeFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendRedirect
Msg
Fp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
SendReq
ToDnodeFp
)(
SDnode
*
pDnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
typedef
int32_t
(
*
SendReq
ToMnodeFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
void
(
*
SendRedirect
Rsp
Fp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
rpcMsg
);
typedef
struct
{
int64_t
numOfErrors
;
...
...
@@ -40,9 +40,9 @@ typedef struct {
int64_t
clusterId
;
SSnodeCfg
cfg
;
SDnode
*
pDnode
;
Send
MsgToDnodeFp
sendMsg
ToDnodeFp
;
Send
MsgToMnodeFp
sendMsg
ToMnodeFp
;
SendRedirect
MsgFp
sendRedirectMsg
Fp
;
Send
ReqToDnodeFp
sendReq
ToDnodeFp
;
Send
ReqToMnodeFp
sendReq
ToMnodeFp
;
SendRedirect
RspFp
sendRedirectRsp
Fp
;
}
SSnodeOpt
;
/* ------------------------ SSnode ------------------------ */
...
...
include/util/taoserror.h
浏览文件 @
bcad6bb5
...
...
@@ -253,7 +253,7 @@ int32_t* taosGetErrno();
// dnode
#define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0400)
#define TSDB_CODE_DND_
EXITING
TAOS_DEF_ERROR_CODE(0, 0x0401)
#define TSDB_CODE_DND_
OFFLINE
TAOS_DEF_ERROR_CODE(0, 0x0401)
#define TSDB_CODE_DND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0402)
#define TSDB_CODE_DND_DNODE_READ_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0410)
#define TSDB_CODE_DND_DNODE_WRITE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0411)
...
...
source/dnode/bnode/inc/bndInt.h
浏览文件 @
bcad6bb5
...
...
@@ -33,9 +33,9 @@ typedef struct SBnode {
int32_t
dnodeId
;
int64_t
clusterId
;
SBnodeCfg
cfg
;
Send
MsgToDnodeFp
sendMsg
ToDnodeFp
;
Send
MsgToMnodeFp
sendMsg
ToMnodeFp
;
SendRedirect
MsgFp
sendRedirectMsg
Fp
;
Send
ReqToDnodeFp
sendReq
ToDnodeFp
;
Send
ReqToMnodeFp
sendReq
ToMnodeFp
;
SendRedirect
RspFp
sendRedirectRsp
Fp
;
}
SBnode
;
#ifdef __cplusplus
...
...
source/dnode/mgmt/impl/inc/dndDnode.h
浏览文件 @
bcad6bb5
...
...
@@ -29,8 +29,8 @@ int64_t dndGetClusterId(SDnode *pDnode);
void
dndGetDnodeEp
(
SDnode
*
pDnode
,
int32_t
dnodeId
,
char
*
pEp
,
char
*
pFqdn
,
uint16_t
*
pPort
);
void
dndGetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
);
void
dndSendRedirect
Msg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dndSendStatus
Msg
(
SDnode
*
pDnode
);
void
dndSendRedirect
Rsp
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dndSendStatus
Req
(
SDnode
*
pDnode
);
void
dndProcessMgmtMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
,
SEpSet
*
pEpSet
);
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
...
...
source/dnode/mgmt/impl/inc/dndTransport.h
浏览文件 @
bcad6bb5
...
...
@@ -23,8 +23,8 @@ extern "C" {
int32_t
dndInitTrans
(
SDnode
*
pDnode
);
void
dndCleanupTrans
(
SDnode
*
pDnode
);
void
dndSendMsg
ToMnode
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
void
dndSendMsg
ToDnode
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pRpcMsg
);
int32_t
dndSendReq
ToMnode
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
);
int32_t
dndSendReq
ToDnode
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pRpcMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/impl/src/dndBnode.c
浏览文件 @
bcad6bb5
...
...
@@ -179,9 +179,9 @@ static void dndStopBnodeWorker(SDnode *pDnode) {
static
void
dndBuildBnodeOption
(
SDnode
*
pDnode
,
SBnodeOpt
*
pOption
)
{
pOption
->
pDnode
=
pDnode
;
pOption
->
send
MsgToDnodeFp
=
dndSendMsg
ToDnode
;
pOption
->
send
MsgToMnodeFp
=
dndSendMsg
ToMnode
;
pOption
->
sendRedirect
MsgFp
=
dndSendRedirectMsg
;
pOption
->
send
ReqToDnodeFp
=
dndSendReq
ToDnode
;
pOption
->
send
ReqToMnodeFp
=
dndSendReq
ToMnode
;
pOption
->
sendRedirect
RspFp
=
dndSendRedirectRsp
;
pOption
->
dnodeId
=
dndGetDnodeId
(
pDnode
);
pOption
->
clusterId
=
dndGetClusterId
(
pDnode
);
pOption
->
cfg
.
sver
=
pDnode
->
opt
.
sver
;
...
...
source/dnode/mgmt/impl/src/dndDnode.c
浏览文件 @
bcad6bb5
...
...
@@ -80,7 +80,7 @@ void dndGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {
taosRUnLockLatch
(
&
pMgmt
->
latch
);
}
void
dndSendRedirect
Msg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
void
dndSendRedirect
Rsp
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
tmsg_t
msgType
=
pMsg
->
msgType
;
SEpSet
epSet
=
{
0
};
...
...
@@ -354,7 +354,7 @@ static int32_t dndWriteDnodes(SDnode *pDnode) {
return
0
;
}
void
dndSendStatus
Msg
(
SDnode
*
pDnode
)
{
void
dndSendStatus
Req
(
SDnode
*
pDnode
)
{
int32_t
contLen
=
sizeof
(
SStatusMsg
)
+
TSDB_MAX_VNODES
*
sizeof
(
SVnodeLoad
);
SStatusMsg
*
pStatus
=
rpcMallocCont
(
contLen
);
...
...
@@ -391,7 +391,7 @@ void dndSendStatusMsg(SDnode *pDnode) {
pMgmt
->
statusSent
=
1
;
dTrace
(
"pDnode:%p, send status msg to mnode"
,
pDnode
);
dndSend
Msg
ToMnode
(
pDnode
,
&
rpcMsg
);
dndSend
Req
ToMnode
(
pDnode
,
&
rpcMsg
);
}
static
void
dndUpdateDnodeCfg
(
SDnode
*
pDnode
,
SDnodeCfg
*
pCfg
)
{
...
...
@@ -491,7 +491,7 @@ static void *dnodeThreadRoutine(void *param) {
taosMsleep
(
ms
);
if
(
dndGetStat
(
pDnode
)
==
DND_STAT_RUNNING
&&
!
pMgmt
->
statusSent
&&
!
pMgmt
->
dropped
)
{
dndSendStatus
Msg
(
pDnode
);
dndSendStatus
Req
(
pDnode
);
}
}
}
...
...
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
bcad6bb5
...
...
@@ -19,6 +19,7 @@
#include "dndTransport.h"
#include "dndWorker.h"
static
void
dndWriteMnodeMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SRpcMsg
*
pRpcMsg
);
static
void
dndProcessMnodeQueue
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
);
static
SMnode
*
dndAcquireMnode
(
SDnode
*
pDnode
)
{
...
...
@@ -258,11 +259,16 @@ static bool dndNeedDeployMnode(SDnode *pDnode) {
return
true
;
}
static
int32_t
dndPutMsgToMWriteQ
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
dndWriteMnodeMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
writeWorker
,
pRpcMsg
);
}
static
void
dndInitMnodeOption
(
SDnode
*
pDnode
,
SMnodeOpt
*
pOption
)
{
pOption
->
pDnode
=
pDnode
;
pOption
->
sendMsgToDnodeFp
=
dndSendMsgToDnode
;
pOption
->
sendMsgToMnodeFp
=
dndSendMsgToMnode
;
pOption
->
sendRedirectMsgFp
=
dndSendRedirectMsg
;
pOption
->
sendReqToDnodeFp
=
dndSendReqToDnode
;
pOption
->
sendReqToMnodeFp
=
dndSendReqToMnode
;
pOption
->
sendRedirectRspFp
=
dndSendRedirectRsp
;
pOption
->
putReqToMWriteQFp
=
dndPutMsgToMWriteQ
;
pOption
->
dnodeId
=
dndGetDnodeId
(
pDnode
);
pOption
->
clusterId
=
dndGetClusterId
(
pDnode
);
pOption
->
cfg
.
sver
=
pDnode
->
opt
.
sver
;
...
...
source/dnode/mgmt/impl/src/dndQnode.c
浏览文件 @
bcad6bb5
...
...
@@ -185,9 +185,9 @@ static void dndStopQnodeWorker(SDnode *pDnode) {
static
void
dndBuildQnodeOption
(
SDnode
*
pDnode
,
SQnodeOpt
*
pOption
)
{
pOption
->
pDnode
=
pDnode
;
pOption
->
send
MsgToDnodeFp
=
dndSendMsg
ToDnode
;
pOption
->
send
MsgToMnodeFp
=
dndSendMsg
ToMnode
;
pOption
->
sendRedirect
MsgFp
=
dndSendRedirectMsg
;
pOption
->
send
ReqToDnodeFp
=
dndSendReq
ToDnode
;
pOption
->
send
ReqToMnodeFp
=
dndSendReq
ToMnode
;
pOption
->
sendRedirect
RspFp
=
dndSendRedirectRsp
;
pOption
->
dnodeId
=
dndGetDnodeId
(
pDnode
);
pOption
->
clusterId
=
dndGetClusterId
(
pDnode
);
pOption
->
cfg
.
sver
=
pDnode
->
opt
.
sver
;
...
...
source/dnode/mgmt/impl/src/dndSnode.c
浏览文件 @
bcad6bb5
...
...
@@ -179,9 +179,9 @@ static void dndStopSnodeWorker(SDnode *pDnode) {
static
void
dndBuildSnodeOption
(
SDnode
*
pDnode
,
SSnodeOpt
*
pOption
)
{
pOption
->
pDnode
=
pDnode
;
pOption
->
send
MsgToDnodeFp
=
dndSendMsg
ToDnode
;
pOption
->
send
MsgToMnodeFp
=
dndSendMsg
ToMnode
;
pOption
->
sendRedirect
MsgFp
=
dndSendRedirectMsg
;
pOption
->
send
ReqToDnodeFp
=
dndSendReq
ToDnode
;
pOption
->
send
ReqToMnodeFp
=
dndSendReq
ToMnode
;
pOption
->
sendRedirect
RspFp
=
dndSendRedirectRsp
;
pOption
->
dnodeId
=
dndGetDnodeId
(
pDnode
);
pOption
->
clusterId
=
dndGetClusterId
(
pDnode
);
pOption
->
cfg
.
sver
=
pDnode
->
opt
.
sver
;
...
...
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
bcad6bb5
...
...
@@ -105,8 +105,6 @@ static void dndInitMsgFp(STransMgmt *pMgmt) {
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_MND_SHOW_RETRIEVE
)]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_MND_STATUS
)]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_MND_STATUS_RSP
)]
=
dndProcessMgmtMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_MND_TRANS
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_MND_TRANS_RSP
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_MND_GRANT
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_MND_GRANT_RSP
)]
=
dndProcessMgmtMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_MND_AUTH
)]
=
dndProcessMnodeReadMsg
;
...
...
@@ -216,7 +214,7 @@ static void dndProcessRequest(void *param, SRpcMsg *pMsg, SEpSet *pEpSet) {
if
(
dndGetStat
(
pDnode
)
==
DND_STAT_STOPPED
)
{
dError
(
"RPC %p, req:%s app:%p is ignored since dnode exiting"
,
pMsg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
code
=
TSDB_CODE_DND_
EXITING
};
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
code
=
TSDB_CODE_DND_
OFFLINE
};
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
return
;
...
...
@@ -383,14 +381,19 @@ void dndCleanupTrans(SDnode *pDnode) {
dInfo
(
"dnode-transport is cleaned up"
);
}
void
dndSendMsg
ToDnode
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
int32_t
dndSendReq
ToDnode
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
tmgmt
;
if
(
pMgmt
->
clientRpc
==
NULL
)
return
;
if
(
pMgmt
->
clientRpc
==
NULL
)
{
terrno
=
TSDB_CODE_DND_OFFLINE
;
return
-
1
;
}
rpcSendRequest
(
pMgmt
->
clientRpc
,
pEpSet
,
pMsg
,
NULL
);
return
0
;
}
void
dndSendMsg
ToMnode
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
int32_t
dndSendReq
ToMnode
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
SEpSet
epSet
=
{
0
};
dndGetMnodeEpSet
(
pDnode
,
&
epSet
);
dndSendMsg
ToDnode
(
pDnode
,
&
epSet
,
pMsg
);
return
dndSendReq
ToDnode
(
pDnode
,
&
epSet
,
pMsg
);
}
source/dnode/mgmt/impl/src/dnode.c
浏览文件 @
bcad6bb5
...
...
@@ -213,7 +213,7 @@ SDnode *dndInit(SDnodeOpt *pOption) {
}
dndSetStat
(
pDnode
,
DND_STAT_RUNNING
);
dndSendStatus
Msg
(
pDnode
);
dndSendStatus
Req
(
pDnode
);
dndReportStartup
(
pDnode
,
"TDengine"
,
"initialized successfully"
);
dInfo
(
"TDengine is initialized successfully, pDnode:%p"
,
pDnode
);
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
bcad6bb5
...
...
@@ -91,15 +91,16 @@ typedef struct SMnode {
STelemMgmt
telemMgmt
;
SSyncMgmt
syncMgmt
;
MndMsgFp
msgFp
[
TDMT_MAX
];
SendMsgToDnodeFp
sendMsgToDnodeFp
;
SendMsgToMnodeFp
sendMsgToMnodeFp
;
SendRedirectMsgFp
sendRedirectMsgFp
;
SendReqToDnodeFp
sendReqToDnodeFp
;
SendReqToMnodeFp
sendReqToMnodeFp
;
SendRedirectRspFp
sendRedirectRspFp
;
PutReqToMWriteQFp
putReqToMWriteQFp
;
}
SMnode
;
void
mndSendMsg
ToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
rpcMsg
);
void
mndSendMsg
ToMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
);
void
mndSendRedirectMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
);
void
mndSetMsgHandle
(
SMnode
*
pMnode
,
tmsg_t
msgType
,
MndMsgFp
fp
);
int32_t
mndSendReq
ToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
rpcMsg
);
int32_t
mndSendReq
ToMnode
(
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
)
;
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
bcad6bb5
...
...
@@ -45,6 +45,7 @@ int32_t mndTransAppendUndoAction(STrans *pTrans, STransAction *pAction);
int32_t
mndTransPrepare
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
void
mndTransProcessRsp
(
SMnodeMsg
*
pMsg
);
void
mndTransPullup
(
SMnode
*
pMnode
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
bcad6bb5
...
...
@@ -557,7 +557,7 @@ static int32_t mndProcessConfigDnodeMsg(SMnodeMsg *pMsg) {
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
};
mInfo
(
"dnode:%d, app:%p config:%s req send to dnode"
,
pCfg
->
dnodeId
,
rpcMsg
.
ahandle
,
pCfg
->
config
);
mndSend
Msg
ToDnode
(
pMnode
,
&
epSet
,
&
rpcMsg
);
mndSend
Req
ToDnode
(
pMnode
,
&
epSet
,
&
rpcMsg
);
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
bcad6bb5
...
...
@@ -83,6 +83,8 @@ static int32_t mndRestoreWal(SMnode *pMnode) {
int64_t
sdbVer
=
sdbUpdateVer
(
pSdb
,
0
);
mDebug
(
"restore sdb wal finished, sdb ver:%"
PRId64
,
sdbVer
);
mndTransPullup
(
pMnode
);
if
(
walBeginSnapshot
(
pWal
,
sdbVer
)
<
0
)
{
goto
WAL_RESTORE_OVER
;
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
bcad6bb5
...
...
@@ -52,7 +52,6 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans);
static
void
mndTransExecute
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
static
void
mndTransSendRpcRsp
(
STrans
*
pTrans
);
static
int32_t
mndProcessTransMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessTransRsp
(
SMnodeMsg
*
pMsg
);
int32_t
mndInitTrans
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_TRANS
,
...
...
@@ -64,7 +63,6 @@ int32_t mndInitTrans(SMnode *pMnode) {
.
deleteFp
=
(
SdbDeleteFp
)
mndTransActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TRANS
,
mndProcessTransMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TRANS_RSP
,
mndProcessTransRsp
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
@@ -615,12 +613,15 @@ static int32_t mndTransSendActionMsg(SMnode *pMnode, STrans *pTrans, SArray *pAr
}
memcpy
(
rpcMsg
.
pCont
,
pAction
->
pCont
,
pAction
->
contLen
);
pAction
->
msgSent
=
1
;
pAction
->
msgReceived
=
0
;
pAction
->
errCode
=
0
;
mDebug
(
"trans:%d, action:%d is sent"
,
pTrans
->
id
,
action
);
mndSendMsgToDnode
(
pMnode
,
&
pAction
->
epSet
,
&
rpcMsg
);
if
(
mndSendReqToDnode
(
pMnode
,
&
pAction
->
epSet
,
&
rpcMsg
)
==
0
)
{
mDebug
(
"trans:%d, action:%d is sent"
,
pTrans
->
id
,
action
);
pAction
->
msgSent
=
1
;
pAction
->
msgReceived
=
0
;
pAction
->
errCode
=
0
;
}
else
{
mDebug
(
"trans:%d, action:%d not sent since %s"
,
pTrans
->
id
,
action
,
terrstr
());
return
-
1
;
}
}
return
0
;
...
...
@@ -885,7 +886,11 @@ static void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
}
static
int32_t
mndProcessTransMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
mndTransPullup
(
pMsg
->
pMnode
);
return
0
;
}
void
mndTransPullup
(
SMnode
*
pMnode
)
{
STrans
*
pTrans
=
NULL
;
void
*
pIter
=
NULL
;
...
...
@@ -897,5 +902,3 @@ static int32_t mndProcessTransMsg(SMnodeMsg *pMsg) {
sdbRelease
(
pMnode
->
pSdb
,
pTrans
);
}
}
static
int32_t
mndProcessTransRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
\ No newline at end of file
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
bcad6bb5
...
...
@@ -34,21 +34,27 @@
#include "mndUser.h"
#include "mndVgroup.h"
void
mndSendMsgToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
!=
NULL
&&
pMnode
->
sendMsgToDnodeFp
!=
NULL
)
{
(
*
pMnode
->
sendMsgToDnodeFp
)(
pMnode
->
pDnode
,
pEpSet
,
pMsg
);
int32_t
mndSendReqToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
==
NULL
||
pMnode
->
sendReqToDnodeFp
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NOT_READY
;
return
-
1
;
}
return
(
*
pMnode
->
sendReqToDnodeFp
)(
pMnode
->
pDnode
,
pEpSet
,
pMsg
);
}
void
mndSendMsgToMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
!=
NULL
&&
pMnode
->
sendMsgToMnodeFp
!=
NULL
)
{
(
*
pMnode
->
sendMsgToMnodeFp
)(
pMnode
->
pDnode
,
pMsg
);
int32_t
mndSendReqToMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
==
NULL
||
pMnode
->
sendReqToDnodeFp
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NOT_READY
;
return
-
1
;
}
return
(
*
pMnode
->
sendReqToMnodeFp
)(
pMnode
->
pDnode
,
pMsg
);
}
void
mndSendRedirect
Msg
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
!=
NULL
&&
pMnode
->
sendRedirect
Msg
Fp
!=
NULL
)
{
(
*
pMnode
->
sendRedirect
Msg
Fp
)(
pMnode
->
pDnode
,
pMsg
);
void
mndSendRedirect
Rsp
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
!=
NULL
&&
pMnode
->
sendRedirect
Rsp
Fp
!=
NULL
)
{
(
*
pMnode
->
sendRedirect
Rsp
Fp
)(
pMnode
->
pDnode
,
pMsg
);
}
}
...
...
@@ -56,11 +62,8 @@ static void mndTransReExecute(void *param, void *tmrId) {
SMnode
*
pMnode
=
param
;
if
(
mndIsMaster
(
pMnode
))
{
STransMsg
*
pMsg
=
rpcMallocCont
(
sizeof
(
STransMsg
));
SEpSet
epSet
=
{.
inUse
=
0
,
.
numOfEps
=
1
};
epSet
.
port
[
0
]
=
pMnode
->
replicas
[
pMnode
->
selfIndex
].
port
;
memcpy
(
epSet
.
fqdn
[
0
],
pMnode
->
replicas
[
pMnode
->
selfIndex
].
fqdn
,
TSDB_FQDN_LEN
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TRANS
,
.
pCont
=
pMsg
,
.
contLen
=
sizeof
(
STransMsg
)};
mndSendMsgToDnode
(
pMnode
,
&
epSet
,
&
rpcMsg
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TRANS
,
.
pCont
=
pMsg
,
.
contLen
=
sizeof
(
STransMsg
)};
pMnode
->
putReqToMWriteQFp
(
pMnode
->
pDnode
,
&
rpcMsg
);
}
taosTmrReset
(
mndTransReExecute
,
3000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
transTimer
);
...
...
@@ -76,7 +79,7 @@ static int32_t mndInitTimer(SMnode *pMnode) {
return
-
1
;
}
if
(
taosTmrReset
(
mndTransReExecute
,
1
000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
transTimer
))
{
if
(
taosTmrReset
(
mndTransReExecute
,
6
000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
transTimer
))
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
...
...
@@ -223,9 +226,10 @@ static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
pMnode
->
selfIndex
=
pOption
->
selfIndex
;
memcpy
(
&
pMnode
->
replicas
,
pOption
->
replicas
,
sizeof
(
SReplica
)
*
TSDB_MAX_REPLICA
);
pMnode
->
pDnode
=
pOption
->
pDnode
;
pMnode
->
sendMsgToDnodeFp
=
pOption
->
sendMsgToDnodeFp
;
pMnode
->
sendMsgToMnodeFp
=
pOption
->
sendMsgToMnodeFp
;
pMnode
->
sendRedirectMsgFp
=
pOption
->
sendRedirectMsgFp
;
pMnode
->
putReqToMWriteQFp
=
pOption
->
putReqToMWriteQFp
;
pMnode
->
sendReqToDnodeFp
=
pOption
->
sendReqToDnodeFp
;
pMnode
->
sendReqToMnodeFp
=
pOption
->
sendReqToMnodeFp
;
pMnode
->
sendRedirectRspFp
=
pOption
->
sendRedirectRspFp
;
pMnode
->
cfg
.
sver
=
pOption
->
cfg
.
sver
;
pMnode
->
cfg
.
enableTelem
=
pOption
->
cfg
.
enableTelem
;
pMnode
->
cfg
.
statusInterval
=
pOption
->
cfg
.
statusInterval
;
...
...
@@ -236,8 +240,9 @@ static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
pMnode
->
cfg
.
gitinfo
=
strdup
(
pOption
->
cfg
.
gitinfo
);
pMnode
->
cfg
.
buildinfo
=
strdup
(
pOption
->
cfg
.
buildinfo
);
if
(
pMnode
->
sendMsgToDnodeFp
==
NULL
||
pMnode
->
sendMsgToMnodeFp
==
NULL
||
pMnode
->
sendRedirectMsgFp
==
NULL
||
pMnode
->
dnodeId
<
0
||
pMnode
->
clusterId
<
0
||
pMnode
->
cfg
.
statusInterval
<
1
)
{
if
(
pMnode
->
sendReqToDnodeFp
==
NULL
||
pMnode
->
sendReqToMnodeFp
==
NULL
||
pMnode
->
sendRedirectRspFp
==
NULL
||
pMnode
->
putReqToMWriteQFp
==
NULL
||
pMnode
->
dnodeId
<
0
||
pMnode
->
clusterId
<
0
||
pMnode
->
cfg
.
statusInterval
<
1
)
{
terrno
=
TSDB_CODE_MND_INVALID_OPTIONS
;
return
-
1
;
}
...
...
@@ -433,7 +438,7 @@ void mndProcessMsg(SMnodeMsg *pMsg) {
PROCESS_RPC_END:
if
(
isReq
)
{
if
(
code
==
TSDB_CODE_APP_NOT_READY
)
{
mndSendRedirect
Msg
(
pMnode
,
&
pMsg
->
rpcMsg
);
mndSendRedirect
Rsp
(
pMnode
,
&
pMsg
->
rpcMsg
);
}
else
if
(
code
!=
0
)
{
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
code
=
code
};
rpcSendResponse
(
&
rpcRsp
);
...
...
source/dnode/mnode/impl/test/trans/trans.cpp
浏览文件 @
bcad6bb5
...
...
@@ -2,7 +2,7 @@
* @file trans.cpp
* @author slguan (slguan@taosdata.com)
* @brief MNODE module trans tests
* @version
1.0
* @version
0.1
* @date 2022-01-04
*
* @copyright Copyright (c) 2022
...
...
@@ -75,10 +75,10 @@ TEST_F(DndTestTrans, 01_CreateUser_Crash) {
test
.
SendShowRetrieveMsg
();
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
CheckBinary
(
"u1"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"u2"
,
TSDB_USER_LEN
);
CheckBinary
(
"super"
,
10
);
CheckBinary
(
"normal"
,
10
);
CheckBinary
(
"super"
,
10
);
CheckTimestamp
();
CheckTimestamp
();
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
...
...
source/dnode/qnode/inc/qndInt.h
浏览文件 @
bcad6bb5
...
...
@@ -32,9 +32,9 @@ typedef struct SQnode {
int32_t
dnodeId
;
int64_t
clusterId
;
SQnodeCfg
cfg
;
Send
MsgToDnodeFp
sendMsg
ToDnodeFp
;
Send
MsgToMnodeFp
sendMsg
ToMnodeFp
;
SendRedirect
MsgFp
sendRedirectMsg
Fp
;
Send
ReqToDnodeFp
sendReq
ToDnodeFp
;
Send
ReqToMnodeFp
sendReq
ToMnodeFp
;
SendRedirect
RspFp
sendRedirectRsp
Fp
;
}
SQnode
;
#ifdef __cplusplus
...
...
source/dnode/snode/inc/sndInt.h
浏览文件 @
bcad6bb5
...
...
@@ -32,9 +32,9 @@ typedef struct SSnode {
int32_t
dnodeId
;
int64_t
clusterId
;
SSnodeCfg
cfg
;
Send
MsgToDnodeFp
sendMsg
ToDnodeFp
;
Send
MsgToMnodeFp
sendMsg
ToMnodeFp
;
SendRedirect
MsgFp
sendRedirectMsg
Fp
;
Send
ReqToDnodeFp
sendReq
ToDnodeFp
;
Send
ReqToMnodeFp
sendReq
ToMnodeFp
;
SendRedirect
RspFp
sendRedirectRsp
Fp
;
}
SSnode
;
#ifdef __cplusplus
...
...
source/libs/transport/src/rpcMain.c
浏览文件 @
bcad6bb5
...
...
@@ -1195,7 +1195,7 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte
}
rpcSendReqToServer
(
pRpc
,
pContext
);
rpcFreeCont
(
rpcMsg
.
pCont
);
}
else
if
(
pHead
->
code
==
TSDB_CODE_RPC_NOT_READY
||
pHead
->
code
==
TSDB_CODE_APP_NOT_READY
||
pHead
->
code
==
TSDB_CODE_DND_
EXITING
)
{
}
else
if
(
pHead
->
code
==
TSDB_CODE_RPC_NOT_READY
||
pHead
->
code
==
TSDB_CODE_APP_NOT_READY
||
pHead
->
code
==
TSDB_CODE_DND_
OFFLINE
)
{
pContext
->
code
=
pHead
->
code
;
rpcProcessConnError
(
pContext
,
NULL
);
rpcFreeCont
(
rpcMsg
.
pCont
);
...
...
source/util/src/terror.c
浏览文件 @
bcad6bb5
...
...
@@ -253,7 +253,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exis
// dnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_ACTION_IN_PROGRESS
,
"Action in progress"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_
EXITING
,
"Dnode is exiting
"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_
OFFLINE
,
"Dnode is offline
"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_INVALID_MSG_LEN
,
"Invalid message length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_DNODE_READ_FILE_ERROR
,
"Read dnode.json error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_DNODE_WRITE_FILE_ERROR
,
"Write dnode.json error"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录