Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cdb3fd24
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看板
提交
cdb3fd24
编写于
1月 06, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
767418e3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
38 deletion
+38
-38
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+37
-37
未找到文件。
include/common/tmsg.h
浏览文件 @
cdb3fd24
...
...
@@ -928,7 +928,7 @@ typedef struct {
char
encrypt
;
char
secret
[
TSDB_PASSWORD_LEN
];
char
ckey
[
TSDB_PASSWORD_LEN
];
}
SAuth
Msg
,
SAuthRsp
;
}
SAuth
Req
,
SAuthRsp
;
typedef
struct
{
int8_t
finished
;
...
...
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
cdb3fd24
...
...
@@ -143,26 +143,26 @@ static void dndInitMsgFp(STransMgmt *pMgmt) {
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_VND_SHOW_TABLES_FETCH
)]
=
dndProcessVnodeFetchMsg
;
}
static
void
dndProcessResponse
(
void
*
parent
,
SRpcMsg
*
p
Msg
,
SEpSet
*
pEpSet
)
{
static
void
dndProcessResponse
(
void
*
parent
,
SRpcMsg
*
p
Rsp
,
SEpSet
*
pEpSet
)
{
SDnode
*
pDnode
=
parent
;
STransMgmt
*
pMgmt
=
&
pDnode
->
tmgmt
;
tmsg_t
msgType
=
p
Msg
->
msgType
;
tmsg_t
msgType
=
p
Rsp
->
msgType
;
if
(
dndGetStat
(
pDnode
)
==
DND_STAT_STOPPED
)
{
if
(
p
Msg
==
NULL
||
pMsg
->
pCont
==
NULL
)
return
;
dTrace
(
"RPC %p, rsp:%s is ignored since dnode is stopping"
,
p
Msg
->
handle
,
TMSG_INFO
(
msgType
));
rpcFreeCont
(
p
Msg
->
pCont
);
if
(
p
Rsp
==
NULL
||
pRsp
->
pCont
==
NULL
)
return
;
dTrace
(
"RPC %p, rsp:%s is ignored since dnode is stopping"
,
p
Rsp
->
handle
,
TMSG_INFO
(
msgType
));
rpcFreeCont
(
p
Rsp
->
pCont
);
return
;
}
DndMsgFp
fp
=
pMgmt
->
msgFp
[
TMSG_INDEX
(
msgType
)];
if
(
fp
!=
NULL
)
{
dTrace
(
"RPC %p, rsp:%s will be processed, code:0x%x"
,
p
Msg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
code
&
0XFFFF
);
(
*
fp
)(
pDnode
,
p
Msg
,
pEpSet
);
dTrace
(
"RPC %p, rsp:%s will be processed, code:0x%x"
,
p
Rsp
->
handle
,
TMSG_INFO
(
msgType
),
pRsp
->
code
&
0XFFFF
);
(
*
fp
)(
pDnode
,
p
Rsp
,
pEpSet
);
}
else
{
dError
(
"RPC %p, rsp:%s not processed"
,
p
Msg
->
handle
,
TMSG_INFO
(
msgType
));
rpcFreeCont
(
p
Msg
->
pCont
);
dError
(
"RPC %p, rsp:%s not processed"
,
p
Rsp
->
handle
,
TMSG_INFO
(
msgType
));
rpcFreeCont
(
p
Rsp
->
pCont
);
}
}
...
...
@@ -201,48 +201,48 @@ static void dndCleanupClient(SDnode *pDnode) {
}
}
static
void
dndProcessRequest
(
void
*
param
,
SRpcMsg
*
p
Msg
,
SEpSet
*
pEpSet
)
{
static
void
dndProcessRequest
(
void
*
param
,
SRpcMsg
*
p
Req
,
SEpSet
*
pEpSet
)
{
SDnode
*
pDnode
=
param
;
STransMgmt
*
pMgmt
=
&
pDnode
->
tmgmt
;
tmsg_t
msgType
=
p
Msg
->
msgType
;
tmsg_t
msgType
=
p
Req
->
msgType
;
if
(
msgType
==
TDMT_DND_NETWORK_TEST
)
{
dTrace
(
"RPC %p, network test req, app:%p will be processed, code:0x%x"
,
p
Msg
->
handle
,
pMsg
->
ahandle
,
pMsg
->
code
);
dndProcessStartupReq
(
pDnode
,
p
Msg
);
dTrace
(
"RPC %p, network test req, app:%p will be processed, code:0x%x"
,
p
Req
->
handle
,
pReq
->
ahandle
,
pReq
->
code
);
dndProcessStartupReq
(
pDnode
,
p
Req
);
return
;
}
if
(
dndGetStat
(
pDnode
)
==
DND_STAT_STOPPED
)
{
dError
(
"RPC %p, req:%s app:%p is ignored since dnode exiting"
,
p
Msg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
p
Msg
->
handle
,
.
code
=
TSDB_CODE_DND_OFFLINE
};
dError
(
"RPC %p, req:%s app:%p is ignored since dnode exiting"
,
p
Req
->
handle
,
TMSG_INFO
(
msgType
),
pReq
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
p
Req
->
handle
,
.
code
=
TSDB_CODE_DND_OFFLINE
};
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
p
Msg
->
pCont
);
rpcFreeCont
(
p
Req
->
pCont
);
return
;
}
else
if
(
dndGetStat
(
pDnode
)
!=
DND_STAT_RUNNING
)
{
dError
(
"RPC %p, req:%s app:%p is ignored since dnode not running"
,
p
Msg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
p
Msg
->
handle
,
.
code
=
TSDB_CODE_APP_NOT_READY
};
dError
(
"RPC %p, req:%s app:%p is ignored since dnode not running"
,
p
Req
->
handle
,
TMSG_INFO
(
msgType
),
pReq
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
p
Req
->
handle
,
.
code
=
TSDB_CODE_APP_NOT_READY
};
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
p
Msg
->
pCont
);
rpcFreeCont
(
p
Req
->
pCont
);
return
;
}
if
(
p
Msg
->
pCont
==
NULL
)
{
dTrace
(
"RPC %p, req:%s app:%p not processed since content is null"
,
p
Msg
->
handle
,
TMSG_INFO
(
msgType
),
p
Msg
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
p
Msg
->
handle
,
.
code
=
TSDB_CODE_DND_INVALID_MSG_LEN
};
if
(
p
Req
->
pCont
==
NULL
)
{
dTrace
(
"RPC %p, req:%s app:%p not processed since content is null"
,
p
Req
->
handle
,
TMSG_INFO
(
msgType
),
p
Req
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
p
Req
->
handle
,
.
code
=
TSDB_CODE_DND_INVALID_MSG_LEN
};
rpcSendResponse
(
&
rspMsg
);
return
;
}
DndMsgFp
fp
=
pMgmt
->
msgFp
[
TMSG_INDEX
(
msgType
)];
if
(
fp
!=
NULL
)
{
dTrace
(
"RPC %p, req:%s app:%p will be processed"
,
p
Msg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
ahandle
);
(
*
fp
)(
pDnode
,
p
Msg
,
pEpSet
);
dTrace
(
"RPC %p, req:%s app:%p will be processed"
,
p
Req
->
handle
,
TMSG_INFO
(
msgType
),
pReq
->
ahandle
);
(
*
fp
)(
pDnode
,
p
Req
,
pEpSet
);
}
else
{
dError
(
"RPC %p, req:%s app:%p is not processed since no handle"
,
p
Msg
->
handle
,
TMSG_INFO
(
msgType
),
pMsg
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
p
Msg
->
handle
,
.
code
=
TSDB_CODE_MSG_NOT_PROCESSED
};
dError
(
"RPC %p, req:%s app:%p is not processed since no handle"
,
p
Req
->
handle
,
TMSG_INFO
(
msgType
),
pReq
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
p
Req
->
handle
,
.
code
=
TSDB_CODE_MSG_NOT_PROCESSED
};
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
p
Msg
->
pCont
);
rpcFreeCont
(
p
Req
->
pCont
);
}
}
...
...
@@ -254,7 +254,7 @@ static void dndSendMsgToMnodeRecv(SDnode *pDnode, SRpcMsg *pRpcMsg, SRpcMsg *pRp
rpcSendRecv
(
pMgmt
->
clientRpc
,
&
epSet
,
pRpcMsg
,
pRpcRsp
);
}
static
int32_t
dndAuthInternal
Msg
(
SDnode
*
pDnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
static
int32_t
dndAuthInternal
Req
(
SDnode
*
pDnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
if
(
strcmp
(
user
,
INTERNAL_USER
)
==
0
)
{
// A simple temporary implementation
char
pass
[
TSDB_PASSWORD_LEN
]
=
{
0
};
...
...
@@ -281,7 +281,7 @@ static int32_t dndAuthInternalMsg(SDnode *pDnode, char *user, char *spi, char *e
static
int32_t
dndRetrieveUserAuthInfo
(
void
*
parent
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
SDnode
*
pDnode
=
parent
;
if
(
dndAuthInternal
Msg
(
parent
,
user
,
spi
,
encrypt
,
secret
,
ckey
)
==
0
)
{
if
(
dndAuthInternal
Req
(
parent
,
user
,
spi
,
encrypt
,
secret
,
ckey
)
==
0
)
{
// dTrace("get internal auth success");
return
0
;
}
...
...
@@ -298,10 +298,10 @@ static int32_t dndRetrieveUserAuthInfo(void *parent, char *user, char *spi, char
// dDebug("user:%s, send auth msg to other mnodes", user);
SAuth
Msg
*
pMsg
=
rpcMallocCont
(
sizeof
(
SAuthMsg
));
tstrncpy
(
p
Msg
->
user
,
user
,
TSDB_USER_LEN
);
SAuth
Req
*
pReq
=
rpcMallocCont
(
sizeof
(
SAuthReq
));
tstrncpy
(
p
Req
->
user
,
user
,
TSDB_USER_LEN
);
SRpcMsg
rpcMsg
=
{.
pCont
=
p
Msg
,
.
contLen
=
sizeof
(
SAuthMsg
),
.
msgType
=
TDMT_MND_AUTH
};
SRpcMsg
rpcMsg
=
{.
pCont
=
p
Req
,
.
contLen
=
sizeof
(
SAuthReq
),
.
msgType
=
TDMT_MND_AUTH
};
SRpcMsg
rpcRsp
=
{
0
};
dndSendMsgToMnodeRecv
(
pDnode
,
&
rpcMsg
,
&
rpcRsp
);
...
...
@@ -381,19 +381,19 @@ void dndCleanupTrans(SDnode *pDnode) {
dInfo
(
"dnode-transport is cleaned up"
);
}
int32_t
dndSendReqToDnode
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
p
Msg
)
{
int32_t
dndSendReqToDnode
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
p
Req
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
tmgmt
;
if
(
pMgmt
->
clientRpc
==
NULL
)
{
terrno
=
TSDB_CODE_DND_OFFLINE
;
return
-
1
;
}
rpcSendRequest
(
pMgmt
->
clientRpc
,
pEpSet
,
p
Msg
,
NULL
);
rpcSendRequest
(
pMgmt
->
clientRpc
,
pEpSet
,
p
Req
,
NULL
);
return
0
;
}
int32_t
dndSendReqToMnode
(
SDnode
*
pDnode
,
SRpcMsg
*
p
Msg
)
{
int32_t
dndSendReqToMnode
(
SDnode
*
pDnode
,
SRpcMsg
*
p
Req
)
{
SEpSet
epSet
=
{
0
};
dndGetMnodeEpSet
(
pDnode
,
&
epSet
);
return
dndSendReqToDnode
(
pDnode
,
&
epSet
,
p
Msg
);
return
dndSendReqToDnode
(
pDnode
,
&
epSet
,
p
Req
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录