Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
96b7f269
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
96b7f269
编写于
5月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: adjust SRpcMsg
上级
c7851754
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
585 addition
and
593 deletion
+585
-593
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+1
-1
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
+1
-1
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+4
-4
source/dnode/mgmt/node_mgmt/src/dmProc.c
source/dnode/mgmt/node_mgmt/src/dmProc.c
+12
-14
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+36
-39
source/dnode/mgmt/node_util/inc/dmUtil.h
source/dnode/mgmt/node_util/inc/dmUtil.h
+5
-5
source/dnode/mgmt/node_util/src/dmEps.c
source/dnode/mgmt/node_util/src/dmEps.c
+1
-1
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+2
-2
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+1
-1
source/dnode/mnode/impl/src/mndAcct.c
source/dnode/mnode/impl/src/mndAcct.c
+6
-6
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+7
-7
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+21
-21
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+3
-3
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+30
-30
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+43
-43
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+35
-36
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+25
-25
source/dnode/mnode/impl/src/mndGrant.c
source/dnode/mnode/impl/src/mndGrant.c
+1
-1
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+23
-23
source/dnode/mnode/impl/src/mndOffset.c
source/dnode/mnode/impl/src/mndOffset.c
+6
-6
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+49
-48
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+27
-27
source/dnode/mnode/impl/src/mndQuery.c
source/dnode/mnode/impl/src/mndQuery.c
+13
-13
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+6
-6
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+27
-27
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+21
-21
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+36
-36
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+17
-17
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+11
-11
source/dnode/mnode/impl/src/mndTelem.c
source/dnode/mnode/impl/src/mndTelem.c
+2
-2
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+18
-18
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+23
-23
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+31
-31
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+15
-15
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+7
-10
source/dnode/mnode/impl/test/trans/trans2.cpp
source/dnode/mnode/impl/test/trans/trans2.cpp
+17
-17
tools/shell/src/shellNettest.c
tools/shell/src/shellNettest.c
+2
-2
未找到文件。
include/dnode/mnode/mnode.h
浏览文件 @
96b7f269
...
...
@@ -88,7 +88,7 @@ int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad);
* @param pMsg The request msg.
* @return int32_t 0 for success, -1 for failure.
*/
int32_t
mndProcessMsg
(
S
Node
Msg
*
pMsg
);
int32_t
mndProcessMsg
(
S
Rpc
Msg
*
pMsg
);
/**
* @brief Generate machine code
...
...
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
浏览文件 @
96b7f269
...
...
@@ -159,7 +159,7 @@ int32_t dmInitClient(SDnode *pDnode);
void
dmCleanupClient
(
SDnode
*
pDnode
);
SMsgCb
dmGetMsgcb
(
SMgmtWrapper
*
pWrapper
);
int32_t
dmInitMsgHandle
(
SDnode
*
pDnode
);
int32_t
dmProcessNodeMsg
(
SMgmtWrapper
*
pWrapper
,
S
Node
Msg
*
pMsg
);
int32_t
dmProcessNodeMsg
(
SMgmtWrapper
*
pWrapper
,
S
Rpc
Msg
*
pMsg
);
// mgmt nodes
SMgmtFunc
dmGetMgmtFunc
();
...
...
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
浏览文件 @
96b7f269
...
...
@@ -315,7 +315,7 @@ static void dmGetServerStartupStatus(SDnode *pDnode, SServerStatusRsp *pStatus)
void
dmProcessNetTestReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
dDebug
(
"net test req is received"
);
SRpcMsg
rsp
=
{.
handle
=
pReq
->
handle
,
.
refId
=
pReq
->
refId
,
.
ahandle
=
pReq
->
ahandle
,
.
code
=
0
};
SRpcMsg
rsp
=
{.
info
=
pReq
->
info
,
.
code
=
0
};
rsp
.
pCont
=
rpcMallocCont
(
pReq
->
contLen
);
if
(
rsp
.
pCont
==
NULL
)
{
rsp
.
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -332,7 +332,7 @@ void dmProcessServerStartupStatus(SDnode *pDnode, SRpcMsg *pReq) {
SServerStatusRsp
statusRsp
=
{
0
};
dmGetServerStartupStatus
(
pDnode
,
&
statusRsp
);
SRpcMsg
rspMsg
=
{.
handle
=
pReq
->
handle
,
.
ahandle
=
pReq
->
ahandle
,
.
refId
=
pReq
->
refId
};
SRpcMsg
rspMsg
=
{.
info
=
pReq
->
info
};
int32_t
rspLen
=
tSerializeSServerStatusRsp
(
NULL
,
0
,
&
statusRsp
);
if
(
rspLen
<
0
)
{
rspMsg
.
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -354,7 +354,7 @@ _OVER:
rpcFreeCont
(
pReq
->
pCont
);
}
static
int32_t
dmProcessCreateNodeReq
(
SDnode
*
pDnode
,
EDndNodeType
ntype
,
S
Node
Msg
*
pMsg
)
{
static
int32_t
dmProcessCreateNodeReq
(
SDnode
*
pDnode
,
EDndNodeType
ntype
,
S
Rpc
Msg
*
pMsg
)
{
SMgmtWrapper
*
pWrapper
=
dmAcquireWrapper
(
pDnode
,
ntype
);
if
(
pWrapper
!=
NULL
)
{
dmReleaseWrapper
(
pWrapper
);
...
...
@@ -389,7 +389,7 @@ static int32_t dmProcessCreateNodeReq(SDnode *pDnode, EDndNodeType ntype, SNodeM
return
code
;
}
static
int32_t
dmProcessDropNodeReq
(
SDnode
*
pDnode
,
EDndNodeType
ntype
,
S
Node
Msg
*
pMsg
)
{
static
int32_t
dmProcessDropNodeReq
(
SDnode
*
pDnode
,
EDndNodeType
ntype
,
S
Rpc
Msg
*
pMsg
)
{
SMgmtWrapper
*
pWrapper
=
dmAcquireWrapper
(
pDnode
,
ntype
);
if
(
pWrapper
==
NULL
)
{
terrno
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
...
...
source/dnode/mgmt/node_mgmt/src/dmProc.c
浏览文件 @
96b7f269
...
...
@@ -315,7 +315,7 @@ static void *dmConsumChildQueue(void *param) {
int32_t
numOfMsgs
=
0
;
int32_t
code
=
0
;
EProcFuncType
ftype
=
DND_FUNC_REQ
;
S
Node
Msg
*
pReq
=
NULL
;
S
Rpc
Msg
*
pReq
=
NULL
;
dDebug
(
"node:%s, start to consume from cqueue"
,
proc
->
name
);
do
{
...
...
@@ -337,16 +337,14 @@ static void *dmConsumChildQueue(void *param) {
rpcFreeCont
(
pBody
);
}
else
{
pReq
=
pHead
;
pReq
->
rpcMsg
.
pCont
=
pBody
;
pReq
->
pCont
=
pBody
;
code
=
dmProcessNodeMsg
(
pWrapper
,
pReq
);
if
(
code
!=
0
)
{
dError
(
"node:%s, failed to process msg:%p since %s, put into pqueue"
,
proc
->
name
,
pReq
,
terrstr
());
SRpcMsg
rspMsg
=
{
.
handle
=
pReq
->
rpcMsg
.
handle
,
.
ahandle
=
pReq
->
rpcMsg
.
ahandle
,
.
refId
=
pReq
->
rpcMsg
.
refId
,
.
pCont
=
pReq
->
pRsp
,
.
contLen
=
pReq
->
rspLen
,
.
info
=
pReq
->
info
,
.
pCont
=
pReq
->
info
.
rsp
,
.
contLen
=
pReq
->
info
.
rspLen
,
};
dmPutToProcPQueue
(
proc
,
&
rspMsg
,
sizeof
(
SRpcMsg
),
rspMsg
.
pCont
,
rspMsg
.
contLen
,
DND_FUNC_RSP
);
taosFreeQitem
(
pHead
);
...
...
@@ -389,19 +387,19 @@ static void *dmConsumParentQueue(void *param) {
if
(
ftype
==
DND_FUNC_RSP
)
{
pRsp
=
pHead
;
pRsp
->
pCont
=
pBody
;
dTrace
(
"node:%s, get rsp msg:%p from pqueue, code:0x%04x handle:%p"
,
proc
->
name
,
pRsp
,
code
,
pRsp
->
handle
);
dmRemoveProcRpcHandle
(
proc
,
pRsp
->
handle
);
dTrace
(
"node:%s, get rsp msg:%p from pqueue, code:0x%04x handle:%p"
,
proc
->
name
,
pRsp
,
code
,
pRsp
->
info
.
handle
);
dmRemoveProcRpcHandle
(
proc
,
pRsp
->
info
.
handle
);
rpcSendResponse
(
pRsp
);
}
else
if
(
ftype
==
DND_FUNC_REGIST
)
{
pRsp
=
pHead
;
dTrace
(
"node:%s, get regist msg:%p from pqueue, code:0x%04x handle:%p"
,
proc
->
name
,
pRsp
,
code
,
pRsp
->
handle
);
dTrace
(
"node:%s, get regist msg:%p from pqueue, code:0x%04x handle:%p"
,
proc
->
name
,
pRsp
,
code
,
pRsp
->
info
.
handle
);
rpcRegisterBrokenLinkArg
(
pRsp
);
rpcFreeCont
(
pBody
);
}
else
if
(
ftype
==
DND_FUNC_RELEASE
)
{
pRsp
=
pHead
;
dTrace
(
"node:%s, get release msg:%p from pqueue, code:0x%04x handle:%p"
,
proc
->
name
,
pRsp
,
code
,
pRsp
->
handle
);
dmRemoveProcRpcHandle
(
proc
,
pRsp
->
handle
);
rpcReleaseHandle
(
pRsp
->
handle
,
(
int8_t
)
pRsp
->
code
);
dTrace
(
"node:%s, get release msg:%p from pqueue, code:0x%04x handle:%p"
,
proc
->
name
,
pRsp
,
code
,
pRsp
->
info
.
handle
);
dmRemoveProcRpcHandle
(
proc
,
pRsp
->
info
.
handle
);
rpcReleaseHandle
(
pRsp
->
info
.
handle
,
(
int8_t
)
pRsp
->
code
);
rpcFreeCont
(
pBody
);
}
else
{
dFatal
(
"node:%s, get msg:%p from pqueue, invalid ftype:%d"
,
proc
->
name
,
pHead
,
ftype
);
...
...
@@ -494,7 +492,7 @@ void dmCloseProcRpcHandles(SProc *proc) {
h
=
taosHashIterate
(
proc
->
hash
,
h
);
dError
(
"node:%s, the child process dies and send an offline rsp to handle:%p"
,
proc
->
name
,
handle
);
SRpcMsg
rpcMsg
=
{.
handle
=
handle
,
.
code
=
TSDB_CODE_NODE_OFFLINE
};
SRpcMsg
rpcMsg
=
{.
info
.
handle
=
handle
,
.
code
=
TSDB_CODE_NODE_OFFLINE
};
rpcSendResponse
(
&
rpcMsg
);
}
taosHashClear
(
proc
->
hash
);
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
96b7f269
...
...
@@ -41,49 +41,47 @@ static void dmSetMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {
taosWUnLockLatch
(
&
pData
->
latch
);
}
static
inline
int32_t
dmBuildNodeMsg
(
S
Node
Msg
*
pMsg
,
SRpcMsg
*
pRpc
)
{
static
inline
int32_t
dmBuildNodeMsg
(
S
Rpc
Msg
*
pMsg
,
SRpcMsg
*
pRpc
)
{
SRpcConnInfo
connInfo
=
{
0
};
if
(
(
pRpc
->
msgType
&
1U
)
&&
rpcGetConnInfo
(
pRpc
->
handle
,
&
connInfo
)
!=
0
)
{
if
(
IsReq
(
pRpc
)
&&
rpcGetConnInfo
(
pRpc
->
info
.
handle
,
&
connInfo
)
!=
0
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
dError
(
"failed to build msg since %s, app:%p handle:%p"
,
terrstr
(),
pRpc
->
ahandle
,
pRpc
->
handle
);
dError
(
"failed to build msg since %s, app:%p handle:%p"
,
terrstr
(),
pRpc
->
info
.
ahandle
,
pRpc
->
info
.
handle
);
return
-
1
;
}
memcpy
(
pMsg
->
user
,
connInfo
.
user
,
TSDB_USER_LEN
);
pMsg
->
clientIp
=
connInfo
.
clientIp
;
pMsg
->
c
lientPort
=
connInfo
.
clientPort
;
memcpy
(
&
pMsg
->
rpcMsg
,
pRpc
,
sizeof
(
SRpcMsg
))
;
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
)
);
memcpy
(
pMsg
->
conn
.
user
,
connInfo
.
user
,
TSDB_USER_LEN
)
;
pMsg
->
c
onn
.
clientIp
=
connInfo
.
clientIp
;
pMsg
->
conn
.
clientPort
=
connInfo
.
clientPort
;
return
0
;
}
int32_t
dmProcessNodeMsg
(
SMgmtWrapper
*
pWrapper
,
S
Node
Msg
*
pMsg
)
{
NodeMsgFp
msgFp
=
pWrapper
->
msgFps
[
TMSG_INDEX
(
pMsg
->
rpcMsg
.
msgType
)];
int32_t
dmProcessNodeMsg
(
SMgmtWrapper
*
pWrapper
,
S
Rpc
Msg
*
pMsg
)
{
NodeMsgFp
msgFp
=
pWrapper
->
msgFps
[
TMSG_INDEX
(
pMsg
->
msgType
)];
if
(
msgFp
==
NULL
)
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
return
-
1
;
}
dTrace
(
"msg:%p, will be processed
, handle:%p"
,
pMsg
,
pMsg
->
rpcMsg
.
handle
);
dTrace
(
"msg:%p, will be processed
by %s, handle:%p"
,
pMsg
,
pWrapper
->
name
,
pMsg
->
info
.
handle
);
return
(
*
msgFp
)(
pWrapper
->
pMgmt
,
pMsg
);
}
static
void
dmProcessRpcMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpc
,
SEpSet
*
pEpSet
)
{
SDnodeTrans
*
pTrans
=
&
pDnode
->
trans
;
int32_t
code
=
-
1
;
SNodeMsg
*
pMsg
=
NULL
;
tmsg_t
msgType
=
pRpc
->
msgType
;
bool
isReq
=
msgType
&
1u
;
SRpcMsg
*
pMsg
=
NULL
;
bool
needRelease
=
false
;
SMsgHandle
*
pHandle
=
&
pTrans
->
msgHandles
[
TMSG_INDEX
(
msgType
)];
SMsgHandle
*
pHandle
=
&
pTrans
->
msgHandles
[
TMSG_INDEX
(
pRpc
->
msgType
)];
SMgmtWrapper
*
pWrapper
=
NULL
;
dTrace
(
"msg:%s is received, handle:%p
app:%p cont:%p len:%d code:0x%04x refId:%"
PRId64
,
TMSG_INFO
(
msgType
),
pRpc
->
handle
,
pRpc
->
ahandle
,
pRpc
->
pCont
,
pRpc
->
contLen
,
pRpc
->
code
,
pRpc
->
refId
);
dTrace
(
"msg:%s is received, handle:%p
cont:%p len:%d code:0x%04x app:%p refId:%"
PRId64
,
TMSG_INFO
(
pRpc
->
msgType
),
pRpc
->
info
.
handle
,
pRpc
->
pCont
,
pRpc
->
contLen
,
pRpc
->
code
,
pRpc
->
info
.
ahandle
,
pRpc
->
info
.
refId
);
if
(
msgType
==
TDMT_DND_NET_TEST
)
{
if
(
pRpc
->
msgType
==
TDMT_DND_NET_TEST
)
{
dmProcessNetTestReq
(
pDnode
,
pRpc
);
return
;
}
else
if
(
msgType
==
TDMT_MND_SYSTABLE_RETRIEVE_RSP
||
msgType
==
TDMT_VND_FETCH_RSP
)
{
}
else
if
(
pRpc
->
msgType
==
TDMT_MND_SYSTABLE_RETRIEVE_RSP
||
pRpc
->
msgType
==
TDMT_VND_FETCH_RSP
)
{
code
=
qWorkerProcessFetchRsp
(
NULL
,
NULL
,
pRpc
);
pRpc
->
pCont
=
NULL
;
// will be freed in qworker
return
;
...
...
@@ -91,21 +89,21 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
}
if
(
pDnode
->
status
!=
DND_STAT_RUNNING
)
{
if
(
msgType
==
TDMT_DND_SERVER_STATUS
)
{
if
(
pRpc
->
msgType
==
TDMT_DND_SERVER_STATUS
)
{
dmProcessServerStartupStatus
(
pDnode
,
pRpc
);
}
else
{
SRpcMsg
rspMsg
=
{
.
handle
=
pRpc
->
handle
,
.
info
.
handle
=
pRpc
->
info
.
handle
,
.
code
=
TSDB_CODE_APP_NOT_READY
,
.
ahandle
=
pRpc
->
ahandle
,
.
refId
=
pRpc
->
refId
,
.
info
.
ahandle
=
pRpc
->
info
.
ahandle
,
.
info
.
refId
=
pRpc
->
info
.
refId
,
};
rpcSendResponse
(
&
rspMsg
);
}
return
;
}
if
(
isReq
&&
pRpc
->
pCont
==
NULL
)
{
if
(
IsReq
(
pRpc
)
&&
pRpc
->
pCont
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_MSG_LEN
;
goto
_OVER
;
}
...
...
@@ -140,7 +138,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
needRelease
=
true
;
}
pMsg
=
taosAllocateQitem
(
sizeof
(
S
Node
Msg
),
RPC_QITEM
);
pMsg
=
taosAllocateQitem
(
sizeof
(
S
Rpc
Msg
),
RPC_QITEM
);
if
(
pMsg
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -150,8 +148,9 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
}
if
(
InParentProc
(
pWrapper
->
proc
.
ptype
))
{
code
=
dmPutToProcCQueue
(
&
pWrapper
->
proc
,
pMsg
,
sizeof
(
SNodeMsg
),
pRpc
->
pCont
,
pRpc
->
contLen
,
(
isReq
&&
(
pRpc
->
code
==
0
))
?
pRpc
->
handle
:
NULL
,
pRpc
->
refId
,
DND_FUNC_REQ
);
code
=
dmPutToProcCQueue
(
&
pWrapper
->
proc
,
pMsg
,
sizeof
(
SRpcMsg
),
pRpc
->
pCont
,
pRpc
->
contLen
,
(
IsReq
(
pRpc
)
&&
(
pRpc
->
code
==
0
))
?
pRpc
->
info
.
handle
:
NULL
,
pRpc
->
info
.
refId
,
DND_FUNC_REQ
);
}
else
{
code
=
dmProcessNodeMsg
(
pWrapper
,
pMsg
);
}
...
...
@@ -167,17 +166,17 @@ _OVER:
dError
(
"msg:%p, failed to process since %s"
,
pMsg
,
terrstr
());
if
(
terrno
!=
0
)
code
=
terrno
;
if
(
isReq
)
{
if
(
IsReq
(
pRpc
)
)
{
if
(
code
==
TSDB_CODE_NODE_NOT_DEPLOYED
||
code
==
TSDB_CODE_NODE_OFFLINE
)
{
if
(
msgType
>
TDMT_MND_MSG
&&
msgType
<
TDMT_VND_MSG
)
{
if
(
pRpc
->
msgType
>
TDMT_MND_MSG
&&
pRpc
->
msgType
<
TDMT_VND_MSG
)
{
code
=
TSDB_CODE_NODE_REDIRECT
;
}
}
SRpcMsg
rspMsg
=
{
.
handle
=
pRpc
->
handle
,
.
info
.
handle
=
pRpc
->
info
.
handle
,
.
code
=
code
,
.
ahandle
=
pRpc
->
ahandle
,
.
refId
=
pRpc
->
refId
,
.
info
.
ahandle
=
pRpc
->
info
.
ahandle
,
.
info
.
refId
=
pRpc
->
info
.
refId
,
};
tmsgSendRsp
(
&
rspMsg
);
}
...
...
@@ -222,7 +221,7 @@ static void dmSendRpcRedirectRsp(SDnode *pDnode, const SRpcMsg *pReq) {
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
pDnode
,
&
epSet
);
dDebug
(
"RPC %p, req is redirected, num:%d use:%d"
,
pReq
->
handle
,
epSet
.
numOfEps
,
epSet
.
inUse
);
dDebug
(
"RPC %p, req is redirected, num:%d use:%d"
,
pReq
->
info
.
handle
,
epSet
.
numOfEps
,
epSet
.
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
.
numOfEps
;
++
i
)
{
dDebug
(
"mnode index:%d %s:%u"
,
i
,
epSet
.
eps
[
i
].
fqdn
,
epSet
.
eps
[
i
].
port
);
if
(
strcmp
(
epSet
.
eps
[
i
].
fqdn
,
pDnode
->
data
.
localFqdn
)
==
0
&&
epSet
.
eps
[
i
].
port
==
pDnode
->
data
.
serverPort
)
{
...
...
@@ -237,8 +236,7 @@ static void dmSendRpcRedirectRsp(SDnode *pDnode, const SRpcMsg *pReq) {
SRpcMsg
rsp
=
{
.
code
=
TSDB_CODE_RPC_REDIRECT
,
.
handle
=
pReq
->
handle
,
.
refId
=
pReq
->
refId
,
.
info
=
pReq
->
info
,
.
contLen
=
len
,
};
rsp
.
pCont
=
rpcMallocCont
(
len
);
...
...
@@ -276,7 +274,7 @@ static inline int32_t dmSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SR
rpcFreeCont
(
pReq
->
pCont
);
pReq
->
pCont
=
NULL
;
terrno
=
TSDB_CODE_NODE_OFFLINE
;
dError
(
"failed to send rpc msg since %s, handle:%p"
,
terrstr
(),
pReq
->
handle
);
dError
(
"failed to send rpc msg since %s, handle:%p"
,
terrstr
(),
pReq
->
info
.
handle
);
return
-
1
;
}
...
...
@@ -304,8 +302,7 @@ static inline void dmSendRedirectRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp
tSerializeSMEpSet
(
rsp
.
pCont
,
len
,
&
msg
);
rsp
.
code
=
TSDB_CODE_RPC_REDIRECT
;
rsp
.
handle
=
pRsp
->
handle
;
rsp
.
refId
=
pRsp
->
refId
;
rsp
.
info
=
pRsp
->
info
;
rpcSendResponse
(
&
rsp
);
}
}
...
...
@@ -320,7 +317,7 @@ static inline void dmRegisterBrokenLinkArg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg
static
inline
void
dmReleaseHandle
(
SMgmtWrapper
*
pWrapper
,
void
*
handle
,
int8_t
type
)
{
if
(
InChildProc
(
pWrapper
->
proc
.
ptype
))
{
SRpcMsg
msg
=
{.
handle
=
handle
,
.
code
=
type
};
SRpcMsg
msg
=
{.
info
.
handle
=
handle
,
.
code
=
type
};
dmPutToProcPQueue
(
&
pWrapper
->
proc
,
&
msg
,
sizeof
(
SRpcMsg
),
NULL
,
0
,
DND_FUNC_RELEASE
);
}
else
{
rpcReleaseHandle
(
handle
,
type
);
...
...
@@ -410,7 +407,7 @@ static inline int32_t dmRetrieveUserAuthInfo(SDnode *pDnode, char *user, char *s
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSAuthReq
(
pReq
,
contLen
,
&
authReq
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pReq
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_AUTH
,
.
ahandle
=
(
void
*
)
9528
};
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
);
...
...
source/dnode/mgmt/node_util/inc/dmUtil.h
浏览文件 @
96b7f269
...
...
@@ -87,8 +87,8 @@ typedef enum {
DND_FUNC_RELEASE
=
4
,
}
EProcFuncType
;
typedef
int32_t
(
*
ProcessCreateNodeFp
)(
struct
SDnode
*
pDnode
,
EDndNodeType
ntype
,
S
Node
Msg
*
pMsg
);
typedef
int32_t
(
*
ProcessDropNodeFp
)(
struct
SDnode
*
pDnode
,
EDndNodeType
ntype
,
S
Node
Msg
*
pMsg
);
typedef
int32_t
(
*
ProcessCreateNodeFp
)(
struct
SDnode
*
pDnode
,
EDndNodeType
ntype
,
S
Rpc
Msg
*
pMsg
);
typedef
int32_t
(
*
ProcessDropNodeFp
)(
struct
SDnode
*
pDnode
,
EDndNodeType
ntype
,
S
Rpc
Msg
*
pMsg
);
typedef
bool
(
*
IsNodeRequiredFp
)(
struct
SDnode
*
pDnode
,
EDndNodeType
ntype
);
typedef
struct
{
...
...
@@ -130,13 +130,13 @@ typedef struct {
void
*
pMgmt
;
}
SMgmtOutputOpt
;
typedef
int32_t
(
*
NodeMsgFp
)(
void
*
pMgmt
,
S
Node
Msg
*
pMsg
);
typedef
int32_t
(
*
NodeMsgFp
)(
void
*
pMgmt
,
S
Rpc
Msg
*
pMsg
);
typedef
int32_t
(
*
NodeOpenFp
)(
SMgmtInputOpt
*
pInput
,
SMgmtOutputOpt
*
pOutput
);
typedef
void
(
*
NodeCloseFp
)(
void
*
pMgmt
);
typedef
int32_t
(
*
NodeStartFp
)(
void
*
pMgmt
);
typedef
void
(
*
NodeStopFp
)(
void
*
pMgmt
);
typedef
int32_t
(
*
NodeCreateFp
)(
const
SMgmtInputOpt
*
pInput
,
S
Node
Msg
*
pMsg
);
typedef
int32_t
(
*
NodeDropFp
)(
void
*
pMgmt
,
S
Node
Msg
*
pMsg
);
typedef
int32_t
(
*
NodeCreateFp
)(
const
SMgmtInputOpt
*
pInput
,
S
Rpc
Msg
*
pMsg
);
typedef
int32_t
(
*
NodeDropFp
)(
void
*
pMgmt
,
S
Rpc
Msg
*
pMsg
);
typedef
int32_t
(
*
NodeRequireFp
)(
const
SMgmtInputOpt
*
pInput
,
bool
*
required
);
typedef
SArray
*
(
*
NodeGetHandlesFp
)();
// array of SMgmtHandle
...
...
source/dnode/mgmt/node_util/src/dmEps.c
浏览文件 @
96b7f269
...
...
@@ -285,7 +285,7 @@ static void dmPrintEps(SDnodeData *pData) {
dDebug
(
"print dnode ep list, num:%d"
,
numOfEps
);
for
(
int32_t
i
=
0
;
i
<
numOfEps
;
i
++
)
{
SDnodeEp
*
pEp
=
taosArrayGet
(
pData
->
dnodeEps
,
i
);
dDebug
(
"dnode:%d, fqdn:%s port:%u is
M
node:%d"
,
pEp
->
id
,
pEp
->
ep
.
fqdn
,
pEp
->
ep
.
port
,
pEp
->
isMnode
);
dDebug
(
"dnode:%d, fqdn:%s port:%u is
_m
node:%d"
,
pEp
->
id
,
pEp
->
ep
.
fqdn
,
pEp
->
ep
.
port
,
pEp
->
isMnode
);
}
}
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
96b7f269
...
...
@@ -42,10 +42,10 @@ extern "C" {
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
#define SYSTABLE_SCH_COL_NAME_LEN ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
typedef
int32_t
(
*
MndMsgFp
)(
S
Node
Msg
*
pMsg
);
typedef
int32_t
(
*
MndMsgFp
)(
S
Rpc
Msg
*
pMsg
);
typedef
int32_t
(
*
MndInitFp
)(
SMnode
*
pMnode
);
typedef
void
(
*
MndCleanupFp
)(
SMnode
*
pMnode
);
typedef
int32_t
(
*
ShowRetrieveFp
)(
S
Node
Msg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
typedef
int32_t
(
*
ShowRetrieveFp
)(
S
Rpc
Msg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
typedef
void
(
*
ShowFreeIterFp
)(
SMnode
*
pMnode
,
void
*
pIter
);
typedef
struct
SQWorker
SQHandle
;
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
96b7f269
...
...
@@ -59,7 +59,7 @@ void mndTransSetCb(STrans *pTrans, ETrnFuncType startFunc, ETrnFuncType stopF
void
mndTransSetDbInfo
(
STrans
*
pTrans
,
SDbObj
*
pDb
);
int32_t
mndTransPrepare
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
void
mndTransProcessRsp
(
S
Node
Msg
*
pRsp
);
void
mndTransProcessRsp
(
S
Rpc
Msg
*
pRsp
);
void
mndTransPullup
(
SMnode
*
pMnode
);
int32_t
mndKillTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
...
...
source/dnode/mnode/impl/src/mndAcct.c
浏览文件 @
96b7f269
...
...
@@ -26,9 +26,9 @@ static SSdbRow *mndAcctActionDecode(SSdbRaw *pRaw);
static
int32_t
mndAcctActionInsert
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mndAcctActionDelete
(
SSdb
*
pSdb
,
SAcctObj
*
pAcct
);
static
int32_t
mndAcctActionUpdate
(
SSdb
*
pSdb
,
SAcctObj
*
pOld
,
SAcctObj
*
pNew
);
static
int32_t
mndProcessCreateAcctReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessAlterAcctReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropAcctReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessCreateAcctReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessAlterAcctReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropAcctReq
(
S
Rpc
Msg
*
pReq
);
int32_t
mndInitAcct
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_ACCT
,
...
...
@@ -185,19 +185,19 @@ static int32_t mndAcctActionUpdate(SSdb *pSdb, SAcctObj *pOld, SAcctObj *pNew) {
return
0
;
}
static
int32_t
mndProcessCreateAcctReq
(
S
Node
Msg
*
pReq
)
{
static
int32_t
mndProcessCreateAcctReq
(
S
Rpc
Msg
*
pReq
)
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
mError
(
"failed to process create acct request since %s"
,
terrstr
());
return
-
1
;
}
static
int32_t
mndProcessAlterAcctReq
(
S
Node
Msg
*
pReq
)
{
static
int32_t
mndProcessAlterAcctReq
(
S
Rpc
Msg
*
pReq
)
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
mError
(
"failed to process create acct request since %s"
,
terrstr
());
return
-
1
;
}
static
int32_t
mndProcessDropAcctReq
(
S
Node
Msg
*
pReq
)
{
static
int32_t
mndProcessDropAcctReq
(
S
Rpc
Msg
*
pReq
)
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
mError
(
"failed to process create acct request since %s"
,
terrstr
());
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
96b7f269
...
...
@@ -17,7 +17,7 @@
#include "mndAuth.h"
#include "mndUser.h"
static
int32_t
mndProcessAuthReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessAuthReq
(
S
Rpc
Msg
*
pReq
);
int32_t
mndInitAuth
(
SMnode
*
pMnode
)
{
mndSetMsgHandle
(
pMnode
,
TDMT_MND_AUTH
,
mndProcessAuthReq
);
...
...
@@ -45,9 +45,9 @@ static int32_t mndRetriveAuth(SMnode *pMnode, SAuthRsp *pRsp) {
return
0
;
}
static
int32_t
mndProcessAuthReq
(
S
Node
Msg
*
pReq
)
{
static
int32_t
mndProcessAuthReq
(
S
Rpc
Msg
*
pReq
)
{
SAuthReq
authReq
=
{
0
};
if
(
tDeserializeSAuthReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
authReq
)
!=
0
)
{
if
(
tDeserializeSAuthReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
authReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -55,8 +55,8 @@ static int32_t mndProcessAuthReq(SNodeMsg *pReq) {
SAuthReq
authRsp
=
{
0
};
memcpy
(
authRsp
.
user
,
authReq
.
user
,
TSDB_USER_LEN
);
int32_t
code
=
mndRetriveAuth
(
pReq
->
pN
ode
,
&
authRsp
);
mTrace
(
"user:%s, auth req received, spi:%d encrypt:%d ruser:%s"
,
pReq
->
user
,
authRsp
.
spi
,
authRsp
.
encrypt
,
int32_t
code
=
mndRetriveAuth
(
pReq
->
info
.
n
ode
,
&
authRsp
);
mTrace
(
"user:%s, auth req received, spi:%d encrypt:%d ruser:%s"
,
pReq
->
conn
.
user
,
authRsp
.
spi
,
authRsp
.
encrypt
,
authRsp
.
user
);
int32_t
contLen
=
tSerializeSAuthReq
(
NULL
,
0
,
&
authRsp
);
...
...
@@ -68,8 +68,8 @@ static int32_t mndProcessAuthReq(SNodeMsg *pReq) {
tSerializeSAuthReq
(
pRsp
,
contLen
,
&
authRsp
);
pReq
->
pR
sp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
pReq
->
info
.
r
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
contLen
;
return
code
;
}
...
...
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
96b7f269
...
...
@@ -29,11 +29,11 @@ static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw);
static
int32_t
mndBnodeActionInsert
(
SSdb
*
pSdb
,
SBnodeObj
*
pObj
);
static
int32_t
mndBnodeActionUpdate
(
SSdb
*
pSdb
,
SBnodeObj
*
pOld
,
SBnodeObj
*
pNew
);
static
int32_t
mndBnodeActionDelete
(
SSdb
*
pSdb
,
SBnodeObj
*
pObj
);
static
int32_t
mndProcessCreateBnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessCreateBnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessDropBnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropBnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndRetrieveBnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndProcessCreateBnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessCreateBnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessDropBnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropBnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndRetrieveBnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextBnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitBnode
(
SMnode
*
pMnode
)
{
...
...
@@ -238,7 +238,7 @@ static int32_t mndSetCreateBnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
return
0
;
}
static
int32_t
mndCreateBnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SDnodeObj
*
pDnode
,
SMCreateBnodeReq
*
pCreate
)
{
static
int32_t
mndCreateBnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SDnodeObj
*
pDnode
,
SMCreateBnodeReq
*
pCreate
)
{
int32_t
code
=
-
1
;
SBnodeObj
bnodeObj
=
{
0
};
...
...
@@ -246,7 +246,7 @@ static int32_t mndCreateBnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
bnodeObj
.
createdTime
=
taosGetTimestampMs
();
bnodeObj
.
updateTime
=
bnodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_BNODE
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_BNODE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create bnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
...
...
@@ -264,15 +264,15 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateBnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateBnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SBnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateBnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -293,7 +293,7 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -360,10 +360,10 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
return
0
;
}
static
int32_t
mndDropBnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SBnodeObj
*
pObj
)
{
static
int32_t
mndDropBnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SBnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_BNODE
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_BNODE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop bnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
...
...
@@ -379,14 +379,14 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessDropBnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessDropBnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SBnodeObj
*
pObj
=
NULL
;
SMDropBnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -403,7 +403,7 @@ static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -427,18 +427,18 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateBnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessCreateBnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndProcessDropBnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessDropBnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndRetrieveBnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveBnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
96b7f269
...
...
@@ -26,7 +26,7 @@ static int32_t mndClusterActionInsert(SSdb *pSdb, SClusterObj *pCluster);
static
int32_t
mndClusterActionDelete
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
);
static
int32_t
mndClusterActionUpdate
(
SSdb
*
pSdb
,
SClusterObj
*
pOldCluster
,
SClusterObj
*
pNewCluster
);
static
int32_t
mndCreateDefaultCluster
(
SMnode
*
pMnode
);
static
int32_t
mndRetrieveClusters
(
S
Node
Msg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveClusters
(
S
Rpc
Msg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextCluster
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitCluster
(
SMnode
*
pMnode
)
{
...
...
@@ -180,8 +180,8 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
return
sdbWrite
(
pMnode
->
pSdb
,
pRaw
);
}
static
int32_t
mndRetrieveClusters
(
S
Node
Msg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pMsg
->
pN
ode
;
static
int32_t
mndRetrieveClusters
(
S
Rpc
Msg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
96b7f269
...
...
@@ -42,15 +42,15 @@ static const char *mndConsumerStatusName(int status);
static
int32_t
mndConsumerActionInsert
(
SSdb
*
pSdb
,
SMqConsumerObj
*
pConsumer
);
static
int32_t
mndConsumerActionDelete
(
SSdb
*
pSdb
,
SMqConsumerObj
*
pConsumer
);
static
int32_t
mndConsumerActionUpdate
(
SSdb
*
pSdb
,
SMqConsumerObj
*
pConsumer
,
SMqConsumerObj
*
pNewConsumer
);
static
int32_t
mndProcessConsumerMetaMsg
(
S
Node
Msg
*
pMsg
);
static
int32_t
mndRetrieveConsumer
(
S
Node
Msg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndProcessConsumerMetaMsg
(
S
Rpc
Msg
*
pMsg
);
static
int32_t
mndRetrieveConsumer
(
S
Rpc
Msg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextConsumer
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessSubscribeReq
(
S
Node
Msg
*
pMsg
);
static
int32_t
mndProcessAskEpReq
(
S
Node
Msg
*
pMsg
);
static
int32_t
mndProcessMqTimerMsg
(
S
Node
Msg
*
pMsg
);
static
int32_t
mndProcessConsumerLostMsg
(
S
Node
Msg
*
pMsg
);
static
int32_t
mndProcessConsumerRecoverMsg
(
S
Node
Msg
*
pMsg
);
static
int32_t
mndProcessSubscribeReq
(
S
Rpc
Msg
*
pMsg
);
static
int32_t
mndProcessAskEpReq
(
S
Rpc
Msg
*
pMsg
);
static
int32_t
mndProcessMqTimerMsg
(
S
Rpc
Msg
*
pMsg
);
static
int32_t
mndProcessConsumerLostMsg
(
S
Rpc
Msg
*
pMsg
);
static
int32_t
mndProcessConsumerRecoverMsg
(
S
Rpc
Msg
*
pMsg
);
int32_t
mndInitConsumer
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_CONSUMER
,
...
...
@@ -86,9 +86,9 @@ void mndRebCntInc() { atomic_add_fetch_8(&mqRebLock, 1); }
void
mndRebCntDec
()
{
atomic_sub_fetch_8
(
&
mqRebLock
,
1
);
}
static
int32_t
mndProcessConsumerLostMsg
(
S
Node
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pN
ode
;
SMqConsumerLostMsg
*
pLostMsg
=
pMsg
->
rpcMsg
.
pCont
;
static
int32_t
mndProcessConsumerLostMsg
(
S
Rpc
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
n
ode
;
SMqConsumerLostMsg
*
pLostMsg
=
pMsg
->
pCont
;
SMqConsumerObj
*
pConsumer
=
mndAcquireConsumer
(
pMnode
,
pLostMsg
->
consumerId
);
ASSERT
(
pConsumer
);
...
...
@@ -97,7 +97,7 @@ static int32_t mndProcessConsumerLostMsg(SNodeMsg *pMsg) {
mndReleaseConsumer
(
pMnode
,
pConsumer
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CONSUMER_LOST
,
&
pMsg
->
rpc
Msg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CONSUMER_LOST
,
p
Msg
);
if
(
pTrans
==
NULL
)
goto
FAIL
;
if
(
mndSetConsumerCommitLogs
(
pMnode
,
pTrans
,
pConsumerNew
)
!=
0
)
goto
FAIL
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
FAIL
;
...
...
@@ -110,9 +110,9 @@ FAIL:
return
-
1
;
}
static
int32_t
mndProcessConsumerRecoverMsg
(
S
Node
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pN
ode
;
SMqConsumerRecoverMsg
*
pRecoverMsg
=
pMsg
->
rpcMsg
.
pCont
;
static
int32_t
mndProcessConsumerRecoverMsg
(
S
Rpc
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
n
ode
;
SMqConsumerRecoverMsg
*
pRecoverMsg
=
pMsg
->
pCont
;
SMqConsumerObj
*
pConsumer
=
mndAcquireConsumer
(
pMnode
,
pRecoverMsg
->
consumerId
);
ASSERT
(
pConsumer
);
...
...
@@ -121,7 +121,7 @@ static int32_t mndProcessConsumerRecoverMsg(SNodeMsg *pMsg) {
mndReleaseConsumer
(
pMnode
,
pConsumer
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CONSUMER_RECOVER
,
&
pMsg
->
rpc
Msg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CONSUMER_RECOVER
,
p
Msg
);
if
(
pTrans
==
NULL
)
goto
FAIL
;
if
(
mndSetConsumerCommitLogs
(
pMnode
,
pTrans
,
pConsumerNew
)
!=
0
)
goto
FAIL
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
FAIL
;
...
...
@@ -147,8 +147,8 @@ static SMqRebInfo *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) {
return
pRebSub
;
}
static
int32_t
mndProcessMqTimerMsg
(
S
Node
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pN
ode
;
static
int32_t
mndProcessMqTimerMsg
(
S
Rpc
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SMqConsumerObj
*
pConsumer
;
void
*
pIter
=
NULL
;
...
...
@@ -237,14 +237,14 @@ static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) {
return
0
;
}
static
int32_t
mndProcessAskEpReq
(
S
Node
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pN
ode
;
SMqAskEpReq
*
pReq
=
(
SMqAskEpReq
*
)
pMsg
->
rpcMsg
.
pCont
;
static
int32_t
mndProcessAskEpReq
(
S
Rpc
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
n
ode
;
SMqAskEpReq
*
pReq
=
(
SMqAskEpReq
*
)
pMsg
->
pCont
;
SMqAskEpRsp
rsp
=
{
0
};
int64_t
consumerId
=
be64toh
(
pReq
->
consumerId
);
int32_t
epoch
=
ntohl
(
pReq
->
epoch
);
SMqConsumerObj
*
pConsumer
=
mndAcquireConsumer
(
pMsg
->
pN
ode
,
consumerId
);
SMqConsumerObj
*
pConsumer
=
mndAcquireConsumer
(
pMsg
->
info
.
n
ode
,
consumerId
);
if
(
pConsumer
==
NULL
)
{
terrno
=
TSDB_CODE_MND_CONSUMER_NOT_EXIST
;
return
-
1
;
...
...
@@ -366,8 +366,8 @@ static int32_t mndProcessAskEpReq(SNodeMsg *pMsg) {
mndReleaseConsumer
(
pMnode
,
pConsumer
);
// send rsp
pMsg
->
pR
sp
=
buf
;
pMsg
->
rspLen
=
tlen
;
pMsg
->
info
.
r
sp
=
buf
;
pMsg
->
info
.
rspLen
=
tlen
;
return
0
;
FAIL:
tDeleteSMqAskEpRsp
(
&
rsp
);
...
...
@@ -383,9 +383,9 @@ int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj
return
0
;
}
static
int32_t
mndProcessSubscribeReq
(
S
Node
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pN
ode
;
char
*
msgStr
=
pMsg
->
rpcMsg
.
pCont
;
static
int32_t
mndProcessSubscribeReq
(
S
Rpc
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
n
ode
;
char
*
msgStr
=
pMsg
->
pCont
;
SCMSubscribeReq
subscribe
=
{
0
};
tDeserializeSCMSubscribeReq
(
msgStr
,
&
subscribe
);
int64_t
consumerId
=
subscribe
.
consumerId
;
...
...
@@ -422,7 +422,7 @@ static int32_t mndProcessSubscribeReq(SNodeMsg *pMsg) {
taosArrayPush
(
pConsumerNew
->
assignedTopics
,
&
newTopicCopy
);
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_SUBSCRIBE
,
&
pMsg
->
rpc
Msg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_SUBSCRIBE
,
p
Msg
);
if
(
pTrans
==
NULL
)
goto
SUBSCRIBE_OVER
;
if
(
mndSetConsumerCommitLogs
(
pMnode
,
pTrans
,
pConsumerNew
)
!=
0
)
goto
SUBSCRIBE_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
SUBSCRIBE_OVER
;
...
...
@@ -494,7 +494,7 @@ static int32_t mndProcessSubscribeReq(SNodeMsg *pMsg) {
goto
SUBSCRIBE_OVER
;
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_SUBSCRIBE
,
&
pMsg
->
rpc
Msg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_SUBSCRIBE
,
p
Msg
);
if
(
pTrans
==
NULL
)
goto
SUBSCRIBE_OVER
;
if
(
mndSetConsumerCommitLogs
(
pMnode
,
pTrans
,
pConsumerNew
)
!=
0
)
goto
SUBSCRIBE_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
SUBSCRIBE_OVER
;
...
...
@@ -788,8 +788,8 @@ void mndReleaseConsumer(SMnode *pMnode, SMqConsumerObj *pConsumer) {
sdbRelease
(
pSdb
,
pConsumer
);
}
static
int32_t
mndRetrieveConsumer
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveConsumer
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SMqConsumerObj
*
pConsumer
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
96b7f269
...
...
@@ -36,14 +36,14 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw);
static
int32_t
mndDbActionInsert
(
SSdb
*
pSdb
,
SDbObj
*
pDb
);
static
int32_t
mndDbActionDelete
(
SSdb
*
pSdb
,
SDbObj
*
pDb
);
static
int32_t
mndDbActionUpdate
(
SSdb
*
pSdb
,
SDbObj
*
pOld
,
SDbObj
*
pNew
);
static
int32_t
mndProcessCreateDbReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessAlterDbReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropDbReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessUseDbReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessCompactDbReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndRetrieveDbs
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
);
static
int32_t
mndProcessCreateDbReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessAlterDbReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropDbReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessUseDbReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessCompactDbReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndRetrieveDbs
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
);
static
void
mndCancelGetNextDb
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessGetDbCfgReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessGetDbCfgReq
(
S
Rpc
Msg
*
pReq
);
int32_t
mndInitDb
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{
...
...
@@ -508,7 +508,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
}
static
int32_t
mndCreateDb
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SCreateDbReq
*
pCreate
,
SUserObj
*
pUser
)
{
static
int32_t
mndCreateDb
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SCreateDbReq
*
pCreate
,
SUserObj
*
pUser
)
{
SDbObj
dbObj
=
{
0
};
memcpy
(
dbObj
.
name
,
pCreate
->
db
,
TSDB_DB_FNAME_LEN
);
memcpy
(
dbObj
.
acct
,
pUser
->
acct
,
TSDB_USER_LEN
);
...
...
@@ -563,7 +563,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SNodeMsg *pReq, SCreateDbReq *pCreate
}
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_DB
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_DB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create db:%s"
,
pTrans
->
id
,
pCreate
->
db
);
...
...
@@ -584,14 +584,14 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateDbReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateDbReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SCreateDbReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -612,7 +612,7 @@ static int32_t mndProcessCreateDbReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -794,9 +794,9 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
return
0
;
}
static
int32_t
mndAlterDb
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SDbObj
*
pOld
,
SDbObj
*
pNew
)
{
static
int32_t
mndAlterDb
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SDbObj
*
pOld
,
SDbObj
*
pNew
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_ALTER_DB
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_ALTER_DB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to alter db:%s"
,
pTrans
->
id
,
pOld
->
name
);
...
...
@@ -814,15 +814,15 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessAlterDbReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessAlterDbReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SAlterDbReq
alterReq
=
{
0
};
SDbObj
dbObj
=
{
0
};
if
(
tDeserializeSAlterDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
{
if
(
tDeserializeSAlterDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -835,7 +835,7 @@ static int32_t mndProcessAlterDbReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -873,14 +873,14 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessGetDbCfgReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessGetDbCfgReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SDbCfgReq
cfgReq
=
{
0
};
SDbCfgRsp
cfgRsp
=
{
0
};
if
(
tDeserializeSDbCfgReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
cfgReq
)
!=
0
)
{
if
(
tDeserializeSDbCfgReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
cfgReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -922,8 +922,8 @@ static int32_t mndProcessGetDbCfgReq(SNodeMsg *pReq) {
tSerializeSDbCfgRsp
(
pRsp
,
contLen
,
&
cfgRsp
);
pReq
->
pR
sp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
pReq
->
info
.
r
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
contLen
;
code
=
0
;
...
...
@@ -1055,9 +1055,9 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
return
0
;
}
static
int32_t
mndDropDb
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SDbObj
*
pDb
)
{
static
int32_t
mndDropDb
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SDbObj
*
pDb
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_DB
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_DB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop db:%s"
,
pTrans
->
id
,
pDb
->
name
);
...
...
@@ -1095,14 +1095,14 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessDropDbReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessDropDbReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SDropDbReq
dropReq
=
{
0
};
if
(
tDeserializeSDropDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSDropDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -1112,7 +1112,7 @@ static int32_t mndProcessDropDbReq(SNodeMsg *pReq) {
pDb
=
mndAcquireDb
(
pMnode
,
dropReq
.
db
);
if
(
pDb
==
NULL
)
{
if
(
dropReq
.
ignoreNotExists
)
{
code
=
mndBuildDropDbRsp
(
pDb
,
&
pReq
->
rspLen
,
&
pReq
->
pR
sp
,
true
);
code
=
mndBuildDropDbRsp
(
pDb
,
&
pReq
->
info
.
rspLen
,
&
pReq
->
info
.
r
sp
,
true
);
goto
_OVER
;
}
else
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
...
...
@@ -1120,7 +1120,7 @@ static int32_t mndProcessDropDbReq(SNodeMsg *pReq) {
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -1231,15 +1231,15 @@ int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUs
return
0
;
}
static
int32_t
mndProcessUseDbReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessUseDbReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SUseDbReq
usedbReq
=
{
0
};
SUseDbRsp
usedbRsp
=
{
0
};
if
(
tDeserializeSUseDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
usedbReq
)
!=
0
)
{
if
(
tDeserializeSUseDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
usedbReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -1275,7 +1275,7 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) {
mError
(
"db:%s, failed to process use db req since %s"
,
usedbReq
.
db
,
terrstr
());
}
else
{
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -1302,8 +1302,8 @@ static int32_t mndProcessUseDbReq(SNodeMsg *pReq) {
tSerializeSUseDbRsp
(
pRsp
,
contLen
,
&
usedbRsp
);
pReq
->
pR
sp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
pReq
->
info
.
r
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
contLen
;
_OVER:
if
(
code
!=
0
)
{
...
...
@@ -1385,14 +1385,14 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
return
0
;
}
static
int32_t
mndProcessCompactDbReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCompactDbReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SCompactDbReq
compactReq
=
{
0
};
if
(
tDeserializeSCompactDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
compactReq
)
!=
0
)
{
if
(
tDeserializeSCompactDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
compactReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -1404,7 +1404,7 @@ static int32_t mndProcessCompactDbReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -1587,8 +1587,8 @@ static bool mndGetTablesOfDbFp(SMnode *pMnode, void *pObj, void *p1, void *p2, v
return
true
;
}
static
int32_t
mndRetrieveDbs
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveDbs
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SDbObj
*
pDb
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
96b7f269
...
...
@@ -46,15 +46,15 @@ static int32_t mndDnodeActionInsert(SSdb *pSdb, SDnodeObj *pDnode);
static
int32_t
mndDnodeActionDelete
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
pOld
,
SDnodeObj
*
pNew
);
static
int32_t
mndProcessCreateDnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropDnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessConfigDnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessConfigDnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessStatusReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessCreateDnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropDnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessConfigDnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessConfigDnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessStatusReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndRetrieveConfigs
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveConfigs
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextConfig
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndRetrieveDnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveDnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextDnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitDnode
(
SMnode
*
pMnode
)
{
...
...
@@ -289,13 +289,13 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, const SClusterCfg *pCfg) {
return
0
;
}
static
int32_t
mndProcessStatusReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessStatusReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SStatusReq
statusReq
=
{
0
};
SDnodeObj
*
pDnode
=
NULL
;
int32_t
code
=
-
1
;
if
(
tDeserializeSStatusReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
statusReq
)
!=
0
)
{
if
(
tDeserializeSStatusReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
statusReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
PROCESS_STATUS_MSG_OVER
;
}
...
...
@@ -419,8 +419,8 @@ static int32_t mndProcessStatusReq(SNodeMsg *pReq) {
tSerializeSStatusRsp
(
pHead
,
contLen
,
&
statusRsp
);
taosArrayDestroy
(
statusRsp
.
pDnodeEps
);
pReq
->
rspLen
=
contLen
;
pReq
->
pR
sp
=
pHead
;
pReq
->
info
.
rspLen
=
contLen
;
pReq
->
info
.
r
sp
=
pHead
;
}
pDnode
->
lastAccessTime
=
curMs
;
...
...
@@ -432,7 +432,7 @@ PROCESS_STATUS_MSG_OVER:
return
code
;
}
static
int32_t
mndCreateDnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SCreateDnodeReq
*
pCreate
)
{
static
int32_t
mndCreateDnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SCreateDnodeReq
*
pCreate
)
{
SDnodeObj
dnodeObj
=
{
0
};
dnodeObj
.
id
=
sdbGetMaxId
(
pMnode
->
pSdb
,
SDB_DNODE
);
dnodeObj
.
createdTime
=
taosGetTimestampMs
();
...
...
@@ -441,7 +441,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SNodeMsg *pReq, SCreateDnodeReq *p
memcpy
(
dnodeObj
.
fqdn
,
pCreate
->
fqdn
,
TSDB_FQDN_LEN
);
snprintf
(
dnodeObj
.
ep
,
TSDB_EP_LEN
,
"%s:%u"
,
dnodeObj
.
fqdn
,
dnodeObj
.
port
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_DNODE
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_DNODE
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"dnode:%s, failed to create since %s"
,
dnodeObj
.
ep
,
terrstr
());
return
-
1
;
...
...
@@ -466,14 +466,14 @@ static int32_t mndCreateDnode(SMnode *pMnode, SNodeMsg *pReq, SCreateDnodeReq *p
return
0
;
}
static
int32_t
mndProcessCreateDnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateDnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SCreateDnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDnodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_DNODE_OVER
;
}
...
...
@@ -493,7 +493,7 @@ static int32_t mndProcessCreateDnodeReq(SNodeMsg *pReq) {
goto
CREATE_DNODE_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
CREATE_DNODE_OVER
;
...
...
@@ -516,8 +516,8 @@ CREATE_DNODE_OVER:
return
code
;
}
static
int32_t
mndDropDnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SDnodeObj
*
pDnode
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_DNODE
,
&
pReq
->
rpcMsg
);
static
int32_t
mndDropDnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SDnodeObj
*
pDnode
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_DNODE
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"dnode:%d, failed to drop since %s"
,
pDnode
->
id
,
terrstr
());
return
-
1
;
...
...
@@ -542,15 +542,15 @@ static int32_t mndDropDnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode) {
return
0
;
}
static
int32_t
mndProcessDropDnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessDropDnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SMnodeObj
*
pMObj
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_DNODE_OVER
;
}
...
...
@@ -574,7 +574,7 @@ static int32_t mndProcessDropDnodeReq(SNodeMsg *pReq) {
goto
DROP_DNODE_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
DROP_DNODE_OVER
;
...
...
@@ -599,11 +599,11 @@ DROP_DNODE_OVER:
return
code
;
}
static
int32_t
mndProcessConfigDnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessConfigDnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SMCfgDnodeReq
cfgReq
=
{
0
};
if
(
tDeserializeSMCfgDnodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
cfgReq
)
!=
0
)
{
if
(
tDeserializeSMCfgDnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
cfgReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -622,22 +622,21 @@ static int32_t mndProcessConfigDnodeReq(SNodeMsg *pReq) {
void
*
pBuf
=
rpcMallocCont
(
bufLen
);
tSerializeSMCfgDnodeReq
(
pBuf
,
bufLen
,
&
cfgReq
);
SRpcMsg
rpcMsg
=
{
.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
,
.
ahandle
=
pReq
->
rpcMsg
.
ahandle
};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
,
.
info
=
pReq
->
info
};
mInfo
(
"dnode:%d, app:%p config:%s req send to dnode"
,
cfgReq
.
dnodeId
,
rpcMsg
.
ahandle
,
cfgReq
.
config
);
mInfo
(
"dnode:%d, app:%p config:%s req send to dnode"
,
cfgReq
.
dnodeId
,
rpcMsg
.
info
.
ahandle
,
cfgReq
.
config
);
tmsgSendReq
(
&
pMnode
->
msgCb
,
&
epSet
,
&
rpcMsg
);
return
0
;
}
static
int32_t
mndProcessConfigDnodeRsp
(
S
Node
Msg
*
pRsp
)
{
mInfo
(
"app:%p config rsp from dnode"
,
pRsp
->
rpcMsg
.
ahandle
);
static
int32_t
mndProcessConfigDnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mInfo
(
"app:%p config rsp from dnode"
,
pRsp
->
info
.
ahandle
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mndRetrieveConfigs
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveConfigs
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
totalRows
=
0
;
int32_t
numOfRows
=
0
;
char
*
cfgOpts
[
TSDB_CONFIG_NUMBER
]
=
{
0
};
...
...
@@ -685,8 +684,8 @@ static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *
static
void
mndCancelGetNextConfig
(
SMnode
*
pMnode
,
void
*
pIter
)
{}
static
int32_t
mndRetrieveDnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveDnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
96b7f269
...
...
@@ -29,12 +29,12 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw);
static
int32_t
mndFuncActionInsert
(
SSdb
*
pSdb
,
SFuncObj
*
pFunc
);
static
int32_t
mndFuncActionDelete
(
SSdb
*
pSdb
,
SFuncObj
*
pFunc
);
static
int32_t
mndFuncActionUpdate
(
SSdb
*
pSdb
,
SFuncObj
*
pOld
,
SFuncObj
*
pNew
);
static
int32_t
mndCreateFunc
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SCreateFuncReq
*
pCreate
);
static
int32_t
mndDropFunc
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SFuncObj
*
pFunc
);
static
int32_t
mndProcessCreateFuncReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropFuncReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessRetrieveFuncReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndRetrieveFuncs
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndCreateFunc
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SCreateFuncReq
*
pCreate
);
static
int32_t
mndDropFunc
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SFuncObj
*
pFunc
);
static
int32_t
mndProcessCreateFuncReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropFuncReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessRetrieveFuncReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndRetrieveFuncs
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextFunc
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitFunc
(
SMnode
*
pMnode
)
{
...
...
@@ -186,7 +186,7 @@ static void mndReleaseFunc(SMnode *pMnode, SFuncObj *pFunc) {
sdbRelease
(
pSdb
,
pFunc
);
}
static
int32_t
mndCreateFunc
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SCreateFuncReq
*
pCreate
)
{
static
int32_t
mndCreateFunc
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SCreateFuncReq
*
pCreate
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
NULL
;
...
...
@@ -215,7 +215,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SNodeMsg *pReq, SCreateFuncReq *pCr
}
memcpy
(
func
.
pCode
,
pCreate
->
pCode
,
func
.
codeSize
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_FUNC
,
&
pReq
->
rpcMsg
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_FUNC
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create func:%s"
,
pTrans
->
id
,
pCreate
->
name
);
...
...
@@ -243,9 +243,9 @@ _OVER:
return
code
;
}
static
int32_t
mndDropFunc
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SFuncObj
*
pFunc
)
{
static
int32_t
mndDropFunc
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SFuncObj
*
pFunc
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_FUNC
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_FUNC
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop user:%s"
,
pTrans
->
id
,
pFunc
->
name
);
...
...
@@ -271,14 +271,14 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateFuncReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateFuncReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SFuncObj
*
pFunc
=
NULL
;
SCreateFuncReq
createReq
=
{
0
};
if
(
tDeserializeSCreateFuncReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateFuncReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -319,7 +319,7 @@ static int32_t mndProcessCreateFuncReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -344,14 +344,14 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessDropFuncReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessDropFuncReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SFuncObj
*
pFunc
=
NULL
;
SDropFuncReq
dropReq
=
{
0
};
if
(
tDeserializeSDropFuncReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSDropFuncReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -375,7 +375,7 @@ static int32_t mndProcessDropFuncReq(SNodeMsg *pReq) {
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -399,13 +399,13 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessRetrieveFuncReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessRetrieveFuncReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SRetrieveFuncReq
retrieveReq
=
{
0
};
SRetrieveFuncRsp
retrieveRsp
=
{
0
};
if
(
tDeserializeSRetrieveFuncReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
retrieveReq
)
!=
0
)
{
if
(
tDeserializeSRetrieveFuncReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
retrieveReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
RETRIEVE_FUNC_OVER
;
}
...
...
@@ -472,8 +472,8 @@ static int32_t mndProcessRetrieveFuncReq(SNodeMsg *pReq) {
tSerializeSRetrieveFuncRsp
(
pRsp
,
contLen
,
&
retrieveRsp
);
pReq
->
pR
sp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
pReq
->
info
.
r
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
contLen
;
code
=
0
;
...
...
@@ -502,8 +502,8 @@ static void *mnodeGenTypeStr(char *buf, int32_t buflen, uint8_t type, int16_t le
return
tDataTypes
[
type
].
name
;
}
static
int32_t
mndRetrieveFuncs
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveFuncs
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SFuncObj
*
pFunc
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndGrant.c
浏览文件 @
96b7f269
...
...
@@ -21,7 +21,7 @@
#include "mndShow.h"
#ifndef _GRANT
static
int32_t
mndRetrieveGrant
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
static
int32_t
mndRetrieveGrant
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
int32_t
mndInitGrant
(
SMnode
*
pMnode
)
{
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_GRANTS
,
mndRetrieveGrant
);
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
96b7f269
...
...
@@ -30,12 +30,12 @@ static SSdbRow *mndMnodeActionDecode(SSdbRaw *pRaw);
static
int32_t
mndMnodeActionInsert
(
SSdb
*
pSdb
,
SMnodeObj
*
pObj
);
static
int32_t
mndMnodeActionDelete
(
SSdb
*
pSdb
,
SMnodeObj
*
pObj
);
static
int32_t
mndMnodeActionUpdate
(
SSdb
*
pSdb
,
SMnodeObj
*
pOld
,
SMnodeObj
*
pNew
);
static
int32_t
mndProcessCreateMnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropMnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessCreateMnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessAlterMnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessDropMnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndRetrieveMnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndProcessCreateMnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropMnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessCreateMnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessAlterMnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessDropMnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndRetrieveMnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextMnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitMnode
(
SMnode
*
pMnode
)
{
...
...
@@ -337,7 +337,7 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
return
0
;
}
static
int32_t
mndCreateMnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SDnodeObj
*
pDnode
,
SMCreateMnodeReq
*
pCreate
)
{
static
int32_t
mndCreateMnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SDnodeObj
*
pDnode
,
SMCreateMnodeReq
*
pCreate
)
{
int32_t
code
=
-
1
;
SMnodeObj
mnodeObj
=
{
0
};
...
...
@@ -345,7 +345,7 @@ static int32_t mndCreateMnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
mnodeObj
.
createdTime
=
taosGetTimestampMs
();
mnodeObj
.
updateTime
=
mnodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_MNODE
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_MNODE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create mnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
...
...
@@ -362,15 +362,15 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateMnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateMnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SMnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateMnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -391,7 +391,7 @@ static int32_t mndProcessCreateMnodeReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -509,10 +509,10 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
return
0
;
}
static
int32_t
mndDropMnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SMnodeObj
*
pObj
)
{
static
int32_t
mndDropMnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SMnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_MNODE
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_MNODE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop mnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
...
...
@@ -529,14 +529,14 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessDropMnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessDropMnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SMnodeObj
*
pObj
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -563,7 +563,7 @@ static int32_t mndProcessDropMnodeReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -587,23 +587,23 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateMnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessCreateMnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndProcessAlterMnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessAlterMnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndProcessDropMnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessDropMnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndRetrieveMnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveMnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
...
...
source/dnode/mnode/impl/src/mndOffset.c
浏览文件 @
96b7f269
...
...
@@ -32,7 +32,7 @@
static
int32_t
mndOffsetActionInsert
(
SSdb
*
pSdb
,
SMqOffsetObj
*
pOffset
);
static
int32_t
mndOffsetActionDelete
(
SSdb
*
pSdb
,
SMqOffsetObj
*
pOffset
);
static
int32_t
mndOffsetActionUpdate
(
SSdb
*
pSdb
,
SMqOffsetObj
*
pOffset
,
SMqOffsetObj
*
pNewOffset
);
static
int32_t
mndProcessCommitOffsetReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessCommitOffsetReq
(
S
Rpc
Msg
*
pReq
);
int32_t
mndInitOffset
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_OFFSET
,
...
...
@@ -151,18 +151,18 @@ int32_t mndCreateOffsets(STrans *pTrans, const char *cgroup, const char *topicNa
return
0
;
}
static
int32_t
mndProcessCommitOffsetReq
(
S
Node
Msg
*
pMsg
)
{
static
int32_t
mndProcessCommitOffsetReq
(
S
Rpc
Msg
*
pMsg
)
{
char
key
[
TSDB_PARTITION_KEY_LEN
];
SMnode
*
pMnode
=
pMsg
->
pN
ode
;
char
*
msgStr
=
pMsg
->
rpcMsg
.
pCont
;
SMnode
*
pMnode
=
pMsg
->
info
.
n
ode
;
char
*
msgStr
=
pMsg
->
pCont
;
SMqCMCommitOffsetReq
commitOffsetReq
;
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
msgStr
,
pMsg
->
rpcMsg
.
contLen
);
tDecoderInit
(
&
decoder
,
msgStr
,
pMsg
->
contLen
);
tDecodeSMqCMCommitOffsetReq
(
&
decoder
,
&
commitOffsetReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_COMMIT_OFFSET
,
&
pMsg
->
rpc
Msg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_COMMIT_OFFSET
,
p
Msg
);
for
(
int32_t
i
=
0
;
i
<
commitOffsetReq
.
num
;
i
++
)
{
SMqOffset
*
pOffset
=
&
commitOffsetReq
.
offsets
[
i
];
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
96b7f269
...
...
@@ -16,11 +16,11 @@
#define _DEFAULT_SOURCE
#include "mndProfile.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndMnode.h"
#include "mndShow.h"
#include "mndStb.h"
#include "mndUser.h"
#include "mndDnode.h"
#include "tglobal.h"
#include "version.h"
...
...
@@ -38,7 +38,7 @@ typedef struct {
int64_t
lastAccessTimeMs
;
uint64_t
killId
;
int32_t
numOfQueries
;
SArray
*
pQueries
;
// SArray<SQueryDesc>
SArray
*
pQueries
;
// SArray<SQueryDesc>
}
SConnObj
;
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
const
char
*
user
,
int8_t
connType
,
uint32_t
ip
,
uint16_t
port
,
...
...
@@ -46,14 +46,14 @@ static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, int8_t connType
static
void
mndFreeConn
(
SConnObj
*
pConn
);
static
SConnObj
*
mndAcquireConn
(
SMnode
*
pMnode
,
uint32_t
connId
);
static
void
mndReleaseConn
(
SMnode
*
pMnode
,
SConnObj
*
pConn
);
static
void
*
mndGetNextConn
(
SMnode
*
pMnode
,
SCacheIter
*
pIter
);
static
void
*
mndGetNextConn
(
SMnode
*
pMnode
,
SCacheIter
*
pIter
);
static
void
mndCancelGetNextConn
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessHeartBeatReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessConnectReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessKillQueryReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessKillConnReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndRetrieveConns
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveQueries
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndProcessHeartBeatReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessConnectReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessKillQueryReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessKillConnReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndRetrieveConns
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveQueries
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextQuery
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitProfile
(
SMnode
*
pMnode
)
{
...
...
@@ -175,8 +175,8 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter) {
}
}
static
int32_t
mndProcessConnectReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessConnectReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SUserObj
*
pUser
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SConnObj
*
pConn
=
NULL
;
...
...
@@ -184,20 +184,21 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
SConnectReq
connReq
=
{
0
};
char
ip
[
30
]
=
{
0
};
if
(
tDeserializeSConnectReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
connReq
)
!=
0
)
{
if
(
tDeserializeSConnectReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
connReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CONN_OVER
;
}
taosIp2String
(
pReq
->
clientIp
,
ip
);
taosIp2String
(
pReq
->
c
onn
.
c
lientIp
,
ip
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
mError
(
"user:%s, failed to login while acquire user since %s"
,
pReq
->
user
,
terrstr
());
mError
(
"user:%s, failed to login while acquire user since %s"
,
pReq
->
conn
.
user
,
terrstr
());
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
->
user
,
connReq
.
passwd
,
pUser
->
pass
);
mError
(
"user:%s, failed to auth while acquire user, input:%s saved:%s"
,
pReq
->
conn
.
user
,
connReq
.
passwd
,
pUser
->
pass
);
code
=
TSDB_CODE_RPC_AUTH_FAILURE
;
goto
CONN_OVER
;
}
...
...
@@ -208,15 +209,15 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
pDb
=
mndAcquireDb
(
pMnode
,
db
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB
;
mError
(
"user:%s, failed to login from %s while use db:%s since %s"
,
pReq
->
user
,
ip
,
connReq
.
db
,
terrstr
());
mError
(
"user:%s, failed to login from %s while use db:%s since %s"
,
pReq
->
conn
.
user
,
ip
,
connReq
.
db
,
terrstr
());
goto
CONN_OVER
;
}
}
pConn
=
mndCreateConn
(
pMnode
,
pReq
->
user
,
connReq
.
connType
,
pReq
->
clientIp
,
pReq
->
clientPort
,
connReq
.
pid
,
connReq
.
app
,
connReq
.
startTime
);
pConn
=
mndCreateConn
(
pMnode
,
pReq
->
conn
.
user
,
connReq
.
connType
,
pReq
->
conn
.
clientIp
,
pReq
->
conn
.
clientPort
,
connReq
.
pid
,
connReq
.
app
,
connReq
.
startTime
);
if
(
pConn
==
NULL
)
{
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
pReq
->
user
,
ip
,
terrstr
());
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
pReq
->
conn
.
user
,
ip
,
terrstr
());
goto
CONN_OVER
;
}
...
...
@@ -240,10 +241,10 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
if
(
pRsp
==
NULL
)
goto
CONN_OVER
;
tSerializeSConnectRsp
(
pRsp
,
contLen
,
&
connectRsp
);
pReq
->
rspLen
=
contLen
;
pReq
->
pR
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
contLen
;
pReq
->
info
.
r
sp
=
pRsp
;
mDebug
(
"user:%s, login from %s:%d, conn:%u, app:%s"
,
pReq
->
user
,
ip
,
pConn
->
port
,
pConn
->
id
,
connReq
.
app
);
mDebug
(
"user:%s, login from %s:%d, conn:%u, app:%s"
,
pReq
->
conn
.
user
,
ip
,
pConn
->
port
,
pConn
->
id
,
connReq
.
app
);
code
=
0
;
...
...
@@ -341,7 +342,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
SQueryHbReqBasic
*
pBasic
=
pHbReq
->
query
;
SRpcConnInfo
connInfo
=
{
0
};
rpcGetConnInfo
(
pMsg
->
handle
,
&
connInfo
);
rpcGetConnInfo
(
pMsg
->
info
.
handle
,
&
connInfo
);
SConnObj
*
pConn
=
mndAcquireConn
(
pMnode
,
pBasic
->
connId
);
if
(
pConn
==
NULL
)
{
...
...
@@ -406,7 +407,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
switch
(
kv
->
key
)
{
case
HEARTBEAT_KEY_USER_AUTHINFO
:
{
void
*
rspMsg
=
NULL
;
void
*
rspMsg
=
NULL
;
int32_t
rspLen
=
0
;
mndValidateUserAuthInfo
(
pMnode
,
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SUserAuthVersion
),
&
rspMsg
,
&
rspLen
);
if
(
rspMsg
&&
rspLen
>
0
)
{
...
...
@@ -416,7 +417,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
break
;
}
case
HEARTBEAT_KEY_DBINFO
:
{
void
*
rspMsg
=
NULL
;
void
*
rspMsg
=
NULL
;
int32_t
rspLen
=
0
;
mndValidateDbInfo
(
pMnode
,
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SDbVgVersion
),
&
rspMsg
,
&
rspLen
);
if
(
rspMsg
&&
rspLen
>
0
)
{
...
...
@@ -426,7 +427,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
break
;
}
case
HEARTBEAT_KEY_STBINFO
:
{
void
*
rspMsg
=
NULL
;
void
*
rspMsg
=
NULL
;
int32_t
rspLen
=
0
;
mndValidateStbInfo
(
pMnode
,
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SSTableMetaVersion
),
&
rspMsg
,
&
rspLen
);
if
(
rspMsg
&&
rspLen
>
0
)
{
...
...
@@ -449,11 +450,11 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mndProcessHeartBeatReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessHeartBeatReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SClientHbBatchReq
batchReq
=
{
0
};
if
(
tDeserializeSClientHbBatchReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
batchReq
)
!=
0
)
{
if
(
tDeserializeSClientHbBatchReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
batchReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -465,7 +466,7 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) {
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SClientHbReq
*
pHbReq
=
taosArrayGet
(
batchReq
.
reqs
,
i
);
if
(
pHbReq
->
connKey
.
connType
==
CONN_TYPE__QUERY
)
{
mndProcessQueryHeartBeat
(
pMnode
,
&
pReq
->
rpcMsg
,
pHbReq
,
&
batchRsp
);
mndProcessQueryHeartBeat
(
pMnode
,
pReq
,
pHbReq
,
&
batchRsp
);
}
else
if
(
pHbReq
->
connKey
.
connType
==
CONN_TYPE__TMQ
)
{
SClientHbRsp
*
pRsp
=
mndMqHbBuildRsp
(
pMnode
,
pHbReq
);
if
(
pRsp
!=
NULL
)
{
...
...
@@ -492,17 +493,17 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) {
}
taosArrayDestroy
(
batchRsp
.
rsps
);
pReq
->
rspLen
=
tlen
;
pReq
->
pR
sp
=
buf
;
pReq
->
info
.
rspLen
=
tlen
;
pReq
->
info
.
r
sp
=
buf
;
return
0
;
}
static
int32_t
mndProcessKillQueryReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessKillQueryReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
return
0
;
if
(
!
pUser
->
superUser
)
{
mndReleaseUser
(
pMnode
,
pUser
);
...
...
@@ -512,7 +513,7 @@ static int32_t mndProcessKillQueryReq(SNodeMsg *pReq) {
mndReleaseUser
(
pMnode
,
pUser
);
SKillQueryReq
killReq
=
{
0
};
if
(
tDeserializeSKillQueryReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
killReq
)
!=
0
)
{
if
(
tDeserializeSKillQueryReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
killReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -525,18 +526,18 @@ static int32_t mndProcessKillQueryReq(SNodeMsg *pReq) {
terrno
=
TSDB_CODE_MND_INVALID_CONN_ID
;
return
-
1
;
}
else
{
mInfo
(
"connId:%d, queryId:%d is killed by user:%s"
,
killReq
.
connId
,
killReq
.
queryId
,
pReq
->
user
);
mInfo
(
"connId:%d, queryId:%d is killed by user:%s"
,
killReq
.
connId
,
killReq
.
queryId
,
pReq
->
conn
.
user
);
pConn
->
killId
=
killReq
.
queryId
;
taosCacheRelease
(
pMgmt
->
cache
,
(
void
**
)
&
pConn
,
false
);
return
0
;
}
}
static
int32_t
mndProcessKillConnReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessKillConnReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
return
0
;
if
(
!
pUser
->
superUser
)
{
mndReleaseUser
(
pMnode
,
pUser
);
...
...
@@ -546,7 +547,7 @@ static int32_t mndProcessKillConnReq(SNodeMsg *pReq) {
mndReleaseUser
(
pMnode
,
pUser
);
SKillConnReq
killReq
=
{
0
};
if
(
tDeserializeSKillConnReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
killReq
)
!=
0
)
{
if
(
tDeserializeSKillConnReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
killReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -557,15 +558,15 @@ static int32_t mndProcessKillConnReq(SNodeMsg *pReq) {
terrno
=
TSDB_CODE_MND_INVALID_CONN_ID
;
return
-
1
;
}
else
{
mInfo
(
"connId:%d, is killed by user:%s"
,
killReq
.
connId
,
pReq
->
user
);
mInfo
(
"connId:%d, is killed by user:%s"
,
killReq
.
connId
,
pReq
->
conn
.
user
);
pConn
->
killed
=
1
;
taosCacheRelease
(
pMgmt
->
cache
,
(
void
**
)
&
pConn
,
false
);
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
mndRetrieveConns
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveConns
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
numOfRows
=
0
;
SConnObj
*
pConn
=
NULL
;
int32_t
cols
=
0
;
...
...
@@ -624,9 +625,9 @@ static int32_t mndRetrieveConns(SNodeMsg *pReq, SShowObj *pShow, char *data, int
return
numOfRows
;
}
static
int32_t
mndRetrieveQueries
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
int32_t
numOfRows
=
0
;
static
int32_t
mndRetrieveQueries
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
numOfRows
=
0
;
#if 0
SConnObj *pConn = NULL;
int32_t cols = 0;
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
96b7f269
...
...
@@ -29,12 +29,12 @@ static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw);
static
int32_t
mndQnodeActionInsert
(
SSdb
*
pSdb
,
SQnodeObj
*
pObj
);
static
int32_t
mndQnodeActionUpdate
(
SSdb
*
pSdb
,
SQnodeObj
*
pOld
,
SQnodeObj
*
pNew
);
static
int32_t
mndQnodeActionDelete
(
SSdb
*
pSdb
,
SQnodeObj
*
pObj
);
static
int32_t
mndProcessCreateQnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessCreateQnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessDropQnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropQnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessQnodeListReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndRetrieveQnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndProcessCreateQnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessCreateQnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessDropQnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropQnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessQnodeListReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndRetrieveQnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextQnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitQnode
(
SMnode
*
pMnode
)
{
...
...
@@ -240,7 +240,7 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
return
0
;
}
static
int32_t
mndCreateQnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SDnodeObj
*
pDnode
,
SMCreateQnodeReq
*
pCreate
)
{
static
int32_t
mndCreateQnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SDnodeObj
*
pDnode
,
SMCreateQnodeReq
*
pCreate
)
{
int32_t
code
=
-
1
;
SQnodeObj
qnodeObj
=
{
0
};
...
...
@@ -248,7 +248,7 @@ static int32_t mndCreateQnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
qnodeObj
.
createdTime
=
taosGetTimestampMs
();
qnodeObj
.
updateTime
=
qnodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_QNODE
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_QNODE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create qnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
...
...
@@ -266,15 +266,15 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateQnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateQnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SQnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateQnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -295,7 +295,7 @@ static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -362,10 +362,10 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
return
0
;
}
static
int32_t
mndDropQnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SQnodeObj
*
pObj
)
{
static
int32_t
mndDropQnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SQnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_QNODE
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_QNODE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop qnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
...
...
@@ -381,14 +381,14 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessDropQnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessDropQnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SQnodeObj
*
pObj
=
NULL
;
SMDropQnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -405,7 +405,7 @@ static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -429,16 +429,16 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessQnodeListReq
(
S
Node
Msg
*
pReq
)
{
static
int32_t
mndProcessQnodeListReq
(
S
Rpc
Msg
*
pReq
)
{
int32_t
code
=
-
1
;
int32_t
numOfRows
=
0
;
SMnode
*
pMnode
=
pReq
->
pN
ode
;
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SQnodeObj
*
pObj
=
NULL
;
SQnodeListReq
qlistReq
=
{
0
};
SQnodeListRsp
qlistRsp
=
{
0
};
if
(
tDeserializeSQnodeListReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
qlistReq
)
!=
0
)
{
if
(
tDeserializeSQnodeListReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
qlistReq
)
!=
0
)
{
mError
(
"failed to parse qnode list req"
);
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
...
...
@@ -481,8 +481,8 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
tSerializeSQnodeListRsp
(
pRsp
,
rspLen
,
&
qlistRsp
);
pReq
->
rspLen
=
rspLen
;
pReq
->
pR
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
rspLen
;
pReq
->
info
.
r
sp
=
pRsp
;
code
=
0
;
_OVER:
...
...
@@ -490,18 +490,18 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateQnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessCreateQnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndProcessDropQnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessDropQnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndRetrieveQnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveQnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
...
...
source/dnode/mnode/impl/src/mndQuery.c
浏览文件 @
96b7f269
...
...
@@ -18,35 +18,35 @@
#include "mndMnode.h"
#include "qworker.h"
int32_t
mndProcessQueryMsg
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
int32_t
mndProcessQueryMsg
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SReadHandle
handle
=
{.
mnd
=
pMnode
,
.
pMsgCb
=
&
pMnode
->
msgCb
};
mTrace
(
"msg:%p, in query queue is processing"
,
pReq
);
switch
(
pReq
->
rpcMsg
.
msgType
)
{
switch
(
pReq
->
msgType
)
{
case
TDMT_VND_QUERY
:
return
qWorkerProcessQueryMsg
(
&
handle
,
pMnode
->
pQuery
,
&
pReq
->
rpcMsg
);
return
qWorkerProcessQueryMsg
(
&
handle
,
pMnode
->
pQuery
,
pReq
);
case
TDMT_VND_QUERY_CONTINUE
:
return
qWorkerProcessCQueryMsg
(
&
handle
,
pMnode
->
pQuery
,
&
pReq
->
rpcMsg
);
return
qWorkerProcessCQueryMsg
(
&
handle
,
pMnode
->
pQuery
,
pReq
);
default:
mError
(
"unknown msg type:%d in query queue"
,
pReq
->
rpcMsg
.
msgType
);
mError
(
"unknown msg type:%d in query queue"
,
pReq
->
msgType
);
return
TSDB_CODE_VND_APP_ERROR
;
}
}
int32_t
mndProcessFetchMsg
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
int32_t
mndProcessFetchMsg
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
mTrace
(
"msg:%p, in fetch queue is processing"
,
pReq
);
switch
(
pReq
->
rpcMsg
.
msgType
)
{
switch
(
pReq
->
msgType
)
{
case
TDMT_VND_FETCH
:
return
qWorkerProcessFetchMsg
(
pMnode
,
pMnode
->
pQuery
,
&
pReq
->
rpcMsg
);
return
qWorkerProcessFetchMsg
(
pMnode
,
pMnode
->
pQuery
,
pReq
);
case
TDMT_VND_DROP_TASK
:
return
qWorkerProcessDropMsg
(
pMnode
,
pMnode
->
pQuery
,
&
pReq
->
rpcMsg
);
return
qWorkerProcessDropMsg
(
pMnode
,
pMnode
->
pQuery
,
pReq
);
case
TDMT_VND_QUERY_HEARTBEAT
:
return
qWorkerProcessHbMsg
(
pMnode
,
pMnode
->
pQuery
,
&
pReq
->
rpcMsg
);
return
qWorkerProcessHbMsg
(
pMnode
,
pMnode
->
pQuery
,
pReq
);
default:
mError
(
"unknown msg type:%d in fetch queue"
,
pReq
->
rpcMsg
.
msgType
);
mError
(
"unknown msg type:%d in fetch queue"
,
pReq
->
msgType
);
return
TSDB_CODE_VND_APP_ERROR
;
}
}
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
96b7f269
...
...
@@ -24,7 +24,7 @@ static void mndFreeShowObj(SShowObj *pShow);
static
SShowObj
*
mndAcquireShowObj
(
SMnode
*
pMnode
,
int64_t
showId
);
static
void
mndReleaseShowObj
(
SShowObj
*
pShow
,
bool
forceRemove
);
static
bool
mndCheckRetrieveFinished
(
SShowObj
*
pShow
);
static
int32_t
mndProcessRetrieveSysTableReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessRetrieveSysTableReq
(
S
Rpc
Msg
*
pReq
);
int32_t
mndInitShow
(
SMnode
*
pMnode
)
{
SShowMgmt
*
pMgmt
=
&
pMnode
->
showMgmt
;
...
...
@@ -175,8 +175,8 @@ static void mndReleaseShowObj(SShowObj *pShow, bool forceRemove) {
taosCacheRelease
(
pMgmt
->
cache
,
(
void
**
)(
&
pShow
),
forceRemove
);
}
static
int32_t
mndProcessRetrieveSysTableReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessRetrieveSysTableReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SShowMgmt
*
pMgmt
=
&
pMnode
->
showMgmt
;
SShowObj
*
pShow
=
NULL
;
int32_t
rowsToRead
=
SHOW_STEP_SIZE
;
...
...
@@ -184,7 +184,7 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
int32_t
rowsRead
=
0
;
SRetrieveTableReq
retrieveReq
=
{
0
};
if
(
tDeserializeSRetrieveTableReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
retrieveReq
)
!=
0
)
{
if
(
tDeserializeSRetrieveTableReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
retrieveReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -300,8 +300,8 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) {
pRsp
->
numOfRows
=
htonl
(
rowsRead
);
pRsp
->
precision
=
TSDB_TIME_PRECISION_MILLI
;
// millisecond time precision
pReq
->
pR
sp
=
pRsp
;
pReq
->
rspLen
=
size
;
pReq
->
info
.
r
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
size
;
if
(
rowsRead
==
0
||
rowsRead
<
rowsToRead
)
{
pRsp
->
completed
=
1
;
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
96b7f269
...
...
@@ -36,12 +36,12 @@ static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw);
static
int32_t
mndSmaActionInsert
(
SSdb
*
pSdb
,
SSmaObj
*
pSma
);
static
int32_t
mndSmaActionDelete
(
SSdb
*
pSdb
,
SSmaObj
*
pSpSmatb
);
static
int32_t
mndSmaActionUpdate
(
SSdb
*
pSdb
,
SSmaObj
*
pOld
,
SSmaObj
*
pNew
);
static
int32_t
mndProcessMCreateSmaReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessMDropSmaReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessVCreateSmaRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessVDropSmaRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessGetSmaReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndRetrieveSma
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndProcessMCreateSmaReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessMDropSmaReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessVCreateSmaRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessVDropSmaRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessGetSmaReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndRetrieveSma
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextSma
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitSma
(
SMnode
*
pMnode
)
{
...
...
@@ -361,7 +361,7 @@ static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
}
static
int32_t
mndCreateSma
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SMCreateSmaReq
*
pCreate
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
static
int32_t
mndCreateSma
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SMCreateSmaReq
*
pCreate
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
SSmaObj
smaObj
=
{
0
};
memcpy
(
smaObj
.
name
,
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
memcpy
(
smaObj
.
stb
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
);
...
...
@@ -421,7 +421,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SNodeMsg *pReq, SMCreateSmaReq *pCre
/*streamObj.physicalPlan = "";*/
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_SMA
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_SMA
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create sma:%s"
,
pTrans
->
id
,
pCreate
->
name
);
...
...
@@ -469,8 +469,8 @@ static int32_t mndCheckCreateSmaReq(SMCreateSmaReq *pCreate) {
return
0
;
}
static
int32_t
mndProcessMCreateSmaReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessMCreateSmaReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SStbObj
*
pStb
=
NULL
;
SSmaObj
*
pSma
=
NULL
;
...
...
@@ -479,7 +479,7 @@ static int32_t mndProcessMCreateSmaReq(SNodeMsg *pReq) {
SUserObj
*
pUser
=
NULL
;
SMCreateSmaReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateSmaReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSMCreateSmaReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -519,7 +519,7 @@ static int32_t mndProcessMCreateSmaReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -546,7 +546,7 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessVCreateSmaRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessVCreateSmaRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
...
...
@@ -610,9 +610,9 @@ static int32_t mndSetDropSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
return
0
;
}
static
int32_t
mndDropSma
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SDbObj
*
pDb
,
SSmaObj
*
pSma
)
{
static
int32_t
mndDropSma
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SDbObj
*
pDb
,
SSmaObj
*
pSma
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_SMA
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_SMA
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop sma:%s"
,
pTrans
->
id
,
pSma
->
name
);
...
...
@@ -630,15 +630,15 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessMDropSmaReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessMDropSmaReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SSmaObj
*
pSma
=
NULL
;
SMDropSmaReq
dropReq
=
{
0
};
if
(
tDeserializeSMDropSmaReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSMDropSmaReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -663,7 +663,7 @@ static int32_t mndProcessMDropSmaReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -719,14 +719,14 @@ static int32_t mndGetSma(SMnode *pMnode, SUserIndexReq *indexReq, SUserIndexRsp
return
code
;
}
static
int32_t
mndProcessGetSmaReq
(
S
Node
Msg
*
pReq
)
{
static
int32_t
mndProcessGetSmaReq
(
S
Rpc
Msg
*
pReq
)
{
SUserIndexReq
indexReq
=
{
0
};
SMnode
*
pMnode
=
pReq
->
pN
ode
;
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserIndexRsp
rsp
=
{
0
};
bool
exist
=
false
;
if
(
tDeserializeSUserIndexReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
indexReq
)
!=
0
)
{
if
(
tDeserializeSUserIndexReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
indexReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -751,8 +751,8 @@ static int32_t mndProcessGetSmaReq(SNodeMsg *pReq) {
tSerializeSUserIndexRsp
(
pRsp
,
contLen
,
&
rsp
);
pReq
->
pR
sp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
pReq
->
info
.
r
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
contLen
;
code
=
0
;
}
...
...
@@ -765,13 +765,13 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessVDropSmaRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessVDropSmaRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndRetrieveSma
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveSma
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SSmaObj
*
pSma
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
96b7f269
...
...
@@ -29,11 +29,11 @@ static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw);
static
int32_t
mndSnodeActionInsert
(
SSdb
*
pSdb
,
SSnodeObj
*
pObj
);
static
int32_t
mndSnodeActionUpdate
(
SSdb
*
pSdb
,
SSnodeObj
*
pOld
,
SSnodeObj
*
pNew
);
static
int32_t
mndSnodeActionDelete
(
SSdb
*
pSdb
,
SSnodeObj
*
pObj
);
static
int32_t
mndProcessCreateSnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessCreateSnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessDropSnodeReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropSnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndRetrieveSnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndProcessCreateSnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessCreateSnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessDropSnodeReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropSnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndRetrieveSnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextSnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitSnode
(
SMnode
*
pMnode
)
{
...
...
@@ -245,7 +245,7 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
return
0
;
}
static
int32_t
mndCreateSnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SDnodeObj
*
pDnode
,
SMCreateSnodeReq
*
pCreate
)
{
static
int32_t
mndCreateSnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SDnodeObj
*
pDnode
,
SMCreateSnodeReq
*
pCreate
)
{
int32_t
code
=
-
1
;
SSnodeObj
snodeObj
=
{
0
};
...
...
@@ -253,7 +253,7 @@ static int32_t mndCreateSnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
snodeObj
.
createdTime
=
taosGetTimestampMs
();
snodeObj
.
updateTime
=
snodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_SNODE
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_SNODE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create snode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
...
...
@@ -272,15 +272,15 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateSnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateSnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SSnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateSnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -301,7 +301,7 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -369,10 +369,10 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
return
0
;
}
static
int32_t
mndDropSnode
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SSnodeObj
*
pObj
)
{
static
int32_t
mndDropSnode
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SSnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_SNODE
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_DROP_SNODE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop snode:%d"
,
pTrans
->
id
,
pObj
->
id
);
...
...
@@ -389,14 +389,14 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessDropSnodeReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessDropSnodeReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SSnodeObj
*
pObj
=
NULL
;
SMDropSnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -413,7 +413,7 @@ static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -437,18 +437,18 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateSnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessCreateSnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndProcessDropSnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessDropSnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndRetrieveSnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveSnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
cols
=
0
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
96b7f269
...
...
@@ -35,14 +35,14 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw);
static
int32_t
mndStbActionInsert
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionDelete
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionUpdate
(
SSdb
*
pSdb
,
SStbObj
*
pOld
,
SStbObj
*
pNew
);
static
int32_t
mndProcessMCreateStbReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessMAlterStbReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessMDropStbReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessVCreateStbRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessVAlterStbRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessVDropStbRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessTableMetaReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndRetrieveStb
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndProcessMCreateStbReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessMAlterStbReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessMDropStbReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessVCreateStbRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessVAlterStbRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessVDropStbRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessTableMetaReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndRetrieveStb
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextStb
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitStb
(
SMnode
*
pMnode
)
{
...
...
@@ -718,12 +718,12 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat
return
0
;
}
static
int32_t
mndCreateStb
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SMCreateStbReq
*
pCreate
,
SDbObj
*
pDb
)
{
static
int32_t
mndCreateStb
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SMCreateStbReq
*
pCreate
,
SDbObj
*
pDb
)
{
SStbObj
stbObj
=
{
0
};
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_STB
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_STB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create stb:%s"
,
pTrans
->
id
,
pCreate
->
name
);
...
...
@@ -753,15 +753,15 @@ int32_t mndAddStbToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *p
return
0
;
}
static
int32_t
mndProcessMCreateStbReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessMCreateStbReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SStbObj
*
pStb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateStbReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSMCreateStbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -792,7 +792,7 @@ static int32_t mndProcessMCreateStbReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -827,7 +827,7 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessVCreateStbRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessVCreateStbRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
...
...
@@ -1197,7 +1197,7 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
}
static
int32_t
mndAlterStb
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
const
SMAlterStbReq
*
pAlter
,
SDbObj
*
pDb
,
SStbObj
*
pOld
)
{
static
int32_t
mndAlterStb
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
const
SMAlterStbReq
*
pAlter
,
SDbObj
*
pDb
,
SStbObj
*
pOld
)
{
SStbObj
stbObj
=
{
0
};
taosRLockLatch
(
&
pOld
->
lock
);
memcpy
(
&
stbObj
,
pOld
,
sizeof
(
SStbObj
));
...
...
@@ -1247,7 +1247,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SNodeMsg *pReq, const SMAlterStbReq *
if
(
code
!=
0
)
goto
_OVER
;
code
=
-
1
;
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_ALTER_STB
,
&
pReq
->
rpcMsg
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_ALTER_STB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to alter stb:%s"
,
pTrans
->
id
,
pAlter
->
name
);
...
...
@@ -1267,15 +1267,15 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessMAlterStbReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessMAlterStbReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMAlterStbReq
alterReq
=
{
0
};
if
(
tDeserializeSMAlterStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
{
if
(
tDeserializeSMAlterStbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -1295,7 +1295,7 @@ static int32_t mndProcessMAlterStbReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -1320,7 +1320,7 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessVAlterStbRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessVAlterStbRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
...
...
@@ -1383,9 +1383,9 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
return
0
;
}
static
int32_t
mndDropStb
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
static
int32_t
mndDropStb
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_STB
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_STB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
...
...
@@ -1403,15 +1403,15 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessMDropStbReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessMDropStbReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SMDropStbReq
dropReq
=
{
0
};
if
(
tDeserializeSMDropStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSMDropStbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -1436,7 +1436,7 @@ static int32_t mndProcessMDropStbReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -1460,7 +1460,7 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessVDropStbRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessVDropStbRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
...
...
@@ -1533,13 +1533,13 @@ static int32_t mndBuildStbSchema(SMnode *pMnode, const char *dbFName, const char
return
code
;
}
static
int32_t
mndProcessTableMetaReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessTableMetaReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
STableInfoReq
infoReq
=
{
0
};
STableMetaRsp
metaRsp
=
{
0
};
if
(
tDeserializeSTableInfoReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
infoReq
)
!=
0
)
{
if
(
tDeserializeSTableInfoReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
infoReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -1574,8 +1574,8 @@ static int32_t mndProcessTableMetaReq(SNodeMsg *pReq) {
}
tSerializeSTableMetaRsp
(
pRsp
,
rspLen
,
&
metaRsp
);
pReq
->
pR
sp
=
pRsp
;
pReq
->
rspLen
=
rspLen
;
pReq
->
info
.
r
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
rspLen
;
code
=
0
;
mDebug
(
"stb:%s.%s, meta is retrieved"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
...
...
@@ -1676,8 +1676,8 @@ static void mndExtractTableName(char *tableId, char *name) {
}
}
static
int32_t
mndRetrieveStb
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveStb
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SStbObj
*
pStb
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
96b7f269
...
...
@@ -34,13 +34,13 @@
static
int32_t
mndStreamActionInsert
(
SSdb
*
pSdb
,
SStreamObj
*
pStream
);
static
int32_t
mndStreamActionDelete
(
SSdb
*
pSdb
,
SStreamObj
*
pStream
);
static
int32_t
mndStreamActionUpdate
(
SSdb
*
pSdb
,
SStreamObj
*
pStream
,
SStreamObj
*
pNewStream
);
static
int32_t
mndProcessCreateStreamReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessTaskDeployInternalRsp
(
S
Node
Msg
*
pRsp
);
/*static int32_t mndProcessDropStreamReq(S
Node
Msg *pReq);*/
/*static int32_t mndProcessDropStreamInRsp(S
Node
Msg *pRsp);*/
static
int32_t
mndProcessStreamMetaReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndGetStreamMeta
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveStream
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndProcessCreateStreamReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessTaskDeployInternalRsp
(
S
Rpc
Msg
*
pRsp
);
/*static int32_t mndProcessDropStreamReq(S
Rpc
Msg *pReq);*/
/*static int32_t mndProcessDropStreamInRsp(S
Rpc
Msg *pRsp);*/
static
int32_t
mndProcessStreamMetaReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndGetStreamMeta
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveStream
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextStream
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitStream
(
SMnode
*
pMnode
)
{
...
...
@@ -195,7 +195,7 @@ void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream) {
sdbRelease
(
pSdb
,
pStream
);
}
static
int32_t
mndProcessTaskDeployInternalRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessTaskDeployInternalRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
...
...
@@ -372,7 +372,7 @@ _OVER:
return
-
1
;
}
static
int32_t
mndCreateStream
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SCMCreateStreamReq
*
pCreate
,
SDbObj
*
pDb
)
{
static
int32_t
mndCreateStream
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SCMCreateStreamReq
*
pCreate
,
SDbObj
*
pDb
)
{
mDebug
(
"stream:%s to create"
,
pCreate
->
name
);
SStreamObj
streamObj
=
{
0
};
tstrncpy
(
streamObj
.
name
,
pCreate
->
name
,
TSDB_STREAM_FNAME_LEN
);
...
...
@@ -393,7 +393,7 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe
streamObj
.
trigger
=
pCreate
->
triggerType
;
streamObj
.
waterMark
=
pCreate
->
watermark
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_STREAM
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_STREAM
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"stream:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
...
...
@@ -406,7 +406,7 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe
return
-
1
;
}
if
(
streamObj
.
targetSTbName
[
0
]
&&
mndCreateStbForStream
(
pMnode
,
pTrans
,
&
streamObj
,
pReq
->
user
)
<
0
)
{
if
(
streamObj
.
targetSTbName
[
0
]
&&
mndCreateStbForStream
(
pMnode
,
pTrans
,
&
streamObj
,
pReq
->
conn
.
user
)
<
0
)
{
mError
(
"trans:%d, failed to create stb for stream since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
...
...
@@ -422,15 +422,15 @@ static int32_t mndCreateStream(SMnode *pMnode, SNodeMsg *pReq, SCMCreateStreamRe
return
0
;
}
static
int32_t
mndProcessCreateStreamReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateStreamReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SStreamObj
*
pStream
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SCMCreateStreamReq
createStreamReq
=
{
0
};
if
(
tDeserializeSCMCreateStreamReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createStreamReq
)
!=
0
)
{
if
(
tDeserializeSCMCreateStreamReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createStreamReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_STREAM_OVER
;
}
...
...
@@ -462,7 +462,7 @@ static int32_t mndProcessCreateStreamReq(SNodeMsg *pReq) {
goto
CREATE_STREAM_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
CREATE_STREAM_OVER
;
}
...
...
@@ -514,8 +514,8 @@ static int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfS
return
0
;
}
static
int32_t
mndRetrieveStream
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveStream
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SStreamObj
*
pStream
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
96b7f269
...
...
@@ -41,10 +41,10 @@ static int32_t mndSubActionInsert(SSdb *pSdb, SMqSubscribeObj *);
static
int32_t
mndSubActionDelete
(
SSdb
*
pSdb
,
SMqSubscribeObj
*
);
static
int32_t
mndSubActionUpdate
(
SSdb
*
pSdb
,
SMqSubscribeObj
*
pOldSub
,
SMqSubscribeObj
*
pNewSub
);
static
int32_t
mndProcessRebalanceReq
(
S
Node
Msg
*
pMsg
);
static
int32_t
mndProcessSubscribeInternalRsp
(
S
Node
Msg
*
pMsg
);
static
int32_t
mndProcessRebalanceReq
(
S
Rpc
Msg
*
pMsg
);
static
int32_t
mndProcessSubscribeInternalRsp
(
S
Rpc
Msg
*
pMsg
);
static
int32_t
mndRetrieveSubscribe
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveSubscribe
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextSubscribe
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndSetSubRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqSubscribeObj
*
pSub
)
{
...
...
@@ -388,8 +388,8 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
return
0
;
}
static
int32_t
mndPersistRebResult
(
SMnode
*
pMnode
,
S
Node
Msg
*
pMsg
,
const
SMqRebOutputObj
*
pOutput
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_REBALANCE
,
&
pMsg
->
rpc
Msg
);
static
int32_t
mndPersistRebResult
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pMsg
,
const
SMqRebOutputObj
*
pOutput
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_REBALANCE
,
p
Msg
);
if
(
pTrans
==
NULL
)
{
return
-
1
;
}
...
...
@@ -474,9 +474,9 @@ REB_FAIL:
return
-
1
;
}
static
int32_t
mndProcessRebalanceReq
(
S
Node
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pN
ode
;
SMqDoRebalanceMsg
*
pReq
=
pMsg
->
rpcMsg
.
pCont
;
static
int32_t
mndProcessRebalanceReq
(
S
Rpc
Msg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
n
ode
;
SMqDoRebalanceMsg
*
pReq
=
pMsg
->
pCont
;
void
*
pIter
=
NULL
;
mInfo
(
"mq rebalance start"
);
...
...
@@ -683,7 +683,7 @@ void mndReleaseSubscribe(SMnode *pMnode, SMqSubscribeObj *pSub) {
sdbRelease
(
pSdb
,
pSub
);
}
static
int32_t
mndProcessSubscribeInternalRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessSubscribeInternalRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
...
...
@@ -721,8 +721,8 @@ END:
return
code
;
}
static
int32_t
mndRetrieveSubscribe
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveSubscribe
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SMqSubscribeObj
*
pSub
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndTelem.c
浏览文件 @
96b7f269
...
...
@@ -122,8 +122,8 @@ static char* mndBuildTelemetryReport(SMnode* pMnode) {
return
pCont
;
}
static
int32_t
mndProcessTelemTimer
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessTelemTimer
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
STelemMgmt
*
pMgmt
=
&
pMnode
->
telemMgmt
;
if
(
!
tsEnableTelem
)
return
0
;
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
96b7f269
...
...
@@ -32,11 +32,11 @@
static
int32_t
mndTopicActionInsert
(
SSdb
*
pSdb
,
SMqTopicObj
*
pTopic
);
static
int32_t
mndTopicActionDelete
(
SSdb
*
pSdb
,
SMqTopicObj
*
pTopic
);
static
int32_t
mndTopicActionUpdate
(
SSdb
*
pSdb
,
SMqTopicObj
*
pTopic
,
SMqTopicObj
*
pNewTopic
);
static
int32_t
mndProcessCreateTopicReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropTopicReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropTopicInRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessCreateTopicReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropTopicReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropTopicInRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndRetrieveTopic
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveTopic
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextTopic
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndSetDropTopicCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
);
...
...
@@ -280,7 +280,7 @@ static int32_t mndCheckCreateTopicReq(SCMCreateTopicReq *pCreate) {
return
0
;
}
static
int32_t
mndCreateTopic
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SCMCreateTopicReq
*
pCreate
,
SDbObj
*
pDb
)
{
static
int32_t
mndCreateTopic
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SCMCreateTopicReq
*
pCreate
,
SDbObj
*
pDb
)
{
mDebug
(
"topic:%s to create"
,
pCreate
->
name
);
SMqTopicObj
topicObj
=
{
0
};
tstrncpy
(
topicObj
.
name
,
pCreate
->
name
,
TSDB_TOPIC_FNAME_LEN
);
...
...
@@ -340,7 +340,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
topicObj
.
withSchema
=
1
;
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_TOPIC
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_TOPIC
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
taosMemoryFreeClear
(
topicObj
.
ast
);
...
...
@@ -371,15 +371,15 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
return
0
;
}
static
int32_t
mndProcessCreateTopicReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateTopicReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SMqTopicObj
*
pTopic
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SCMCreateTopicReq
createTopicReq
=
{
0
};
if
(
tDeserializeSCMCreateTopicReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createTopicReq
)
!=
0
)
{
if
(
tDeserializeSCMCreateTopicReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createTopicReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_TOPIC_OVER
;
}
...
...
@@ -411,7 +411,7 @@ static int32_t mndProcessCreateTopicReq(SNodeMsg *pReq) {
goto
CREATE_TOPIC_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
CREATE_TOPIC_OVER
;
}
...
...
@@ -436,9 +436,9 @@ CREATE_TOPIC_OVER:
return
code
;
}
static
int32_t
mndDropTopic
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SMqTopicObj
*
pTopic
)
{
static
int32_t
mndDropTopic
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SMqTopicObj
*
pTopic
)
{
// TODO: cannot drop when subscribed
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_TOPIC
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_TOPIC
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"topic:%s, failed to drop since %s"
,
pTopic
->
name
,
terrstr
());
return
-
1
;
...
...
@@ -463,11 +463,11 @@ static int32_t mndDropTopic(SMnode *pMnode, SNodeMsg *pReq, SMqTopicObj *pTopic)
return
0
;
}
static
int32_t
mndProcessDropTopicReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessDropTopicReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SMDropTopicReq
dropReq
=
{
0
};
if
(
tDeserializeSMDropTopicReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSMDropTopicReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
@@ -500,7 +500,7 @@ static int32_t mndProcessDropTopicReq(SNodeMsg *pReq) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
int32_t
mndProcessDropTopicInRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessDropTopicInRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
...
...
@@ -532,8 +532,8 @@ static int32_t mndGetNumOfTopics(SMnode *pMnode, char *dbName, int32_t *pNumOfTo
return
0
;
}
static
int32_t
mndRetrieveTopic
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveTopic
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SMqTopicObj
*
pTopic
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
96b7f269
...
...
@@ -56,10 +56,10 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans);
static
void
mndTransExecute
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
static
void
mndTransSendRpcRsp
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
static
int32_t
mndProcessTransReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessKillTransReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessTransReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessKillTransReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndRetrieveTrans
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveTrans
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextTrans
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitTrans
(
SMnode
*
pMnode
)
{
...
...
@@ -563,9 +563,9 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnType type, const S
pTrans
->
policy
=
policy
;
pTrans
->
type
=
type
;
pTrans
->
createdTime
=
taosGetTimestampMs
();
pTrans
->
rpcHandle
=
pReq
->
handle
;
pTrans
->
rpcAHandle
=
pReq
->
ahandle
;
pTrans
->
rpcRefId
=
pReq
->
refId
;
pTrans
->
rpcHandle
=
pReq
->
info
.
handle
;
pTrans
->
rpcAHandle
=
pReq
->
info
.
ahandle
;
pTrans
->
rpcRefId
=
pReq
->
info
.
refId
;
pTrans
->
redoLogs
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
void
*
));
pTrans
->
undoLogs
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
void
*
));
pTrans
->
commitLogs
=
taosArrayInit
(
TRANS_ARRAY_SIZE
,
sizeof
(
void
*
));
...
...
@@ -849,9 +849,9 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
mDebug
(
"trans:%d, send rsp, code:0x%04x stage:%d app:%p"
,
pTrans
->
id
,
code
&
0xFFFF
,
pTrans
->
stage
,
pTrans
->
rpcAHandle
);
SRpcMsg
rspMsg
=
{
.
handle
=
pTrans
->
rpcHandle
,
.
ahandle
=
pTrans
->
rpcAHandle
,
.
refId
=
pTrans
->
rpcRefId
,
.
info
.
handle
=
pTrans
->
rpcHandle
,
.
info
.
ahandle
=
pTrans
->
rpcAHandle
,
.
info
.
refId
=
pTrans
->
rpcRefId
,
.
code
=
code
,
.
pCont
=
rpcCont
,
.
contLen
=
pTrans
->
rpcRspLen
,
...
...
@@ -863,9 +863,9 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
}
}
void
mndTransProcessRsp
(
S
Node
Msg
*
pRsp
)
{
SMnode
*
pMnode
=
pRsp
->
pN
ode
;
int64_t
signature
=
(
int64_t
)(
pRsp
->
rpcMsg
.
ahandle
);
void
mndTransProcessRsp
(
S
Rpc
Msg
*
pRsp
)
{
SMnode
*
pMnode
=
pRsp
->
info
.
n
ode
;
int64_t
signature
=
(
int64_t
)(
pRsp
->
info
.
ahandle
);
int32_t
transId
=
(
int32_t
)(
signature
>>
32
);
int32_t
action
=
(
int32_t
)((
signature
<<
32
)
>>
32
);
...
...
@@ -899,13 +899,13 @@ void mndTransProcessRsp(SNodeMsg *pRsp) {
STransAction
*
pAction
=
taosArrayGet
(
pArray
,
action
);
if
(
pAction
!=
NULL
)
{
pAction
->
msgReceived
=
1
;
pAction
->
errCode
=
pRsp
->
rpcMsg
.
code
;
pAction
->
errCode
=
pRsp
->
code
;
if
(
pAction
->
errCode
!=
0
)
{
tstrncpy
(
pTrans
->
lastError
,
tstrerror
(
pAction
->
errCode
),
TSDB_TRANS_ERROR_LEN
);
}
}
mDebug
(
"trans:%d, action:%d response is received, code:0x%04x, accept:0x%04x"
,
transId
,
action
,
pRsp
->
rpcMsg
.
code
,
mDebug
(
"trans:%d, action:%d response is received, code:0x%04x, accept:0x%04x"
,
transId
,
action
,
pRsp
->
code
,
pAction
->
acceptableCode
);
mndTransExecute
(
pMnode
,
pTrans
);
...
...
@@ -983,7 +983,7 @@ static int32_t mndTransSendActionMsg(SMnode *pMnode, STrans *pTrans, SArray *pAr
signature
=
(
signature
<<
32
);
signature
+=
action
;
SRpcMsg
rpcMsg
=
{.
msgType
=
pAction
->
msgType
,
.
contLen
=
pAction
->
contLen
,
.
ahandle
=
(
void
*
)
signature
};
SRpcMsg
rpcMsg
=
{.
msgType
=
pAction
->
msgType
,
.
contLen
=
pAction
->
contLen
,
.
info
.
ahandle
=
(
void
*
)
signature
};
rpcMsg
.
pCont
=
rpcMallocCont
(
pAction
->
contLen
);
if
(
rpcMsg
.
pCont
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -1275,8 +1275,8 @@ static void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
mndTransSendRpcRsp
(
pMnode
,
pTrans
);
}
static
int32_t
mndProcessTransReq
(
S
Node
Msg
*
pReq
)
{
mndTransPullup
(
pReq
->
pN
ode
);
static
int32_t
mndProcessTransReq
(
S
Rpc
Msg
*
pReq
)
{
mndTransPullup
(
pReq
->
info
.
n
ode
);
return
0
;
}
...
...
@@ -1317,21 +1317,21 @@ int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans) {
return
0
;
}
static
int32_t
mndProcessKillTransReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessKillTransReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SKillTransReq
killReq
=
{
0
};
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
STrans
*
pTrans
=
NULL
;
if
(
tDeserializeSKillTransReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
killReq
)
!=
0
)
{
if
(
tDeserializeSKillTransReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
killReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
mInfo
(
"trans:%d, start to kill"
,
killReq
.
transId
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
...
...
@@ -1374,8 +1374,8 @@ void mndTransPullup(SMnode *pMnode) {
sdbWriteFile
(
pMnode
->
pSdb
);
}
static
int32_t
mndRetrieveTrans
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveTrans
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
STrans
*
pTrans
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
96b7f269
...
...
@@ -29,12 +29,12 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw);
static
int32_t
mndUserActionInsert
(
SSdb
*
pSdb
,
SUserObj
*
pUser
);
static
int32_t
mndUserActionDelete
(
SSdb
*
pSdb
,
SUserObj
*
pUser
);
static
int32_t
mndUserActionUpdate
(
SSdb
*
pSdb
,
SUserObj
*
pOld
,
SUserObj
*
pNew
);
static
int32_t
mndCreateUser
(
SMnode
*
pMnode
,
char
*
acct
,
SCreateUserReq
*
pCreate
,
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessCreateUserReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessAlterUserReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessDropUserReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndProcessGetUserAuthReq
(
S
Node
Msg
*
pReq
);
static
int32_t
mndRetrieveUsers
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndCreateUser
(
SMnode
*
pMnode
,
char
*
acct
,
SCreateUserReq
*
pCreate
,
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessCreateUserReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessAlterUserReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessDropUserReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndProcessGetUserAuthReq
(
S
Rpc
Msg
*
pReq
);
static
int32_t
mndRetrieveUsers
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextUser
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitUser
(
SMnode
*
pMnode
)
{
...
...
@@ -255,7 +255,7 @@ void mndReleaseUser(SMnode *pMnode, SUserObj *pUser) {
sdbRelease
(
pSdb
,
pUser
);
}
static
int32_t
mndCreateUser
(
SMnode
*
pMnode
,
char
*
acct
,
SCreateUserReq
*
pCreate
,
S
Node
Msg
*
pReq
)
{
static
int32_t
mndCreateUser
(
SMnode
*
pMnode
,
char
*
acct
,
SCreateUserReq
*
pCreate
,
S
Rpc
Msg
*
pReq
)
{
SUserObj
userObj
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
pCreate
->
pass
,
strlen
(
pCreate
->
pass
),
userObj
.
pass
);
tstrncpy
(
userObj
.
user
,
pCreate
->
user
,
TSDB_USER_LEN
);
...
...
@@ -264,7 +264,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
superUser
=
pCreate
->
superUser
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_USER
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_USER
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to create since %s"
,
pCreate
->
user
,
terrstr
());
return
-
1
;
...
...
@@ -289,14 +289,14 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
return
0
;
}
static
int32_t
mndProcessCreateUserReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessCreateUserReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SUserObj
*
pOperUser
=
NULL
;
SCreateUserReq
createReq
=
{
0
};
if
(
tDeserializeSCreateUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateUserReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -319,7 +319,7 @@ static int32_t mndProcessCreateUserReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pOperUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -343,8 +343,8 @@ _OVER:
return
code
;
}
static
int32_t
mndAlterUser
(
SMnode
*
pMnode
,
SUserObj
*
pOld
,
SUserObj
*
pNew
,
S
Node
Msg
*
pReq
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_ALTER_USER
,
&
pReq
->
rpcMsg
);
static
int32_t
mndAlterUser
(
SMnode
*
pMnode
,
SUserObj
*
pOld
,
SUserObj
*
pNew
,
S
Rpc
Msg
*
pReq
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_ALTER_USER
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to alter since %s"
,
pOld
->
user
,
terrstr
());
return
-
1
;
...
...
@@ -392,8 +392,8 @@ static SHashObj *mndDupDbHash(SHashObj *pOld) {
return
pNew
;
}
static
int32_t
mndProcessAlterUserReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessAlterUserReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
int32_t
code
=
-
1
;
...
...
@@ -402,7 +402,7 @@ static int32_t mndProcessAlterUserReq(SNodeMsg *pReq) {
SUserObj
newUser
=
{
0
};
SAlterUserReq
alterReq
=
{
0
};
if
(
tDeserializeSAlterUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
{
if
(
tDeserializeSAlterUserReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -425,7 +425,7 @@ static int32_t mndProcessAlterUserReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pOperUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -550,8 +550,8 @@ _OVER:
return
code
;
}
static
int32_t
mndDropUser
(
SMnode
*
pMnode
,
S
Node
Msg
*
pReq
,
SUserObj
*
pUser
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_USER
,
&
pReq
->
rpcMsg
);
static
int32_t
mndDropUser
(
SMnode
*
pMnode
,
S
Rpc
Msg
*
pReq
,
SUserObj
*
pUser
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_USER
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to drop since %s"
,
pUser
->
user
,
terrstr
());
return
-
1
;
...
...
@@ -576,14 +576,14 @@ static int32_t mndDropUser(SMnode *pMnode, SNodeMsg *pReq, SUserObj *pUser) {
return
0
;
}
static
int32_t
mndProcessDropUserReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessDropUserReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SUserObj
*
pOperUser
=
NULL
;
SDropUserReq
dropReq
=
{
0
};
if
(
tDeserializeSDropUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSDropUserReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -601,7 +601,7 @@ static int32_t mndProcessDropUserReq(SNodeMsg *pReq) {
goto
_OVER
;
}
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pOperUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
...
...
@@ -657,14 +657,14 @@ static int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRs
return
0
;
}
static
int32_t
mndProcessGetUserAuthReq
(
S
Node
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndProcessGetUserAuthReq
(
S
Rpc
Msg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SGetUserAuthReq
authReq
=
{
0
};
SGetUserAuthRsp
authRsp
=
{
0
};
if
(
tDeserializeSGetUserAuthReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
authReq
)
!=
0
)
{
if
(
tDeserializeSGetUserAuthReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
authReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -691,8 +691,8 @@ static int32_t mndProcessGetUserAuthReq(SNodeMsg *pReq) {
tSerializeSGetUserAuthRsp
(
pRsp
,
contLen
,
&
authRsp
);
pReq
->
pR
sp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
pReq
->
info
.
r
sp
=
pRsp
;
pReq
->
info
.
rspLen
=
contLen
;
code
=
0
;
_OVER:
...
...
@@ -703,8 +703,8 @@ _OVER:
return
code
;
}
static
int32_t
mndRetrieveUsers
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveUsers
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SUserObj
*
pUser
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
96b7f269
...
...
@@ -29,14 +29,14 @@ static int32_t mndVgroupActionInsert(SSdb *pSdb, SVgObj *pVgroup);
static
int32_t
mndVgroupActionDelete
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
static
int32_t
mndVgroupActionUpdate
(
SSdb
*
pSdb
,
SVgObj
*
pOld
,
SVgObj
*
pNew
);
static
int32_t
mndProcessCreateVnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessAlterVnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessDropVnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessCompactVnodeRsp
(
S
Node
Msg
*
pRsp
);
static
int32_t
mndProcessCreateVnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessAlterVnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessDropVnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndProcessCompactVnodeRsp
(
S
Rpc
Msg
*
pRsp
);
static
int32_t
mndRetrieveVgroups
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveVgroups
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextVgroup
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndRetrieveVnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveVnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextVnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitVgroup
(
SMnode
*
pMnode
)
{
...
...
@@ -357,7 +357,7 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
bool
isMnode
=
mndIsMnode
(
pMnode
,
pDnode
->
id
);
pDnode
->
numOfVnodes
=
mndGetVnodesNum
(
pMnode
,
pDnode
->
id
);
mDebug
(
"dnode:%d, vnodes:%d support
Vnodes:%d isM
node:%d online:%d"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
,
mDebug
(
"dnode:%d, vnodes:%d support
_vnodes:%d is_m
node:%d online:%d"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
,
pDnode
->
numOfSupportVnodes
,
isMnode
,
online
);
if
(
isMnode
)
{
...
...
@@ -590,22 +590,22 @@ SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup) {
return
epset
;
}
static
int32_t
mndProcessCreateVnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessCreateVnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndProcessAlterVnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessAlterVnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndProcessDropVnodeRsp
(
S
Node
Msg
*
pRsp
)
{
static
int32_t
mndProcessDropVnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndProcessCompactVnodeRsp
(
S
Node
Msg
*
pRsp
)
{
return
0
;
}
static
int32_t
mndProcessCompactVnodeRsp
(
S
Rpc
Msg
*
pRsp
)
{
return
0
;
}
static
bool
mndGetVgroupMaxReplicaFp
(
SMnode
*
pMnode
,
void
*
pObj
,
void
*
p1
,
void
*
p2
,
void
*
p3
)
{
SVgObj
*
pVgroup
=
pObj
;
...
...
@@ -636,8 +636,8 @@ static int32_t mndGetVgroupMaxReplica(SMnode *pMnode, char *dbName, int8_t *pRep
return
0
;
}
static
int32_t
mndRetrieveVgroups
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveVgroups
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SVgObj
*
pVgroup
=
NULL
;
...
...
@@ -744,8 +744,8 @@ int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId) {
return
numOfVnodes
;
}
static
int32_t
mndRetrieveVnodes
(
S
Node
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pN
ode
;
static
int32_t
mndRetrieveVnodes
(
S
Rpc
Msg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
n
ode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
SVgObj
*
pVgroup
=
NULL
;
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
96b7f269
...
...
@@ -339,28 +339,25 @@ int32_t mndStart(SMnode *pMnode) { return mndInitTimer(pMnode); }
void
mndStop
(
SMnode
*
pMnode
)
{
return
mndCleanupTimer
(
pMnode
);
}
int32_t
mndProcessMsg
(
SNodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pNode
;
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
tmsg_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
void
*
ahandle
=
pMsg
->
rpcMsg
.
ahandle
;
bool
isReq
=
(
pRpc
->
msgType
&
1U
);
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
(
msgType
),
ahandle
);
mTrace
(
"msg:%p, will be processed, type:%s app:%p"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
),
ahandle
);
if
(
isReq
&&
!
mndIsMaster
(
pMnode
))
{
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
&&
(
pRpc
->
contLen
==
0
||
pRpc
->
pCont
==
NULL
))
{
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
;
}
MndMsgFp
fp
=
pMnode
->
msgFp
[
TMSG_INDEX
(
msgType
)];
MndMsgFp
fp
=
pMnode
->
msgFp
[
TMSG_INDEX
(
pMsg
->
msgType
)];
if
(
fp
==
NULL
)
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
mError
(
"msg:%p, failed to process since no msg handle, app:%p"
,
pMsg
,
ahandle
);
...
...
source/dnode/mnode/impl/test/trans/trans2.cpp
浏览文件 @
96b7f269
...
...
@@ -280,12 +280,12 @@ TEST_F(MndTestTrans2, 02_Action) {
STransAction
*
pAction
=
(
STransAction
*
)
taosArrayGet
(
pTrans
->
undoActions
,
action
);
pAction
->
msgSent
=
1
;
S
Node
Msg
rspMsg
=
{
0
};
rspMsg
.
pN
ode
=
pMnode
;
S
Rpc
Msg
rspMsg
=
{
0
};
rspMsg
.
info
.
n
ode
=
pMnode
;
int64_t
signature
=
transId
;
signature
=
(
signature
<<
32
);
signature
+=
action
;
rspMsg
.
rpcMsg
.
ahandle
=
(
void
*
)
signature
;
rspMsg
.
info
.
ahandle
=
(
void
*
)
signature
;
mndTransProcessRsp
(
&
rspMsg
);
mndReleaseTrans
(
pMnode
,
pTrans
);
...
...
@@ -311,13 +311,13 @@ TEST_F(MndTestTrans2, 02_Action) {
STransAction
*
pAction
=
(
STransAction
*
)
taosArrayGet
(
pTrans
->
redoActions
,
action
);
pAction
->
msgSent
=
1
;
S
Node
Msg
rspMsg
=
{
0
};
rspMsg
.
pN
ode
=
pMnode
;
S
Rpc
Msg
rspMsg
=
{
0
};
rspMsg
.
info
.
n
ode
=
pMnode
;
int64_t
signature
=
transId
;
signature
=
(
signature
<<
32
);
signature
+=
action
;
rspMsg
.
rpcMsg
.
ahandle
=
(
void
*
)
signature
;
rspMsg
.
rpcMsg
.
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
rspMsg
.
info
.
ahandle
=
(
void
*
)
signature
;
rspMsg
.
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
mndTransProcessRsp
(
&
rspMsg
);
mndReleaseTrans
(
pMnode
,
pTrans
);
...
...
@@ -336,12 +336,12 @@ TEST_F(MndTestTrans2, 02_Action) {
STransAction
*
pAction
=
(
STransAction
*
)
taosArrayGet
(
pTrans
->
redoActions
,
action
);
pAction
->
msgSent
=
1
;
S
Node
Msg
rspMsg
=
{
0
};
rspMsg
.
pN
ode
=
pMnode
;
S
Rpc
Msg
rspMsg
=
{
0
};
rspMsg
.
info
.
n
ode
=
pMnode
;
int64_t
signature
=
transId
;
signature
=
(
signature
<<
32
);
signature
+=
action
;
rspMsg
.
rpcMsg
.
ahandle
=
(
void
*
)
signature
;
rspMsg
.
info
.
ahandle
=
(
void
*
)
signature
;
mndTransProcessRsp
(
&
rspMsg
);
mndReleaseTrans
(
pMnode
,
pTrans
);
...
...
@@ -364,13 +364,13 @@ TEST_F(MndTestTrans2, 02_Action) {
EXPECT_EQ
(
pTrans
->
stage
,
TRN_STAGE_UNDO_ACTION
);
EXPECT_EQ
(
pTrans
->
failedTimes
,
1
);
S
Node
Msg
rspMsg
=
{
0
};
rspMsg
.
pN
ode
=
pMnode
;
S
Rpc
Msg
rspMsg
=
{
0
};
rspMsg
.
info
.
n
ode
=
pMnode
;
int64_t
signature
=
transId
;
signature
=
(
signature
<<
32
);
signature
+=
action
;
rspMsg
.
rpcMsg
.
ahandle
=
(
void
*
)
signature
;
rspMsg
.
rpcMsg
.
code
=
0
;
rspMsg
.
info
.
ahandle
=
(
void
*
)
signature
;
rspMsg
.
code
=
0
;
mndTransProcessRsp
(
&
rspMsg
);
mndReleaseTrans
(
pMnode
,
pTrans
);
...
...
@@ -389,12 +389,12 @@ TEST_F(MndTestTrans2, 02_Action) {
STransAction
*
pAction
=
(
STransAction
*
)
taosArrayGet
(
pTrans
->
undoActions
,
action
);
pAction
->
msgSent
=
1
;
S
Node
Msg
rspMsg
=
{
0
};
rspMsg
.
pN
ode
=
pMnode
;
S
Rpc
Msg
rspMsg
=
{
0
};
rspMsg
.
info
.
n
ode
=
pMnode
;
int64_t
signature
=
transId
;
signature
=
(
signature
<<
32
);
signature
+=
action
;
rspMsg
.
rpcMsg
.
ahandle
=
(
void
*
)
signature
;
rspMsg
.
info
.
ahandle
=
(
void
*
)
signature
;
mndTransProcessRsp
(
&
rspMsg
);
mndReleaseTrans
(
pMnode
,
pTrans
);
...
...
tools/shell/src/shellNettest.c
浏览文件 @
96b7f269
...
...
@@ -61,7 +61,7 @@ static void shellWorkAsClient() {
uint64_t
startTime
=
taosGetTimestampUs
();
for
(
int32_t
i
=
0
;
i
<
pArgs
->
pktNum
;
++
i
)
{
SRpcMsg
rpcMsg
=
{.
ahandle
=
(
void
*
)
0x9525
,
.
msgType
=
TDMT_DND_NET_TEST
};
SRpcMsg
rpcMsg
=
{.
info
.
ahandle
=
(
void
*
)
0x9525
,
.
msgType
=
TDMT_DND_NET_TEST
};
rpcMsg
.
pCont
=
rpcMallocCont
(
pArgs
->
pktLen
);
rpcMsg
.
contLen
=
pArgs
->
pktLen
;
...
...
@@ -96,7 +96,7 @@ _OVER:
static
void
shellProcessMsg
(
void
*
p
,
SRpcMsg
*
pRpc
,
SEpSet
*
pEpSet
)
{
printf
(
"request is received, size:%d
\n
"
,
pRpc
->
contLen
);
fflush
(
stdout
);
SRpcMsg
rsp
=
{.
handle
=
pRpc
->
handle
,
.
refId
=
pRpc
->
refId
,
.
ahandle
=
pRpc
->
ahandle
,
.
code
=
0
};
SRpcMsg
rsp
=
{.
info
=
pRpc
->
info
,
.
code
=
0
};
rsp
.
pCont
=
rpcMallocCont
(
pRpc
->
contLen
);
if
(
rsp
.
pCont
==
NULL
)
{
rsp
.
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录