Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d78c54fb
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
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() {
...
@@ -124,13 +124,12 @@ void dnodeFreeMPeerQueue() {
void
dnodeDispatchToMPeerQueue
(
SRpcMsg
*
pMsg
)
{
void
dnodeDispatchToMPeerQueue
(
SRpcMsg
*
pMsg
)
{
if
(
!
mnodeIsRunning
()
||
tsMPeerQueue
==
NULL
)
{
if
(
!
mnodeIsRunning
()
||
tsMPeerQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
pMsg
,
false
);
dnodeSendRedirectMsg
(
pMsg
,
false
);
rpcFreeCont
(
pMsg
->
pCont
);
}
else
{
return
;
SMnodeMsg
*
pPeer
=
mnodeCreateMsg
(
pMsg
);
taosWriteQitem
(
tsMPeerQueue
,
TAOS_QTYPE_RPC
,
pPeer
);
}
}
SMnodeMsg
*
pPeer
=
taosAllocateQitem
(
sizeof
(
SMnodeMsg
));
rpcFreeCont
(
pMsg
->
pCont
);
mnodeCreateMsg
(
pPeer
,
pMsg
);
taosWriteQitem
(
tsMPeerQueue
,
TAOS_QTYPE_RPC
,
pPeer
);
}
}
static
void
dnodeFreeMPeerMsg
(
SMnodeMsg
*
pPeer
)
{
static
void
dnodeFreeMPeerMsg
(
SMnodeMsg
*
pPeer
)
{
...
...
src/dnode/src/dnodeMRead.c
浏览文件 @
d78c54fb
...
@@ -125,13 +125,12 @@ void dnodeFreeMReadQueue() {
...
@@ -125,13 +125,12 @@ void dnodeFreeMReadQueue() {
void
dnodeDispatchToMReadQueue
(
SRpcMsg
*
pMsg
)
{
void
dnodeDispatchToMReadQueue
(
SRpcMsg
*
pMsg
)
{
if
(
!
mnodeIsRunning
()
||
tsMReadQueue
==
NULL
)
{
if
(
!
mnodeIsRunning
()
||
tsMReadQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
pMsg
,
true
);
dnodeSendRedirectMsg
(
pMsg
,
true
);
rpcFreeCont
(
pMsg
->
pCont
);
}
else
{
return
;
SMnodeMsg
*
pRead
=
mnodeCreateMsg
(
pMsg
);
taosWriteQitem
(
tsMReadQueue
,
TAOS_QTYPE_RPC
,
pRead
);
}
}
SMnodeMsg
*
pRead
=
taosAllocateQitem
(
sizeof
(
SMnodeMsg
));
rpcFreeCont
(
pMsg
->
pCont
);
mnodeCreateMsg
(
pRead
,
pMsg
);
taosWriteQitem
(
tsMReadQueue
,
TAOS_QTYPE_RPC
,
pRead
);
}
}
static
void
dnodeFreeMReadMsg
(
SMnodeMsg
*
pRead
)
{
static
void
dnodeFreeMReadMsg
(
SMnodeMsg
*
pRead
)
{
...
...
src/dnode/src/dnodeMWrite.c
浏览文件 @
d78c54fb
...
@@ -125,16 +125,14 @@ void dnodeFreeMWritequeue() {
...
@@ -125,16 +125,14 @@ void dnodeFreeMWritequeue() {
void
dnodeDispatchToMWriteQueue
(
SRpcMsg
*
pMsg
)
{
void
dnodeDispatchToMWriteQueue
(
SRpcMsg
*
pMsg
)
{
if
(
!
mnodeIsRunning
()
||
tsMWriteQueue
==
NULL
)
{
if
(
!
mnodeIsRunning
()
||
tsMWriteQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
pMsg
,
true
);
dnodeSendRedirectMsg
(
pMsg
,
true
);
rpcFreeCont
(
pMsg
->
pCont
);
}
else
{
return
;
SMnodeMsg
*
pWrite
=
mnodeCreateMsg
(
pMsg
);
}
SMnodeMsg
*
pWrite
=
taosAllocateQitem
(
sizeof
(
SMnodeMsg
));
mnodeCreateMsg
(
pWrite
,
pMsg
);
dDebug
(
"app:%p:%p, msg:%s is put into mwrite queue:%p"
,
pWrite
->
rpcMsg
.
ahandle
,
pWrite
,
dDebug
(
"app:%p:%p, msg:%s is put into mwrite queue:%p"
,
pWrite
->
rpcMsg
.
ahandle
,
pWrite
,
taosMsg
[
pWrite
->
rpcMsg
.
msgType
],
tsMWriteQueue
);
taosMsg
[
pWrite
->
rpcMsg
.
msgType
],
tsMWriteQueue
);
taosWriteQitem
(
tsMWriteQueue
,
TAOS_QTYPE_RPC
,
pWrite
);
taosWriteQitem
(
tsMWriteQueue
,
TAOS_QTYPE_RPC
,
pWrite
);
}
rpcFreeCont
(
pMsg
->
pCont
);
}
}
static
void
dnodeFreeMWriteMsg
(
SMnodeMsg
*
pWrite
)
{
static
void
dnodeFreeMWriteMsg
(
SMnodeMsg
*
pWrite
)
{
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
d78c54fb
...
@@ -47,6 +47,11 @@ typedef struct {
...
@@ -47,6 +47,11 @@ typedef struct {
int32_t
*
vnodeList
;
int32_t
*
vnodeList
;
}
SOpenVnodeThread
;
}
SOpenVnodeThread
;
typedef
struct
{
SRpcMsg
rpcMsg
;
char
pCont
[];
}
SMgmtMsg
;
void
*
tsDnodeTmr
=
NULL
;
void
*
tsDnodeTmr
=
NULL
;
static
void
*
tsStatusTimer
=
NULL
;
static
void
*
tsStatusTimer
=
NULL
;
static
uint32_t
tsRebootTime
;
static
uint32_t
tsRebootTime
;
...
@@ -172,38 +177,46 @@ void dnodeCleanupMgmt() {
...
@@ -172,38 +177,46 @@ void dnodeCleanupMgmt() {
vnodeCleanupResources
();
vnodeCleanupResources
();
}
}
void
dnodeDispatchToMgmtQueue
(
SRpcMsg
*
pMsg
)
{
static
int32_t
dnodeWriteToMgmtQueue
(
SRpcMsg
*
pMsg
)
{
void
*
item
;
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
));
pMgmt
->
rpcMsg
=
*
pMsg
;
if
(
item
)
{
pMgmt
->
rpcMsg
.
pCont
=
pMgmt
->
pCont
;
memcpy
(
item
,
pMsg
,
sizeof
(
SRpcMsg
));
memcpy
(
pMgmt
->
pCont
,
pMsg
->
pCont
,
pMsg
->
contLen
);
taosWriteQitem
(
tsMgmtQueue
,
1
,
item
);
taosWriteQitem
(
tsMgmtQueue
,
TAOS_QTYPE_RPC
,
pMgmt
);
}
else
{
SRpcMsg
rsp
=
{
.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
code
=
TSDB_CODE_DND_OUT_OF_MEMORY
};
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
);
rpcSendResponse
(
&
rsp
);
rpcFreeCont
(
pMsg
->
pCont
);
}
}
rpcFreeCont
(
pMsg
->
pCont
);
}
}
static
void
*
dnodeProcessMgmtQueue
(
void
*
param
)
{
static
void
*
dnodeProcessMgmtQueue
(
void
*
param
)
{
SRpcMsg
*
pMsg
;
SMgmtMsg
*
pMgmt
;
SRpcMsg
*
pMsg
;
SRpcMsg
rsp
=
{
0
};
SRpcMsg
rsp
=
{
0
};
int
type
;
int
32_t
q
type
;
void
*
handle
;
void
*
handle
;
while
(
1
)
{
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
);
dDebug
(
"qset:%p, dnode mgmt got no message from qset, exit"
,
tsMgmtQset
);
break
;
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
])
{
if
(
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])
{
rsp
.
code
=
(
*
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])(
pMsg
);
rsp
.
code
=
(
*
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])(
pMsg
);
}
else
{
}
else
{
...
@@ -214,7 +227,6 @@ static void *dnodeProcessMgmtQueue(void *param) {
...
@@ -214,7 +227,6 @@ static void *dnodeProcessMgmtQueue(void *param) {
rsp
.
pCont
=
NULL
;
rsp
.
pCont
=
NULL
;
rpcSendResponse
(
&
rsp
);
rpcSendResponse
(
&
rsp
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
...
...
src/inc/mnode.h
浏览文件 @
d78c54fb
...
@@ -50,9 +50,10 @@ typedef struct SMnodeMsg {
...
@@ -50,9 +50,10 @@ typedef struct SMnodeMsg {
int32_t
code
;
int32_t
code
;
void
*
pObj
;
void
*
pObj
;
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
char
pCont
[];
}
SMnodeMsg
;
}
SMnodeMsg
;
void
mnodeCreateMsg
(
SMnodeMsg
*
pMsg
,
SRpcMsg
*
r
pcMsg
);
void
*
mnodeCreateMsg
(
SRpcMsg
*
pR
pcMsg
);
int32_t
mnodeInitMsg
(
SMnodeMsg
*
pMsg
);
int32_t
mnodeInitMsg
(
SMnodeMsg
*
pMsg
);
void
mnodeCleanupMsg
(
SMnodeMsg
*
pMsg
);
void
mnodeCleanupMsg
(
SMnodeMsg
*
pMsg
);
...
...
src/mnode/src/mnodeInt.c
浏览文件 @
d78c54fb
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
#include "taosmsg.h"
#include "taosmsg.h"
#include "taoserror.h"
#include "taoserror.h"
#include "trpc.h"
#include "trpc.h"
#include "t
cach
e.h"
#include "t
queu
e.h"
#include "mnode.h"
#include "mnode.h"
#include "dnode.h"
#include "dnode.h"
#include "mnodeDef.h"
#include "mnodeDef.h"
...
@@ -34,8 +34,15 @@
...
@@ -34,8 +34,15 @@
#include "mnodeUser.h"
#include "mnodeUser.h"
#include "mnodeVgroup.h"
#include "mnodeVgroup.h"
void
mnodeCreateMsg
(
SMnodeMsg
*
pMsg
,
SRpcMsg
*
rpcMsg
)
{
void
*
mnodeCreateMsg
(
SRpcMsg
*
pRpcMsg
)
{
pMsg
->
rpcMsg
=
*
rpcMsg
;
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
)
{
int32_t
mnodeInitMsg
(
SMnodeMsg
*
pMsg
)
{
...
@@ -54,7 +61,6 @@ int32_t mnodeInitMsg(SMnodeMsg *pMsg) {
...
@@ -54,7 +61,6 @@ int32_t mnodeInitMsg(SMnodeMsg *pMsg) {
void
mnodeCleanupMsg
(
SMnodeMsg
*
pMsg
)
{
void
mnodeCleanupMsg
(
SMnodeMsg
*
pMsg
)
{
if
(
pMsg
!=
NULL
)
{
if
(
pMsg
!=
NULL
)
{
if
(
pMsg
->
rpcMsg
.
pCont
)
rpcFreeCont
(
pMsg
->
rpcMsg
.
pCont
);
if
(
pMsg
->
pUser
)
mnodeDecUserRef
(
pMsg
->
pUser
);
if
(
pMsg
->
pUser
)
mnodeDecUserRef
(
pMsg
->
pUser
);
if
(
pMsg
->
pDb
)
mnodeDecDbRef
(
pMsg
->
pDb
);
if
(
pMsg
->
pDb
)
mnodeDecDbRef
(
pMsg
->
pDb
);
if
(
pMsg
->
pVgroup
)
mnodeDecVgroupRef
(
pMsg
->
pVgroup
);
if
(
pMsg
->
pVgroup
)
mnodeDecVgroupRef
(
pMsg
->
pVgroup
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录