Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
TDengine
提交
a6c3ffd5
TDengine
项目概览
lzh_me
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a6c3ffd5
编写于
5月 28, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-335] fix invalid read in mwrite queue
上级
5c889fff
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
35 addition
and
29 deletion
+35
-29
src/dnode/inc/dnodeMgmt.h
src/dnode/inc/dnodeMgmt.h
+1
-1
src/dnode/src/dnodeMPeer.c
src/dnode/src/dnodeMPeer.c
+9
-5
src/dnode/src/dnodeMRead.c
src/dnode/src/dnodeMRead.c
+10
-6
src/dnode/src/dnodeMWrite.c
src/dnode/src/dnodeMWrite.c
+11
-13
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+4
-4
未找到文件。
src/dnode/inc/dnodeMgmt.h
浏览文件 @
a6c3ffd5
...
...
@@ -32,7 +32,7 @@ void* dnodeGetVnodeWal(void *pVnode);
void
*
dnodeGetVnodeTsdb
(
void
*
pVnode
);
void
dnodeReleaseVnode
(
void
*
pVnode
);
void
dnodeSendRedirectMsg
(
int32_t
msgType
,
void
*
thandle
,
bool
forShell
);
void
dnodeSendRedirectMsg
(
SRpcMsg
*
rpcMsg
,
bool
forShell
);
void
dnodeGetMnodeIpSetForPeer
(
void
*
ipSet
);
void
dnodeGetMnodeIpSetForShell
(
void
*
ipSe
);
...
...
src/dnode/src/dnodeMPeer.c
浏览文件 @
a6c3ffd5
...
...
@@ -111,7 +111,7 @@ void dnodeFreeMnodePqueue() {
void
dnodeDispatchToMnodePeerQueue
(
SRpcMsg
*
pMsg
)
{
if
(
!
mnodeIsRunning
()
||
tsMPeerQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
pMsg
->
msgType
,
pMsg
->
handle
,
false
);
dnodeSendRedirectMsg
(
pMsg
,
false
);
return
;
}
...
...
@@ -120,18 +120,23 @@ void dnodeDispatchToMnodePeerQueue(SRpcMsg *pMsg) {
taosWriteQitem
(
tsMPeerQueue
,
TAOS_QTYPE_RPC
,
pPeer
);
}
static
void
dnodeFreeMnodePeadMsg
(
SMnodeMsg
*
pPeer
)
{
mnodeCleanupMsg
(
pPeer
);
taosFreeQitem
(
pPeer
);
}
static
void
dnodeSendRpcMnodePeerRsp
(
SMnodeMsg
*
pPeer
,
int32_t
code
)
{
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
SRpcMsg
rpcRsp
=
{
.
handle
=
pPeer
->
t
handle
,
.
handle
=
pPeer
->
rpcMsg
.
handle
,
.
pCont
=
pPeer
->
rpcRsp
.
rsp
,
.
contLen
=
pPeer
->
rpcRsp
.
len
,
.
code
=
code
,
};
rpcSendResponse
(
&
rpcRsp
);
mnodeCleanup
Msg
(
pPeer
);
dnodeFreeMnodePead
Msg
(
pPeer
);
}
static
void
*
dnodeProcessMnodePeerQueue
(
void
*
param
)
{
...
...
@@ -145,10 +150,9 @@ static void *dnodeProcessMnodePeerQueue(void *param) {
break
;
}
dTrace
(
"%p, msg:%s will be processed in mpeer queue"
,
pPeerMsg
->
ahandle
,
taosMsg
[
pPeerMsg
->
msgType
]);
dTrace
(
"%p, msg:%s will be processed in mpeer queue"
,
pPeerMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pPeerMsg
->
rpcMsg
.
msgType
]);
int32_t
code
=
mnodeProcessPeerReq
(
pPeerMsg
);
dnodeSendRpcMnodePeerRsp
(
pPeerMsg
,
code
);
taosFreeQitem
(
pPeerMsg
);
}
return
NULL
;
...
...
src/dnode/src/dnodeMRead.c
浏览文件 @
a6c3ffd5
...
...
@@ -116,7 +116,7 @@ void dnodeFreeMnodeRqueue() {
void
dnodeDispatchToMnodeReadQueue
(
SRpcMsg
*
pMsg
)
{
if
(
!
mnodeIsRunning
()
||
tsMReadQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
pMsg
->
msgType
,
pMsg
->
handle
,
true
);
dnodeSendRedirectMsg
(
pMsg
,
true
);
return
;
}
...
...
@@ -125,18 +125,23 @@ void dnodeDispatchToMnodeReadQueue(SRpcMsg *pMsg) {
taosWriteQitem
(
tsMReadQueue
,
TAOS_QTYPE_RPC
,
pRead
);
}
static
void
dnodeFreeMnodeReadMsg
(
SMnodeMsg
*
pRead
)
{
mnodeCleanupMsg
(
pRead
);
taosFreeQitem
(
pRead
);
}
static
void
dnodeSendRpcMnodeReadRsp
(
SMnodeMsg
*
pRead
,
int32_t
code
)
{
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
SRpcMsg
rpcRsp
=
{
.
handle
=
pRead
->
t
handle
,
.
handle
=
pRead
->
rpcMsg
.
handle
,
.
pCont
=
pRead
->
rpcRsp
.
rsp
,
.
contLen
=
pRead
->
rpcRsp
.
len
,
.
code
=
code
,
};
rpcSendResponse
(
&
rpcRsp
);
mnodeCleanup
Msg
(
pRead
);
dnodeFreeMnodeRead
Msg
(
pRead
);
}
static
void
*
dnodeProcessMnodeReadQueue
(
void
*
param
)
{
...
...
@@ -150,10 +155,9 @@ static void *dnodeProcessMnodeReadQueue(void *param) {
break
;
}
dTrace
(
"%p, msg:%s will be processed in mread queue"
,
pReadMsg
->
ahandle
,
taosMsg
[
pReadMsg
->
msgType
]);
dTrace
(
"%p, msg:%s will be processed in mread queue"
,
pReadMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pReadMsg
->
rpcMsg
.
msgType
]);
int32_t
code
=
mnodeProcessRead
(
pReadMsg
);
dnodeSendRpcMnodeReadRsp
(
pReadMsg
,
code
);
taosFreeQitem
(
pReadMsg
);
}
return
NULL
;
...
...
src/dnode/src/dnodeMWrite.c
浏览文件 @
a6c3ffd5
...
...
@@ -113,7 +113,7 @@ void dnodeFreeMnodeWqueue() {
void
dnodeDispatchToMnodeWriteQueue
(
SRpcMsg
*
pMsg
)
{
if
(
!
mnodeIsRunning
()
||
tsMWriteQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
pMsg
->
msgType
,
pMsg
->
handle
,
true
);
dnodeSendRedirectMsg
(
pMsg
,
true
);
return
;
}
...
...
@@ -122,19 +122,24 @@ void dnodeDispatchToMnodeWriteQueue(SRpcMsg *pMsg) {
taosWriteQitem
(
tsMWriteQueue
,
TAOS_QTYPE_RPC
,
pWrite
);
}
static
void
dnodeFreeMnodeWriteMsg
(
SMnodeMsg
*
pWrite
)
{
mnodeCleanupMsg
(
pWrite
);
taosFreeQitem
(
pWrite
);
}
void
dnodeSendRpcMnodeWriteRsp
(
void
*
pRaw
,
int32_t
code
)
{
SMnodeMsg
*
pWrite
=
pRaw
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
SRpcMsg
rpcRsp
=
{
.
handle
=
pWrite
->
t
handle
,
.
handle
=
pWrite
->
rpcMsg
.
handle
,
.
pCont
=
pWrite
->
rpcRsp
.
rsp
,
.
contLen
=
pWrite
->
rpcRsp
.
len
,
.
code
=
code
,
};
rpcSendResponse
(
&
rpcRsp
);
mnodeCleanup
Msg
(
pWrite
);
dnodeFreeMnodeWrite
Msg
(
pWrite
);
}
static
void
*
dnodeProcessMnodeWriteQueue
(
void
*
param
)
{
...
...
@@ -148,26 +153,19 @@ static void *dnodeProcessMnodeWriteQueue(void *param) {
break
;
}
dTrace
(
"%p, msg:%s will be processed in mwrite queue"
,
pWriteMsg
->
ahandle
,
taosMsg
[
pWriteMsg
->
msgType
]);
dTrace
(
"%p, msg:%s will be processed in mwrite queue"
,
pWriteMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pWriteMsg
->
rpcMsg
.
msgType
]);
int32_t
code
=
mnodeProcessWrite
(
pWriteMsg
);
dnodeSendRpcMnodeWriteRsp
(
pWriteMsg
,
code
);
taosFreeQitem
(
pWriteMsg
);
}
return
NULL
;
}
static
void
dnodeFreeMnodeWriteMsg
(
void
*
pMsg
)
{
SMnodeMsg
*
pWrite
=
pMsg
;
mnodeCleanupMsg
(
pWrite
);
taosFreeQitem
(
pWrite
);
}
void
dnodeReprocessMnodeWriteMsg
(
void
*
pMsg
)
{
SMnodeMsg
*
pWrite
=
pMsg
;
if
(
!
mnodeIsRunning
()
||
tsMWriteQueue
==
NULL
)
{
dnodeSendRedirectMsg
(
p
Write
->
msgType
,
pWrite
->
thandle
,
true
);
dnodeSendRedirectMsg
(
p
Msg
,
true
);
dnodeFreeMnodeWriteMsg
(
pWrite
);
}
else
{
taosWriteQitem
(
tsMWriteQueue
,
TAOS_QTYPE_RPC
,
pWrite
);
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
a6c3ffd5
...
...
@@ -609,9 +609,9 @@ int32_t dnodeGetDnodeId() {
return
tsDnodeCfg
.
dnodeId
;
}
void
dnodeSendRedirectMsg
(
int32_t
msgType
,
void
*
thandle
,
bool
forShell
)
{
void
dnodeSendRedirectMsg
(
SRpcMsg
*
rpcMsg
,
bool
forShell
)
{
SRpcConnInfo
connInfo
;
rpcGetConnInfo
(
t
handle
,
&
connInfo
);
rpcGetConnInfo
(
rpcMsg
->
handle
,
&
connInfo
);
SRpcIpSet
ipSet
=
{
0
};
if
(
forShell
)
{
...
...
@@ -620,7 +620,7 @@ void dnodeSendRedirectMsg(int32_t msgType, void *thandle, bool forShell) {
dnodeGetMnodeIpSetForPeer
(
&
ipSet
);
}
dTrace
(
"msg:%s will be redirected, dnodeIp:%s user:%s, numOfIps:%d inUse:%d"
,
taosMsg
[
msgType
],
dTrace
(
"msg:%s will be redirected, dnodeIp:%s user:%s, numOfIps:%d inUse:%d"
,
taosMsg
[
rpcMsg
->
msgType
],
taosIpStr
(
connInfo
.
clientIp
),
connInfo
.
user
,
ipSet
.
numOfIps
,
ipSet
.
inUse
);
for
(
int
i
=
0
;
i
<
ipSet
.
numOfIps
;
++
i
)
{
...
...
@@ -628,5 +628,5 @@ void dnodeSendRedirectMsg(int32_t msgType, void *thandle, bool forShell) {
ipSet
.
port
[
i
]
=
htons
(
ipSet
.
port
[
i
]);
}
rpcSendRedirectRsp
(
t
handle
,
&
ipSet
);
rpcSendRedirectRsp
(
rpcMsg
->
handle
,
&
ipSet
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录