Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
50ffa8c4
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看板
未验证
提交
50ffa8c4
编写于
12月 24, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
12月 24, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9374 from taosdata/feature/dnode3
adjust rpc code after change msgtype from int8 to int16
上级
97283ddc
6cd2e96d
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
116 addition
and
114 deletion
+116
-114
include/common/tmsg.h
include/common/tmsg.h
+1
-0
source/dnode/mgmt/impl/src/dndDnode.c
source/dnode/mgmt/impl/src/dndDnode.c
+2
-2
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+85
-85
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+1
-1
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+1
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+4
-4
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+4
-4
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+7
-6
source/libs/transport/inc/rpcHead.h
source/libs/transport/inc/rpcHead.h
+1
-1
source/libs/transport/src/rpcMain.c
source/libs/transport/src/rpcMain.c
+10
-10
未找到文件。
include/common/tmsg.h
浏览文件 @
50ffa8c4
...
@@ -48,6 +48,7 @@ extern int tMsgDict[];
...
@@ -48,6 +48,7 @@ extern int tMsgDict[];
#define TMSG_SEG_CODE(TYPE) (((TYPE)&0xff00) >> 8)
#define TMSG_SEG_CODE(TYPE) (((TYPE)&0xff00) >> 8)
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
#define TMSG_INFO(TYPE) tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)]
#define TMSG_INFO(TYPE) tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)]
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
typedef
uint16_t
tmsg_t
;
typedef
uint16_t
tmsg_t
;
...
...
source/dnode/mgmt/impl/src/dndDnode.c
浏览文件 @
50ffa8c4
...
@@ -63,7 +63,7 @@ void dndGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {
...
@@ -63,7 +63,7 @@ void dndGetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {
}
}
void
dndSendRedirectMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
void
dndSendRedirectMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
int32
_t
msgType
=
pMsg
->
msgType
;
tmsg
_t
msgType
=
pMsg
->
msgType
;
SEpSet
epSet
=
{
0
};
SEpSet
epSet
=
{
0
};
dndGetMnodeEpSet
(
pDnode
,
&
epSet
);
dndGetMnodeEpSet
(
pDnode
,
&
epSet
);
...
@@ -369,7 +369,7 @@ void dndSendStatusMsg(SDnode *pDnode) {
...
@@ -369,7 +369,7 @@ void dndSendStatusMsg(SDnode *pDnode) {
dndGetVnodeLoads
(
pDnode
,
&
pStatus
->
vnodeLoads
);
dndGetVnodeLoads
(
pDnode
,
&
pStatus
->
vnodeLoads
);
contLen
=
sizeof
(
SStatusMsg
)
+
pStatus
->
vnodeLoads
.
num
*
sizeof
(
SVnodeLoad
);
contLen
=
sizeof
(
SStatusMsg
)
+
pStatus
->
vnodeLoads
.
num
*
sizeof
(
SVnodeLoad
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pStatus
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_STATUS
};
SRpcMsg
rpcMsg
=
{.
pCont
=
pStatus
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_STATUS
,
.
ahandle
=
9527
};
pMgmt
->
statusSent
=
1
;
pMgmt
->
statusSent
=
1
;
dTrace
(
"pDnode:%p, send status msg to mnode"
,
pDnode
);
dTrace
(
"pDnode:%p, send status msg to mnode"
,
pDnode
);
...
...
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
50ffa8c4
...
@@ -31,104 +31,104 @@
...
@@ -31,104 +31,104 @@
static
void
dndInitMsgFp
(
STransMgmt
*
pMgmt
)
{
static
void
dndInitMsgFp
(
STransMgmt
*
pMgmt
)
{
// msg from client to dnode
// msg from client to dnode
pMgmt
->
msgFp
[
T
DMT_VND_SUBMIT
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_SUBMIT
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_QUERY
]
=
dndProcessVnodeQueryMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_QUERY
)
]
=
dndProcessVnodeQueryMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_FETCH
]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_FETCH
)
]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_CREATE_TABLE
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CREATE_TABLE
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_DROP_TABLE
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_DROP_TABLE
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_ALTER_TABLE
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_ALTER_TABLE
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_UPDATE_TAG_VAL
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_UPDATE_TAG_VAL
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_TABLE_META
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_TABLE_META
)
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_TABLES_META
]
=
dndProcessVnodeQueryMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_TABLES_META
)
]
=
dndProcessVnodeQueryMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_MQ_QUERY
]
=
dndProcessVnodeQueryMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_MQ_QUERY
)
]
=
dndProcessVnodeQueryMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_MQ_CONSUME
]
=
dndProcessVnodeQueryMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_MQ_CONSUME
)
]
=
dndProcessVnodeQueryMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_MQ_CONNECT
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_MQ_CONNECT
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_MQ_DISCONNECT
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_MQ_DISCONNECT
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_MQ_SET_CUR
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_MQ_SET_CUR
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_RES_READY
]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_RES_READY
)
]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_TASKS_STATUS
]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_TASKS_STATUS
)
]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_CANCEL_TASK
]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_CANCEL_TASK
)
]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_DROP_TASK
]
=
dndProcessVnodeFetchMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_DROP_TASK
)
]
=
dndProcessVnodeFetchMsg
;
// msg from client to mnode
// msg from client to mnode
pMgmt
->
msgFp
[
T
DMT_MND_CONNECT
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CONNECT
)
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_CREATE_ACCT
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CREATE_ACCT
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_ALTER_ACCT
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_ALTER_ACCT
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_DROP_ACCT
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_DROP_ACCT
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_CREATE_USER
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CREATE_USER
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_ALTER_USER
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_ALTER_USER
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_DROP_USER
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_DROP_USER
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_CREATE_DNODE
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CREATE_DNODE
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_CONFIG_DNODE
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CONFIG_DNODE
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_DROP_DNODE
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_DROP_DNODE
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_CREATE_MNODE
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CREATE_MNODE
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_DROP_MNODE
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_DROP_MNODE
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_CREATE_DB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CREATE_DB
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_DROP_DB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_DROP_DB
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_USE_DB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_USE_DB
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_ALTER_DB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_ALTER_DB
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_SYNC_DB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_SYNC_DB
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_COMPACT_DB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_COMPACT_DB
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_CREATE_FUNCTION
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CREATE_FUNCTION
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_RETRIEVE_FUNCTION
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_RETRIEVE_FUNCTION
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_DROP_FUNCTION
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_DROP_FUNCTION
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_CREATE_STB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_CREATE_STB
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_ALTER_STB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_ALTER_STB
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_DROP_STB
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_DROP_STB
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_VGROUP_LIST
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_VGROUP_LIST
)
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_KILL_QUERY
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_KILL_QUERY
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_KILL_CONN
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_KILL_CONN
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_HEARTBEAT
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_HEARTBEAT
)
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_SHOW
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_SHOW
)
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_SHOW_RETRIEVE
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_SHOW_RETRIEVE
)
]
=
dndProcessMnodeReadMsg
;
// message from client to dnode
// message from client to dnode
pMgmt
->
msgFp
[
T
DMT_DND_NETWORK_TEST
]
=
dndProcessDnodeReq
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_NETWORK_TEST
)
]
=
dndProcessDnodeReq
;
// message from mnode to vnode
// message from mnode to vnode
pMgmt
->
msgFp
[
T
DMT_VND_CREATE_STB
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_CREATE_STB
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_CREATE_STB_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_CREATE_STB_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_ALTER_STB
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_ALTER_STB
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_ALTER_STB_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_ALTER_STB_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_DROP_STB
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_DROP_STB
)
]
=
dndProcessVnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_VND_DROP_STB_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_VND_DROP_STB_RSP
)
]
=
dndProcessMnodeWriteMsg
;
// message from mnode to dnode
// message from mnode to dnode
pMgmt
->
msgFp
[
T
DMT_DND_CREATE_VNODE
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_CREATE_VNODE
)
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_CREATE_VNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_CREATE_VNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_ALTER_VNODE
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_ALTER_VNODE
)
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_ALTER_VNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_ALTER_VNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_DROP_VNODE
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_DROP_VNODE
)
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_DROP_VNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_DROP_VNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_SYNC_VNODE
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_SYNC_VNODE
)
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_SYNC_VNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_SYNC_VNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_AUTH_VNODE
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_AUTH_VNODE
)
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_AUTH_VNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_AUTH_VNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_COMPACT_VNODE
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_COMPACT_VNODE
)
]
=
dndProcessVnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_COMPACT_VNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_COMPACT_VNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_CREATE_MNODE
]
=
dndProcessMnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_CREATE_MNODE
)
]
=
dndProcessMnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_CREATE_MNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_CREATE_MNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_ALTER_MNODE
]
=
dndProcessMnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_ALTER_MNODE
)
]
=
dndProcessMnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_ALTER_MNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_ALTER_MNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_DROP_MNODE
]
=
dndProcessMnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_DROP_MNODE
)
]
=
dndProcessMnodeMgmtMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_DROP_MNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_DROP_MNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_DND_CONFIG_DNODE
]
=
dndProcessDnodeReq
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_CONFIG_DNODE
)
]
=
dndProcessDnodeReq
;
pMgmt
->
msgFp
[
T
DMT_DND_CONFIG_DNODE_RSP
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_DND_CONFIG_DNODE_RSP
)
]
=
dndProcessMnodeWriteMsg
;
// message from dnode to mnode
// message from dnode to mnode
pMgmt
->
msgFp
[
T
DMT_MND_GRANT
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_GRANT
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_GRANT_RSP
]
=
dndProcessDnodeRsp
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_GRANT_RSP
)
]
=
dndProcessDnodeRsp
;
pMgmt
->
msgFp
[
T
DMT_MND_STATUS
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_STATUS
)
]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_STATUS_RSP
]
=
dndProcessDnodeRsp
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_STATUS_RSP
)
]
=
dndProcessDnodeRsp
;
pMgmt
->
msgFp
[
T
DMT_MND_AUTH
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_AUTH
)
]
=
dndProcessMnodeReadMsg
;
pMgmt
->
msgFp
[
T
DMT_MND_AUTH_RSP
]
=
dndProcessDnodeRsp
;
pMgmt
->
msgFp
[
T
MSG_INDEX
(
TDMT_MND_AUTH_RSP
)
]
=
dndProcessDnodeRsp
;
}
}
static
void
dndProcessResponse
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
static
void
dndProcessResponse
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SDnode
*
pDnode
=
parent
;
SDnode
*
pDnode
=
parent
;
STransMgmt
*
pMgmt
=
&
pDnode
->
tmgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
tmgmt
;
int32
_t
msgType
=
pMsg
->
msgType
;
tmsg
_t
msgType
=
pMsg
->
msgType
;
if
(
dndGetStat
(
pDnode
)
==
DND_STAT_STOPPED
)
{
if
(
dndGetStat
(
pDnode
)
==
DND_STAT_STOPPED
)
{
if
(
pMsg
==
NULL
||
pMsg
->
pCont
==
NULL
)
return
;
if
(
pMsg
==
NULL
||
pMsg
->
pCont
==
NULL
)
return
;
...
@@ -137,7 +137,7 @@ static void dndProcessResponse(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
...
@@ -137,7 +137,7 @@ static void dndProcessResponse(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
return
;
return
;
}
}
DndMsgFp
fp
=
pMgmt
->
msgFp
[
msgType
];
DndMsgFp
fp
=
pMgmt
->
msgFp
[
TMSG_INDEX
(
msgType
)
];
if
(
fp
!=
NULL
)
{
if
(
fp
!=
NULL
)
{
(
*
fp
)(
pDnode
,
pMsg
,
pEpSet
);
(
*
fp
)(
pDnode
,
pMsg
,
pEpSet
);
dTrace
(
"RPC %p, rsp:%s is processed, code:0x%x"
,
pMsg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
code
&
0XFFFF
);
dTrace
(
"RPC %p, rsp:%s is processed, code:0x%x"
,
pMsg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
code
&
0XFFFF
);
...
@@ -186,7 +186,7 @@ static void dndProcessRequest(void *param, SRpcMsg *pMsg, SEpSet *pEpSet) {
...
@@ -186,7 +186,7 @@ static void dndProcessRequest(void *param, SRpcMsg *pMsg, SEpSet *pEpSet) {
SDnode
*
pDnode
=
param
;
SDnode
*
pDnode
=
param
;
STransMgmt
*
pMgmt
=
&
pDnode
->
tmgmt
;
STransMgmt
*
pMgmt
=
&
pDnode
->
tmgmt
;
int32
_t
msgType
=
pMsg
->
msgType
;
tmsg
_t
msgType
=
pMsg
->
msgType
;
if
(
msgType
==
TDMT_DND_NETWORK_TEST
)
{
if
(
msgType
==
TDMT_DND_NETWORK_TEST
)
{
dTrace
(
"RPC %p, network test req, app:%p will be processed, code:0x%x"
,
pMsg
->
handle
,
pMsg
->
ahandle
,
pMsg
->
code
);
dTrace
(
"RPC %p, network test req, app:%p will be processed, code:0x%x"
,
pMsg
->
handle
,
pMsg
->
ahandle
,
pMsg
->
code
);
dndProcessDnodeReq
(
pDnode
,
pMsg
,
pEpSet
);
dndProcessDnodeReq
(
pDnode
,
pMsg
,
pEpSet
);
...
@@ -214,7 +214,7 @@ static void dndProcessRequest(void *param, SRpcMsg *pMsg, SEpSet *pEpSet) {
...
@@ -214,7 +214,7 @@ static void dndProcessRequest(void *param, SRpcMsg *pMsg, SEpSet *pEpSet) {
return
;
return
;
}
}
DndMsgFp
fp
=
pMgmt
->
msgFp
[
msgType
];
DndMsgFp
fp
=
pMgmt
->
msgFp
[
TMSG_INDEX
(
msgType
)
];
if
(
fp
!=
NULL
)
{
if
(
fp
!=
NULL
)
{
dTrace
(
"RPC %p, req:%s app:%p will be processed"
,
pMsg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
ahandle
);
dTrace
(
"RPC %p, req:%s app:%p will be processed"
,
pMsg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
ahandle
);
(
*
fp
)(
pDnode
,
pMsg
,
pEpSet
);
(
*
fp
)(
pDnode
,
pMsg
,
pEpSet
);
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
50ffa8c4
...
@@ -87,7 +87,7 @@ typedef struct SMnode {
...
@@ -87,7 +87,7 @@ typedef struct SMnode {
void
mndSendMsgToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
rpcMsg
);
void
mndSendMsgToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
rpcMsg
);
void
mndSendMsgToMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
);
void
mndSendMsgToMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
);
void
mndSendRedirectMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
);
void
mndSendRedirectMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
);
void
mndSetMsgHandle
(
SMnode
*
pMnode
,
int32
_t
msgType
,
MndMsgFp
fp
);
void
mndSetMsgHandle
(
SMnode
*
pMnode
,
tmsg
_t
msgType
,
MndMsgFp
fp
);
uint64_t
mndGenerateUid
(
char
*
name
,
int32_t
len
)
;
uint64_t
mndGenerateUid
(
char
*
name
,
int32_t
len
)
;
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
50ffa8c4
...
@@ -24,7 +24,7 @@ extern "C" {
...
@@ -24,7 +24,7 @@ extern "C" {
typedef
struct
{
typedef
struct
{
SEpSet
epSet
;
SEpSet
epSet
;
int8
_t
msgType
;
tmsg
_t
msgType
;
int8_t
msgSent
;
int8_t
msgSent
;
int8_t
msgReceived
;
int8_t
msgReceived
;
int32_t
errCode
;
int32_t
errCode
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
50ffa8c4
...
@@ -550,10 +550,10 @@ static int32_t mndSetUpdateDbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pO
...
@@ -550,10 +550,10 @@ static int32_t mndSetUpdateDbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pO
}
}
static
int32_t
mndSetUpdateDbCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pOldDb
,
SDbObj
*
pNewDb
)
{
static
int32_t
mndSetUpdateDbCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pOldDb
,
SDbObj
*
pNewDb
)
{
SSdbRaw
*
p
Redo
Raw
=
mndDbActionEncode
(
pNewDb
);
SSdbRaw
*
p
Commit
Raw
=
mndDbActionEncode
(
pNewDb
);
if
(
p
Redo
Raw
==
NULL
)
return
-
1
;
if
(
p
Commit
Raw
==
NULL
)
return
-
1
;
if
(
mndTransAppend
Redolog
(
pTrans
,
pRedo
Raw
)
!=
0
)
return
-
1
;
if
(
mndTransAppend
Commitlog
(
pTrans
,
pCommit
Raw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_READY
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_READY
)
!=
0
)
return
-
1
;
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
50ffa8c4
...
@@ -132,7 +132,7 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
...
@@ -132,7 +132,7 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
for
(
int32_t
i
=
0
;
i
<
redoActionNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
redoActionNum
;
++
i
)
{
STransAction
*
pAction
=
taosArrayGet
(
pTrans
->
redoActions
,
i
);
STransAction
*
pAction
=
taosArrayGet
(
pTrans
->
redoActions
,
i
);
SDB_SET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
&
pAction
->
epSet
,
sizeof
(
SEpSet
));
SDB_SET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
&
pAction
->
epSet
,
sizeof
(
SEpSet
));
SDB_SET_INT
8
(
pRaw
,
dataPos
,
pAction
->
msgType
)
SDB_SET_INT
16
(
pRaw
,
dataPos
,
pAction
->
msgType
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pAction
->
contLen
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pAction
->
contLen
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pAction
->
pCont
,
pAction
->
contLen
);
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pAction
->
pCont
,
pAction
->
contLen
);
}
}
...
@@ -140,7 +140,7 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
...
@@ -140,7 +140,7 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
for
(
int32_t
i
=
0
;
i
<
undoActionNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
undoActionNum
;
++
i
)
{
STransAction
*
pAction
=
taosArrayGet
(
pTrans
->
undoActions
,
i
);
STransAction
*
pAction
=
taosArrayGet
(
pTrans
->
undoActions
,
i
);
SDB_SET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
&
pAction
->
epSet
,
sizeof
(
SEpSet
));
SDB_SET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
&
pAction
->
epSet
,
sizeof
(
SEpSet
));
SDB_SET_INT
8
(
pRaw
,
dataPos
,
pAction
->
msgType
)
SDB_SET_INT
16
(
pRaw
,
dataPos
,
pAction
->
msgType
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pAction
->
contLen
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pAction
->
contLen
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
pAction
->
pCont
,
pAction
->
contLen
);
SDB_SET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
pAction
->
pCont
,
pAction
->
contLen
);
}
}
...
@@ -243,7 +243,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
...
@@ -243,7 +243,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
for
(
int32_t
i
=
0
;
i
<
redoActionNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
redoActionNum
;
++
i
)
{
STransAction
action
=
{
0
};
STransAction
action
=
{
0
};
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
(
void
*
)
&
action
.
epSet
,
sizeof
(
SEpSet
));
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
(
void
*
)
&
action
.
epSet
,
sizeof
(
SEpSet
));
SDB_GET_INT
8
(
pRaw
,
pRow
,
dataPos
,
&
action
.
msgType
)
SDB_GET_INT
16
(
pRaw
,
pRow
,
dataPos
,
&
action
.
msgType
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
action
.
contLen
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
action
.
contLen
)
action
.
pCont
=
malloc
(
action
.
contLen
);
action
.
pCont
=
malloc
(
action
.
contLen
);
if
(
action
.
pCont
==
NULL
)
{
if
(
action
.
pCont
==
NULL
)
{
...
@@ -262,7 +262,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
...
@@ -262,7 +262,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
for
(
int32_t
i
=
0
;
i
<
undoActionNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
undoActionNum
;
++
i
)
{
STransAction
action
=
{
0
};
STransAction
action
=
{
0
};
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
(
void
*
)
&
action
.
epSet
,
sizeof
(
SEpSet
));
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
(
void
*
)
&
action
.
epSet
,
sizeof
(
SEpSet
));
SDB_GET_INT
8
(
pRaw
,
pRow
,
dataPos
,
&
action
.
msgType
)
SDB_GET_INT
16
(
pRaw
,
pRow
,
dataPos
,
&
action
.
msgType
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
action
.
contLen
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
action
.
contLen
)
action
.
pCont
=
malloc
(
action
.
contLen
);
action
.
pCont
=
malloc
(
action
.
contLen
);
if
(
action
.
pCont
==
NULL
)
{
if
(
action
.
pCont
==
NULL
)
{
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
50ffa8c4
...
@@ -374,7 +374,7 @@ void mndSendRsp(SMnodeMsg *pMsg, int32_t code) {
...
@@ -374,7 +374,7 @@ void mndSendRsp(SMnodeMsg *pMsg, int32_t code) {
static
void
mndProcessRpcMsg
(
SMnodeMsg
*
pMsg
)
{
static
void
mndProcessRpcMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
int32_t
code
=
0
;
int32_t
code
=
0
;
int32_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
tmsg_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
void
*
ahandle
=
pMsg
->
rpcMsg
.
ahandle
;
void
*
ahandle
=
pMsg
->
rpcMsg
.
ahandle
;
bool
isReq
=
(
msgType
&
1U
);
bool
isReq
=
(
msgType
&
1U
);
...
@@ -392,10 +392,10 @@ static void mndProcessRpcMsg(SMnodeMsg *pMsg) {
...
@@ -392,10 +392,10 @@ static void mndProcessRpcMsg(SMnodeMsg *pMsg) {
goto
PROCESS_RPC_END
;
goto
PROCESS_RPC_END
;
}
}
MndMsgFp
fp
=
pMnode
->
msgFp
[
msgType
];
MndMsgFp
fp
=
pMnode
->
msgFp
[
TMSG_INDEX
(
msgType
)
];
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
code
=
TSDB_CODE_MSG_NOT_PROCESSED
;
code
=
TSDB_CODE_MSG_NOT_PROCESSED
;
mError
(
"msg:%p, app:%p failed to process since no
t
handle"
,
pMsg
,
ahandle
);
mError
(
"msg:%p, app:%p failed to process since no handle"
,
pMsg
,
ahandle
);
goto
PROCESS_RPC_END
;
goto
PROCESS_RPC_END
;
}
}
...
@@ -425,9 +425,10 @@ PROCESS_RPC_END:
...
@@ -425,9 +425,10 @@ PROCESS_RPC_END:
}
}
}
}
void
mndSetMsgHandle
(
SMnode
*
pMnode
,
int32_t
msgType
,
MndMsgFp
fp
)
{
void
mndSetMsgHandle
(
SMnode
*
pMnode
,
tmsg_t
msgType
,
MndMsgFp
fp
)
{
if
(
msgType
>=
0
&&
msgType
<
TDMT_MAX
)
{
tmsg_t
type
=
TMSG_INDEX
(
msgType
);
pMnode
->
msgFp
[
msgType
]
=
fp
;
if
(
type
>=
0
&&
type
<
TDMT_MAX
)
{
pMnode
->
msgFp
[
type
]
=
fp
;
}
}
}
}
...
...
source/libs/transport/inc/rpcHead.h
浏览文件 @
50ffa8c4
...
@@ -52,7 +52,7 @@ typedef struct {
...
@@ -52,7 +52,7 @@ typedef struct {
char
user
[
TSDB_UNI_LEN
];
// user ID
char
user
[
TSDB_UNI_LEN
];
// user ID
uint16_t
port
;
// for UDP only, port may be changed
uint16_t
port
;
// for UDP only, port may be changed
char
empty
[
1
];
// reserved
char
empty
[
1
];
// reserved
uint
8_t
msgType
;
// message type
uint
16_t
msgType
;
// message type
int32_t
msgLen
;
// message length including the header iteslf
int32_t
msgLen
;
// message length including the header iteslf
uint32_t
msgVer
;
uint32_t
msgVer
;
int32_t
code
;
// code in response message
int32_t
code
;
// code in response message
...
...
source/libs/transport/src/rpcMain.c
浏览文件 @
50ffa8c4
...
@@ -74,7 +74,7 @@ typedef struct {
...
@@ -74,7 +74,7 @@ typedef struct {
SEpSet
epSet
;
// ip list provided by app
SEpSet
epSet
;
// ip list provided by app
void
*
ahandle
;
// handle provided by app
void
*
ahandle
;
// handle provided by app
struct
SRpcConn
*
pConn
;
// pConn allocated
struct
SRpcConn
*
pConn
;
// pConn allocated
char
msgType
;
// message type
tmsg_t
msgType
;
// message type
uint8_t
*
pCont
;
// content provided by app
uint8_t
*
pCont
;
// content provided by app
int32_t
contLen
;
// content length
int32_t
contLen
;
// content length
int32_t
code
;
// error code
int32_t
code
;
// error code
...
@@ -108,8 +108,8 @@ typedef struct SRpcConn {
...
@@ -108,8 +108,8 @@ typedef struct SRpcConn {
uint16_t
tranId
;
// outgoing transcation ID, for build message
uint16_t
tranId
;
// outgoing transcation ID, for build message
uint16_t
outTranId
;
// outgoing transcation ID
uint16_t
outTranId
;
// outgoing transcation ID
uint16_t
inTranId
;
// transcation ID for incoming msg
uint16_t
inTranId
;
// transcation ID for incoming msg
uint8_t
outType
;
// message type for outgoing request
tmsg_t
outType
;
// message type for outgoing request
uint8_t
inType
;
// message type for incoming request
tmsg_t
inType
;
// message type for incoming request
void
*
chandle
;
// handle passed by TCP/UDP connection layer
void
*
chandle
;
// handle passed by TCP/UDP connection layer
void
*
ahandle
;
// handle provided by upper app layter
void
*
ahandle
;
// handle provided by upper app layter
int
retry
;
// number of retry for sending request
int
retry
;
// number of retry for sending request
...
@@ -409,7 +409,7 @@ void rpcSendRequest(void *shandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t
...
@@ -409,7 +409,7 @@ void rpcSendRequest(void *shandle, const SEpSet *pEpSet, SRpcMsg *pMsg, int64_t
// connection type is application specific.
// connection type is application specific.
// for TDengine, all the query, show commands shall have TCP connection
// for TDengine, all the query, show commands shall have TCP connection
char
type
=
pMsg
->
msgType
;
tmsg_t
type
=
pMsg
->
msgType
;
if
(
type
==
TDMT_VND_QUERY
||
type
==
TDMT_MND_SHOW_RETRIEVE
if
(
type
==
TDMT_VND_QUERY
||
type
==
TDMT_MND_SHOW_RETRIEVE
||
type
==
TDMT_VND_FETCH
||
type
==
TDMT_MND_VGROUP_LIST
||
type
==
TDMT_VND_FETCH
||
type
==
TDMT_MND_VGROUP_LIST
||
type
==
TDMT_VND_TABLES_META
||
type
==
TDMT_VND_TABLE_META
||
type
==
TDMT_VND_TABLES_META
||
type
==
TDMT_VND_TABLE_META
...
@@ -957,7 +957,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv, SRpcReqCont
...
@@ -957,7 +957,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv, SRpcReqCont
sid
=
htonl
(
pHead
->
destId
);
sid
=
htonl
(
pHead
->
destId
);
*
ppContext
=
NULL
;
*
ppContext
=
NULL
;
if
(
pHead
->
msgType
>=
TDMT_MAX
||
pHead
->
msgType
<=
0
)
{
if
(
TMSG_INDEX
(
pHead
->
msgType
)
>=
TDMT_MAX
||
TMSG_INDEX
(
pHead
->
msgType
)
<=
0
)
{
tDebug
(
"%s sid:%d, invalid message type:%d"
,
pRpc
->
label
,
sid
,
pHead
->
msgType
);
tDebug
(
"%s sid:%d, invalid message type:%d"
,
pRpc
->
label
,
sid
,
pHead
->
msgType
);
terrno
=
TSDB_CODE_RPC_INVALID_MSG_TYPE
;
return
NULL
;
terrno
=
TSDB_CODE_RPC_INVALID_MSG_TYPE
;
return
NULL
;
}
}
...
@@ -1094,7 +1094,7 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
...
@@ -1094,7 +1094,7 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
SRpcReqContext
*
pContext
;
SRpcReqContext
*
pContext
;
pConn
=
rpcProcessMsgHead
(
pRpc
,
pRecv
,
&
pContext
);
pConn
=
rpcProcessMsgHead
(
pRpc
,
pRecv
,
&
pContext
);
if
(
pHead
->
msgType
>=
1
&&
pHead
->
msgType
<
TDMT_MAX
)
{
if
(
TMSG_INDEX
(
pHead
->
msgType
)
>=
1
&&
TMSG_INDEX
(
pHead
->
msgType
)
<
TDMT_MAX
)
{
tDebug
(
"%s %p %p, %s received from 0x%x:%hu, parse code:0x%x len:%d sig:0x%08x:0x%08x:%d code:0x%x"
,
pRpc
->
label
,
tDebug
(
"%s %p %p, %s received from 0x%x:%hu, parse code:0x%x len:%d sig:0x%08x:0x%08x:%d code:0x%x"
,
pRpc
->
label
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
TMSG_INFO
(
pHead
->
msgType
),
pRecv
->
ip
,
pRecv
->
port
,
terrno
,
pRecv
->
msgLen
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
TMSG_INFO
(
pHead
->
msgType
),
pRecv
->
ip
,
pRecv
->
port
,
terrno
,
pRecv
->
msgLen
,
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
,
pHead
->
code
);
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
,
pHead
->
code
);
...
@@ -1112,11 +1112,11 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
...
@@ -1112,11 +1112,11 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
if
(
code
==
TSDB_CODE_RPC_INVALID_TIME_STAMP
||
code
==
TSDB_CODE_RPC_AUTH_FAILURE
)
{
if
(
code
==
TSDB_CODE_RPC_INVALID_TIME_STAMP
||
code
==
TSDB_CODE_RPC_AUTH_FAILURE
)
{
rpcCloseConn
(
pConn
);
rpcCloseConn
(
pConn
);
}
}
if
(
pHead
->
msgType
+
1
>
1
&&
pHead
->
msgType
+
1
<
TDMT_MAX
)
{
if
(
TMSG_INDEX
(
pHead
->
msgType
)
+
1
>
1
&&
TMSG_INDEX
(
pHead
->
msgType
)
+
1
<
TDMT_MAX
)
{
tDebug
(
"%s %p %p, %s is sent with error code:0x%x"
,
pRpc
->
label
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
TMSG_INFO
(
pHead
->
msgType
+
1
),
code
);
tDebug
(
"%s %p %p, %s is sent with error code:0x%x"
,
pRpc
->
label
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
TMSG_INFO
(
pHead
->
msgType
+
1
),
code
);
}
else
{
}
else
{
tError
(
"%s %p %p, %s is sent with error code:0x%x"
,
pRpc
->
label
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
TMSG_INFO
(
pHead
->
msgType
),
code
);
tError
(
"%s %p %p, %s is sent with error code:0x%x"
,
pRpc
->
label
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
TMSG_INFO
(
pHead
->
msgType
),
code
);
}
}
}
}
}
else
{
// msg is passed to app only parsing is ok
}
else
{
// msg is passed to app only parsing is ok
rpcProcessIncomingMsg
(
pConn
,
pHead
,
pContext
);
rpcProcessIncomingMsg
(
pConn
,
pHead
,
pContext
);
...
@@ -1262,7 +1262,7 @@ static void rpcSendErrorMsgToPeer(SRecvInfo *pRecv, int32_t code) {
...
@@ -1262,7 +1262,7 @@ static void rpcSendErrorMsgToPeer(SRecvInfo *pRecv, int32_t code) {
memset
(
msg
,
0
,
sizeof
(
SRpcHead
));
memset
(
msg
,
0
,
sizeof
(
SRpcHead
));
pReplyHead
->
version
=
pRecvHead
->
version
;
pReplyHead
->
version
=
pRecvHead
->
version
;
pReplyHead
->
msgType
=
(
char
)(
pRecvHead
->
msgType
+
1
);
pReplyHead
->
msgType
=
(
tmsg_t
)(
pRecvHead
->
msgType
+
1
);
pReplyHead
->
spi
=
0
;
pReplyHead
->
spi
=
0
;
pReplyHead
->
encrypt
=
pRecvHead
->
encrypt
;
pReplyHead
->
encrypt
=
pRecvHead
->
encrypt
;
pReplyHead
->
tranId
=
pRecvHead
->
tranId
;
pReplyHead
->
tranId
=
pRecvHead
->
tranId
;
...
@@ -1292,7 +1292,7 @@ static void rpcSendReqToServer(SRpcInfo *pRpc, SRpcReqContext *pContext) {
...
@@ -1292,7 +1292,7 @@ static void rpcSendReqToServer(SRpcInfo *pRpc, SRpcReqContext *pContext) {
SRpcHead
*
pHead
=
rpcHeadFromCont
(
pContext
->
pCont
);
SRpcHead
*
pHead
=
rpcHeadFromCont
(
pContext
->
pCont
);
char
*
msg
=
(
char
*
)
pHead
;
char
*
msg
=
(
char
*
)
pHead
;
int
msgLen
=
rpcMsgLenFromCont
(
pContext
->
contLen
);
int
msgLen
=
rpcMsgLenFromCont
(
pContext
->
contLen
);
char
msgType
=
pContext
->
msgType
;
tmsg_t
msgType
=
pContext
->
msgType
;
pContext
->
numOfTry
++
;
pContext
->
numOfTry
++
;
SRpcConn
*
pConn
=
rpcSetupConnToServer
(
pContext
);
SRpcConn
*
pConn
=
rpcSetupConnToServer
(
pContext
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录