Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
d78c54fb
T
TDengine
项目概览
哥们要飞
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d78c54fb
编写于
11月 06, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1915
上级
e4e86609
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
60 addition
and
45 deletion
+60
-45
src/dnode/src/dnodeMPeer.c
src/dnode/src/dnodeMPeer.c
+4
-5
src/dnode/src/dnodeMRead.c
src/dnode/src/dnodeMRead.c
+4
-5
src/dnode/src/dnodeMWrite.c
src/dnode/src/dnodeMWrite.c
+6
-8
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+34
-22
src/inc/mnode.h
src/inc/mnode.h
+2
-1
src/mnode/src/mnodeInt.c
src/mnode/src/mnodeInt.c
+10
-4
未找到文件。
src/dnode/src/dnodeMPeer.c
浏览文件 @
d78c54fb
...
...
@@ -124,13 +124,12 @@ void dnodeFreeMPeerQueue() {
void
dnodeDispatchToMPeerQueue
(
SRpcMsg
*
pMsg
)
{
if
(
!
mnodeIsRunning
()
||
tsMPeerQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
pMsg
,
false
);
rpcFreeCont
(
pMsg
->
pCont
);
return
;
}
else
{
SMnodeMsg
*
pPeer
=
mnodeCreateMsg
(
pMsg
);
taosWriteQitem
(
tsMPeerQueue
,
TAOS_QTYPE_RPC
,
pPeer
);
}
SMnodeMsg
*
pPeer
=
taosAllocateQitem
(
sizeof
(
SMnodeMsg
));
mnodeCreateMsg
(
pPeer
,
pMsg
);
taosWriteQitem
(
tsMPeerQueue
,
TAOS_QTYPE_RPC
,
pPeer
);
rpcFreeCont
(
pMsg
->
pCont
);
}
static
void
dnodeFreeMPeerMsg
(
SMnodeMsg
*
pPeer
)
{
...
...
src/dnode/src/dnodeMRead.c
浏览文件 @
d78c54fb
...
...
@@ -125,13 +125,12 @@ void dnodeFreeMReadQueue() {
void
dnodeDispatchToMReadQueue
(
SRpcMsg
*
pMsg
)
{
if
(
!
mnodeIsRunning
()
||
tsMReadQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
pMsg
,
true
);
rpcFreeCont
(
pMsg
->
pCont
);
return
;
}
else
{
SMnodeMsg
*
pRead
=
mnodeCreateMsg
(
pMsg
);
taosWriteQitem
(
tsMReadQueue
,
TAOS_QTYPE_RPC
,
pRead
);
}
SMnodeMsg
*
pRead
=
taosAllocateQitem
(
sizeof
(
SMnodeMsg
));
mnodeCreateMsg
(
pRead
,
pMsg
);
taosWriteQitem
(
tsMReadQueue
,
TAOS_QTYPE_RPC
,
pRead
);
rpcFreeCont
(
pMsg
->
pCont
);
}
static
void
dnodeFreeMReadMsg
(
SMnodeMsg
*
pRead
)
{
...
...
src/dnode/src/dnodeMWrite.c
浏览文件 @
d78c54fb
...
...
@@ -125,16 +125,14 @@ void dnodeFreeMWritequeue() {
void
dnodeDispatchToMWriteQueue
(
SRpcMsg
*
pMsg
)
{
if
(
!
mnodeIsRunning
()
||
tsMWriteQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
pMsg
,
true
);
rpcFreeCont
(
pMsg
->
pCont
);
return
;
}
else
{
SMnodeMsg
*
pWrite
=
mnodeCreateMsg
(
pMsg
);
dDebug
(
"app:%p:%p, msg:%s is put into mwrite queue:%p"
,
pWrite
->
rpcMsg
.
ahandle
,
pWrite
,
taosMsg
[
pWrite
->
rpcMsg
.
msgType
],
tsMWriteQueue
);
taosWriteQitem
(
tsMWriteQueue
,
TAOS_QTYPE_RPC
,
pWrite
);
}
SMnodeMsg
*
pWrite
=
taosAllocateQitem
(
sizeof
(
SMnodeMsg
));
mnodeCreateMsg
(
pWrite
,
pMsg
);
dDebug
(
"app:%p:%p, msg:%s is put into mwrite queue:%p"
,
pWrite
->
rpcMsg
.
ahandle
,
pWrite
,
taosMsg
[
pWrite
->
rpcMsg
.
msgType
],
tsMWriteQueue
);
taosWriteQitem
(
tsMWriteQueue
,
TAOS_QTYPE_RPC
,
pWrite
);
rpcFreeCont
(
pMsg
->
pCont
);
}
static
void
dnodeFreeMWriteMsg
(
SMnodeMsg
*
pWrite
)
{
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
d78c54fb
...
...
@@ -47,6 +47,11 @@ typedef struct {
int32_t
*
vnodeList
;
}
SOpenVnodeThread
;
typedef
struct
{
SRpcMsg
rpcMsg
;
char
pCont
[];
}
SMgmtMsg
;
void
*
tsDnodeTmr
=
NULL
;
static
void
*
tsStatusTimer
=
NULL
;
static
uint32_t
tsRebootTime
;
...
...
@@ -172,38 +177,46 @@ void dnodeCleanupMgmt() {
vnodeCleanupResources
();
}
void
dnodeDispatchToMgmtQueue
(
SRpcMsg
*
pMsg
)
{
void
*
item
;
static
int32_t
dnodeWriteToMgmtQueue
(
SRpcMsg
*
pMsg
)
{
int32_t
size
=
sizeof
(
SMgmtMsg
)
+
pMsg
->
contLen
;
SMgmtMsg
*
pMgmt
=
taosAllocateQitem
(
size
);
if
(
pMgmt
==
NULL
)
{
return
TSDB_CODE_DND_OUT_OF_MEMORY
;
}
item
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
));
if
(
item
)
{
memcpy
(
item
,
pMsg
,
sizeof
(
SRpcMsg
));
taosWriteQitem
(
tsMgmtQueue
,
1
,
item
);
}
else
{
SRpcMsg
rsp
=
{
.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
code
=
TSDB_CODE_DND_OUT_OF_MEMORY
};
pMgmt
->
rpcMsg
=
*
pMsg
;
pMgmt
->
rpcMsg
.
pCont
=
pMgmt
->
pCont
;
memcpy
(
pMgmt
->
pCont
,
pMsg
->
pCont
,
pMsg
->
contLen
);
taosWriteQitem
(
tsMgmtQueue
,
TAOS_QTYPE_RPC
,
pMgmt
);
return
TSDB_CODE_SUCCESS
;
}
void
dnodeDispatchToMgmtQueue
(
SRpcMsg
*
pMsg
)
{
int32_t
code
=
dnodeWriteToMgmtQueue
(
pMsg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
handle
,
.
code
=
code
};
rpcSendResponse
(
&
rsp
);
rpcFreeCont
(
pMsg
->
pCont
);
}
rpcFreeCont
(
pMsg
->
pCont
);
}
static
void
*
dnodeProcessMgmtQueue
(
void
*
param
)
{
SRpcMsg
*
pMsg
;
SRpcMsg
rsp
=
{
0
};
int
type
;
void
*
handle
;
SMgmtMsg
*
pMgmt
;
SRpcMsg
*
pMsg
;
SRpcMsg
rsp
=
{
0
};
int32_t
qtype
;
void
*
handle
;
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsMgmtQset
,
&
type
,
(
void
**
)
&
pMsg
,
&
handle
)
==
0
)
{
if
(
taosReadQitemFromQset
(
tsMgmtQset
,
&
qtype
,
(
void
**
)
&
pMgmt
,
&
handle
)
==
0
)
{
dDebug
(
"qset:%p, dnode mgmt got no message from qset, exit"
,
tsMgmtQset
);
break
;
}
dDebug
(
"%p, msg:%s will be processed"
,
pMsg
->
ahandle
,
taosMsg
[
pMsg
->
msgType
]);
pMsg
=
&
pMgmt
->
rpcMsg
;
dDebug
(
"%p, msg:%p:%s will be processed"
,
pMsg
->
ahandle
,
pMgmt
,
taosMsg
[
pMsg
->
msgType
]);
if
(
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])
{
rsp
.
code
=
(
*
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])(
pMsg
);
}
else
{
...
...
@@ -211,10 +224,9 @@ static void *dnodeProcessMgmtQueue(void *param) {
}
rsp
.
handle
=
pMsg
->
handle
;
rsp
.
pCont
=
NULL
;
rsp
.
pCont
=
NULL
;
rpcSendResponse
(
&
rsp
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
...
...
src/inc/mnode.h
浏览文件 @
d78c54fb
...
...
@@ -50,9 +50,10 @@ typedef struct SMnodeMsg {
int32_t
code
;
void
*
pObj
;
SRpcMsg
rpcMsg
;
char
pCont
[];
}
SMnodeMsg
;
void
mnodeCreateMsg
(
SMnodeMsg
*
pMsg
,
SRpcMsg
*
r
pcMsg
);
void
*
mnodeCreateMsg
(
SRpcMsg
*
pR
pcMsg
);
int32_t
mnodeInitMsg
(
SMnodeMsg
*
pMsg
);
void
mnodeCleanupMsg
(
SMnodeMsg
*
pMsg
);
...
...
src/mnode/src/mnodeInt.c
浏览文件 @
d78c54fb
...
...
@@ -18,7 +18,7 @@
#include "taosmsg.h"
#include "taoserror.h"
#include "trpc.h"
#include "t
cach
e.h"
#include "t
queu
e.h"
#include "mnode.h"
#include "dnode.h"
#include "mnodeDef.h"
...
...
@@ -34,8 +34,15 @@
#include "mnodeUser.h"
#include "mnodeVgroup.h"
void
mnodeCreateMsg
(
SMnodeMsg
*
pMsg
,
SRpcMsg
*
rpcMsg
)
{
pMsg
->
rpcMsg
=
*
rpcMsg
;
void
*
mnodeCreateMsg
(
SRpcMsg
*
pRpcMsg
)
{
int32_t
size
=
sizeof
(
SMnodeMsg
)
+
pRpcMsg
->
contLen
;
SMnodeMsg
*
pMsg
=
taosAllocateQitem
(
size
);
pMsg
->
rpcMsg
=
*
pRpcMsg
;
pMsg
->
rpcMsg
.
pCont
=
pMsg
->
pCont
;
memcpy
(
pMsg
->
pCont
,
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
);
return
pMsg
;
}
int32_t
mnodeInitMsg
(
SMnodeMsg
*
pMsg
)
{
...
...
@@ -54,7 +61,6 @@ int32_t mnodeInitMsg(SMnodeMsg *pMsg) {
void
mnodeCleanupMsg
(
SMnodeMsg
*
pMsg
)
{
if
(
pMsg
!=
NULL
)
{
if
(
pMsg
->
rpcMsg
.
pCont
)
rpcFreeCont
(
pMsg
->
rpcMsg
.
pCont
);
if
(
pMsg
->
pUser
)
mnodeDecUserRef
(
pMsg
->
pUser
);
if
(
pMsg
->
pDb
)
mnodeDecDbRef
(
pMsg
->
pDb
);
if
(
pMsg
->
pVgroup
)
mnodeDecVgroupRef
(
pMsg
->
pVgroup
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录