Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ee06bac1
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看板
提交
ee06bac1
编写于
5月 18, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into fix/hzcheng_3.0
上级
8b6aa46d
b99dd9bd
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
33 addition
and
95 deletion
+33
-95
include/common/tmsgcb.h
include/common/tmsgcb.h
+3
-3
source/common/src/tmsgcb.c
source/common/src/tmsgcb.c
+14
-14
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+2
-3
source/dnode/mgmt/node_mgmt/src/dmNodes.c
source/dnode/mgmt/node_mgmt/src/dmNodes.c
+1
-1
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+0
-61
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+1
-2
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+11
-10
source/dnode/mnode/impl/test/trans/trans2.cpp
source/dnode/mnode/impl/test/trans/trans2.cpp
+1
-1
未找到文件。
include/common/tmsgcb.h
浏览文件 @
ee06bac1
...
...
@@ -60,9 +60,9 @@ typedef struct {
ReportStartup
reportStartupFp
;
}
SMsgCb
;
void
tmsgSetDefault
MsgCb
(
const
SMsgCb
*
pMsgC
b
);
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
pMsgC
b
,
EQueueType
qtype
,
SRpcMsg
*
pMsg
);
int32_t
tmsgGetQueueSize
(
const
SMsgCb
*
pMsgC
b
,
int32_t
vgId
,
EQueueType
qtype
);
void
tmsgSetDefault
(
const
SMsgCb
*
msgc
b
);
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
msgc
b
,
EQueueType
qtype
,
SRpcMsg
*
pMsg
);
int32_t
tmsgGetQueueSize
(
const
SMsgCb
*
msgc
b
,
int32_t
vgId
,
EQueueType
qtype
);
int32_t
tmsgSendReq
(
const
SEpSet
*
epSet
,
SRpcMsg
*
pMsg
);
void
tmsgSendRsp
(
SRpcMsg
*
pMsg
);
void
tmsgSendRedirectRsp
(
SRpcMsg
*
pMsg
,
const
SEpSet
*
pNewEpSet
);
...
...
source/common/src/tmsgcb.c
浏览文件 @
ee06bac1
...
...
@@ -17,46 +17,46 @@
#include "tmsgcb.h"
#include "taoserror.h"
static
SMsgCb
tsD
efaultMsgCb
;
static
SMsgCb
d
efaultMsgCb
;
void
tmsgSetDefault
MsgCb
(
const
SMsgCb
*
pMsgCb
)
{
tsDefaultMsgCb
=
*
pMsgC
b
;
}
void
tmsgSetDefault
(
const
SMsgCb
*
msgcb
)
{
defaultMsgCb
=
*
msgc
b
;
}
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
pMsgC
b
,
EQueueType
qtype
,
SRpcMsg
*
pMsg
)
{
PutToQueueFp
fp
=
pMsgC
b
->
queueFps
[
qtype
];
return
(
*
fp
)(
pMsgC
b
->
mgmt
,
pMsg
);
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
msgc
b
,
EQueueType
qtype
,
SRpcMsg
*
pMsg
)
{
PutToQueueFp
fp
=
msgc
b
->
queueFps
[
qtype
];
return
(
*
fp
)(
msgc
b
->
mgmt
,
pMsg
);
}
int32_t
tmsgGetQueueSize
(
const
SMsgCb
*
pMsgC
b
,
int32_t
vgId
,
EQueueType
qtype
)
{
GetQueueSizeFp
fp
=
pMsgC
b
->
qsizeFp
;
return
(
*
fp
)(
pMsgC
b
->
mgmt
,
vgId
,
qtype
);
int32_t
tmsgGetQueueSize
(
const
SMsgCb
*
msgc
b
,
int32_t
vgId
,
EQueueType
qtype
)
{
GetQueueSizeFp
fp
=
msgc
b
->
qsizeFp
;
return
(
*
fp
)(
msgc
b
->
mgmt
,
vgId
,
qtype
);
}
int32_t
tmsgSendReq
(
const
SEpSet
*
epSet
,
SRpcMsg
*
pMsg
)
{
SendReqFp
fp
=
tsD
efaultMsgCb
.
sendReqFp
;
SendReqFp
fp
=
d
efaultMsgCb
.
sendReqFp
;
return
(
*
fp
)(
epSet
,
pMsg
);
}
void
tmsgSendRsp
(
SRpcMsg
*
pMsg
)
{
SendRspFp
fp
=
tsD
efaultMsgCb
.
sendRspFp
;
SendRspFp
fp
=
d
efaultMsgCb
.
sendRspFp
;
return
(
*
fp
)(
pMsg
);
}
void
tmsgSendRedirectRsp
(
SRpcMsg
*
pMsg
,
const
SEpSet
*
pNewEpSet
)
{
SendRedirectRspFp
fp
=
tsD
efaultMsgCb
.
sendRedirectRspFp
;
SendRedirectRspFp
fp
=
d
efaultMsgCb
.
sendRedirectRspFp
;
(
*
fp
)(
pMsg
,
pNewEpSet
);
}
void
tmsgRegisterBrokenLinkArg
(
SRpcMsg
*
pMsg
)
{
RegisterBrokenLinkArgFp
fp
=
tsD
efaultMsgCb
.
registerBrokenLinkArgFp
;
RegisterBrokenLinkArgFp
fp
=
d
efaultMsgCb
.
registerBrokenLinkArgFp
;
(
*
fp
)(
pMsg
);
}
void
tmsgReleaseHandle
(
SRpcHandleInfo
*
pHandle
,
int8_t
type
)
{
ReleaseHandleFp
fp
=
tsD
efaultMsgCb
.
releaseHandleFp
;
ReleaseHandleFp
fp
=
d
efaultMsgCb
.
releaseHandleFp
;
(
*
fp
)(
pHandle
,
type
);
}
void
tmsgReportStartup
(
const
char
*
name
,
const
char
*
desc
)
{
ReportStartup
fp
=
tsD
efaultMsgCb
.
reportStartupFp
;
ReportStartup
fp
=
d
efaultMsgCb
.
reportStartupFp
;
(
*
fp
)(
name
,
desc
);
}
\ No newline at end of file
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
浏览文件 @
ee06bac1
...
...
@@ -275,7 +275,7 @@ static void dmGetServerStartupStatus(SDnode *pDnode, SServerStatusRsp *pStatus)
}
void
dmProcessNetTestReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
dDebug
(
"
start to process net test req"
);
dDebug
(
"
msg:%p, net test req will be processed"
,
pMsg
);
SRpcMsg
rsp
=
{.
code
=
0
,
.
info
=
pMsg
->
info
};
rsp
.
pCont
=
rpcMallocCont
(
pMsg
->
contLen
);
if
(
rsp
.
pCont
==
NULL
)
{
...
...
@@ -287,8 +287,7 @@ void dmProcessNetTestReq(SDnode *pDnode, SRpcMsg *pMsg) {
}
void
dmProcessServerStartupStatus
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
dDebug
(
"start to process server startup status req"
);
dDebug
(
"msg:%p, server startup status req will be processed"
,
pMsg
);
SServerStatusRsp
statusRsp
=
{
0
};
dmGetServerStartupStatus
(
pDnode
,
&
statusRsp
);
...
...
source/dnode/mgmt/node_mgmt/src/dmNodes.c
浏览文件 @
ee06bac1
...
...
@@ -78,7 +78,7 @@ int32_t dmOpenNode(SMgmtWrapper *pWrapper) {
SMgmtInputOpt
input
=
dmBuildMgmtInputOpt
(
pWrapper
);
if
(
pWrapper
->
ntype
==
DNODE
||
InChildProc
(
pWrapper
))
{
tmsgSetDefault
MsgCb
(
&
input
.
msgCb
);
tmsgSetDefault
(
&
input
.
msgCb
);
}
if
(
OnlyInSingleProc
(
pWrapper
))
{
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
ee06bac1
...
...
@@ -344,66 +344,6 @@ void dmCleanupClient(SDnode *pDnode) {
}
}
static
inline
int32_t
dmGetHideUserAuth
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
int32_t
code
=
0
;
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
if
(
strcmp
(
user
,
INTERNAL_USER
)
==
0
)
{
taosEncryptPass_c
((
uint8_t
*
)(
INTERNAL_SECRET
),
strlen
(
INTERNAL_SECRET
),
pass
);
}
else
if
(
strcmp
(
user
,
TSDB_NETTEST_USER
)
==
0
)
{
taosEncryptPass_c
((
uint8_t
*
)(
TSDB_NETTEST_USER
),
strlen
(
TSDB_NETTEST_USER
),
pass
);
}
else
{
code
=
-
1
;
}
if
(
code
==
0
)
{
memcpy
(
secret
,
pass
,
TSDB_PASSWORD_LEN
);
*
spi
=
1
;
*
encrypt
=
0
;
*
ckey
=
0
;
}
return
code
;
}
static
inline
int32_t
dmRetrieveUserAuthInfo
(
SDnode
*
pDnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
if
(
dmGetHideUserAuth
(
user
,
spi
,
encrypt
,
secret
,
ckey
)
==
0
)
{
dTrace
(
"user:%s, get auth from mnode, spi:%d encrypt:%d"
,
user
,
*
spi
,
*
encrypt
);
return
0
;
}
SAuthReq
authReq
=
{
0
};
tstrncpy
(
authReq
.
user
,
user
,
TSDB_USER_LEN
);
int32_t
contLen
=
tSerializeSAuthReq
(
NULL
,
0
,
&
authReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSAuthReq
(
pReq
,
contLen
,
&
authReq
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pReq
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_AUTH
,
.
info
.
ahandle
=
(
void
*
)
9528
};
SRpcMsg
rpcRsp
=
{
0
};
SEpSet
epSet
=
{
0
};
dTrace
(
"user:%s, send user auth req to other mnodes, spi:%d encrypt:%d"
,
user
,
authReq
.
spi
,
authReq
.
encrypt
);
dmGetMnodeEpSet
(
&
pDnode
->
data
,
&
epSet
);
dmSendRecv
(
&
epSet
,
&
rpcMsg
,
&
rpcRsp
);
if
(
rpcRsp
.
code
!=
0
)
{
terrno
=
rpcRsp
.
code
;
dError
(
"user:%s, failed to get user auth from other mnodes since %s"
,
user
,
terrstr
());
}
else
{
SAuthRsp
authRsp
=
{
0
};
tDeserializeSAuthReq
(
rpcRsp
.
pCont
,
rpcRsp
.
contLen
,
&
authRsp
);
memcpy
(
secret
,
authRsp
.
secret
,
TSDB_PASSWORD_LEN
);
memcpy
(
ckey
,
authRsp
.
ckey
,
TSDB_PASSWORD_LEN
);
*
spi
=
authRsp
.
spi
;
*
encrypt
=
authRsp
.
encrypt
;
dTrace
(
"user:%s, success to get user auth from other mnodes, spi:%d encrypt:%d"
,
user
,
authRsp
.
spi
,
authRsp
.
encrypt
);
}
rpcFreeCont
(
rpcRsp
.
pCont
);
return
rpcRsp
.
code
;
}
int32_t
dmInitServer
(
SDnode
*
pDnode
)
{
SDnodeTrans
*
pTrans
=
&
pDnode
->
trans
;
...
...
@@ -416,7 +356,6 @@ int32_t dmInitServer(SDnode *pDnode) {
rpcInit
.
sessions
=
tsMaxShellConns
;
rpcInit
.
connType
=
TAOS_CONN_SERVER
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
afp
=
(
RpcAfp
)
dmRetrieveUserAuthInfo
;
rpcInit
.
parent
=
pDnode
;
pTrans
->
serverRpc
=
rpcOpen
(
&
rpcInit
);
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
ee06bac1
...
...
@@ -197,8 +197,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
goto
CONN_OVER
;
}
if
(
0
!=
strncmp
(
connReq
.
passwd
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
-
1
))
{
mError
(
"user:%s, failed to auth while acquire user, input:%s saved:%s"
,
pReq
->
conn
.
user
,
connReq
.
passwd
,
pUser
->
pass
);
mError
(
"user:%s, failed to auth while acquire user, input:%s"
,
pReq
->
conn
.
user
,
connReq
.
passwd
);
code
=
TSDB_CODE_RPC_AUTH_FAILURE
;
goto
CONN_OVER
;
}
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
ee06bac1
...
...
@@ -343,19 +343,20 @@ void mndStop(SMnode *pMnode) { return mndCleanupTimer(pMnode); }
int32_t
mndProcessMsg
(
SRpcMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
void
*
ahandle
=
pMsg
->
info
.
ahandle
;
mTrace
(
"msg:%p, will be processed, type:%s app:%p"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
),
ahandle
);
if
(
IsReq
(
pMsg
)
&&
!
mndIsMaster
(
pMnode
))
{
terrno
=
TSDB_CODE_APP_NOT_READY
;
mDebug
(
"msg:%p, failed to process since %s, app:%p"
,
pMsg
,
terrstr
(),
ahandle
);
return
-
1
;
}
if
(
IsReq
(
pMsg
))
{
if
(
!
mndIsMaster
(
pMnode
))
{
terrno
=
TSDB_CODE_APP_NOT_READY
;
mDebug
(
"msg:%p, failed to process since %s, app:%p"
,
pMsg
,
terrstr
(),
ahandle
);
return
-
1
;
}
if
(
IsReq
(
pMsg
)
&&
(
pMsg
->
contLen
==
0
||
pMsg
->
pCont
==
NULL
))
{
terrno
=
TSDB_CODE_INVALID_MSG_LEN
;
mError
(
"msg:%p, failed to process since %s, app:%p"
,
pMsg
,
terrstr
(),
ahandle
);
return
-
1
;
if
(
pMsg
->
contLen
==
0
||
pMsg
->
pCont
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_MSG_LEN
;
mError
(
"msg:%p, failed to process since %s, app:%p"
,
pMsg
,
terrstr
(),
ahandle
);
return
-
1
;
}
}
MndMsgFp
fp
=
pMnode
->
msgFp
[
TMSG_INDEX
(
pMsg
->
msgType
)];
...
...
source/dnode/mnode/impl/test/trans/trans2.cpp
浏览文件 @
ee06bac1
...
...
@@ -56,7 +56,7 @@ class MndTestTrans2 : public ::testing::Test {
msgCb
.
sendReqFp
=
sendReq
;
msgCb
.
sendRspFp
=
sendRsp
;
msgCb
.
mgmt
=
(
SMgmtWrapper
*
)(
&
msgCb
);
// hack
tmsgSetDefault
MsgCb
(
&
msgCb
);
tmsgSetDefault
(
&
msgCb
);
SMnodeOpt
opt
=
{
0
};
opt
.
deploy
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录