Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
1e11d8d7
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看板
未验证
提交
1e11d8d7
编写于
7月 16, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
7月 16, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6648 from junli1026/jun/vNodeWrite
Fix SVWriteMsg memory allocation size bug
上级
ae91d392
18b74857
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
10 deletion
+10
-10
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+4
-4
src/inc/vnode.h
src/inc/vnode.h
+1
-1
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+5
-5
未找到文件。
src/dnode/src/dnodeVWrite.c
浏览文件 @
1e11d8d7
...
...
@@ -202,12 +202,12 @@ static void *dnodeProcessVWriteQueue(void *wparam) {
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
taosGetQitem
(
pWorker
->
qall
,
&
qtype
,
(
void
**
)
&
pWrite
);
dTrace
(
"msg:%p, app:%p type:%s will be processed in vwrite queue, qtype:%s hver:%"
PRIu64
,
pWrite
,
pWrite
->
rpcMsg
.
ahandle
,
taosMsg
[
pWrite
->
pHead
.
msgType
],
qtypeStr
[
qtype
],
pWrite
->
p
Head
.
version
);
pWrite
->
rpcMsg
.
ahandle
,
taosMsg
[
pWrite
->
walHead
.
msgType
],
qtypeStr
[
qtype
],
pWrite
->
wal
Head
.
version
);
pWrite
->
code
=
vnodeProcessWrite
(
pVnode
,
&
pWrite
->
p
Head
,
qtype
,
pWrite
);
pWrite
->
code
=
vnodeProcessWrite
(
pVnode
,
&
pWrite
->
wal
Head
,
qtype
,
pWrite
);
if
(
pWrite
->
code
<=
0
)
atomic_add_fetch_32
(
&
pWrite
->
processedCount
,
1
);
if
(
pWrite
->
code
>
0
)
pWrite
->
code
=
0
;
if
(
pWrite
->
code
==
0
&&
pWrite
->
p
Head
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
)
forceFsync
=
true
;
if
(
pWrite
->
code
==
0
&&
pWrite
->
wal
Head
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
)
forceFsync
=
true
;
dTrace
(
"msg:%p is processed in vwrite queue, code:0x%x"
,
pWrite
,
pWrite
->
code
);
}
...
...
@@ -222,7 +222,7 @@ static void *dnodeProcessVWriteQueue(void *wparam) {
dnodeSendRpcVWriteRsp
(
pVnode
,
pWrite
,
pWrite
->
code
);
}
else
{
if
(
qtype
==
TAOS_QTYPE_FWD
)
{
vnodeConfirmForward
(
pVnode
,
pWrite
->
pHead
.
version
,
pWrite
->
code
,
pWrite
->
p
Head
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
vnodeConfirmForward
(
pVnode
,
pWrite
->
walHead
.
version
,
pWrite
->
code
,
pWrite
->
wal
Head
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
}
if
(
pWrite
->
rspRet
.
rsp
)
{
rpcFreeCont
(
pWrite
->
rspRet
.
rsp
);
...
...
src/inc/vnode.h
浏览文件 @
1e11d8d7
...
...
@@ -49,7 +49,7 @@ typedef struct {
SRpcMsg
rpcMsg
;
SRspRet
rspRet
;
char
reserveForSync
[
24
];
SWalHead
p
Head
;
SWalHead
wal
Head
;
}
SVWriteMsg
;
// vnodeStatus
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
1e11d8d7
...
...
@@ -90,7 +90,7 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara
// forward to peers, even it is WAL/FWD, it shall be called to update version in sync
int32_t
syncCode
=
0
;
bool
force
=
(
pWrite
==
NULL
?
false
:
pWrite
->
p
Head
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
bool
force
=
(
pWrite
==
NULL
?
false
:
pWrite
->
wal
Head
.
msgType
!=
TSDB_MSG_TYPE_SUBMIT
);
syncCode
=
syncForwardToPeer
(
pVnode
->
sync
,
pHead
,
pWrite
,
qtype
,
force
);
if
(
syncCode
<
0
)
{
pHead
->
version
=
0
;
...
...
@@ -237,7 +237,7 @@ static SVWriteMsg *vnodeBuildVWriteMsg(SVnodeObj *pVnode, SWalHead *pHead, int32
return
NULL
;
}
int32_t
size
=
sizeof
(
SVWriteMsg
)
+
sizeof
(
SWalHead
)
+
pHead
->
len
;
int32_t
size
=
sizeof
(
SVWriteMsg
)
+
pHead
->
len
;
SVWriteMsg
*
pWrite
=
taosAllocateQitem
(
size
);
if
(
pWrite
==
NULL
)
{
terrno
=
TSDB_CODE_VND_OUT_OF_MEMORY
;
...
...
@@ -248,7 +248,7 @@ static SVWriteMsg *vnodeBuildVWriteMsg(SVnodeObj *pVnode, SWalHead *pHead, int32
pWrite
->
rpcMsg
=
*
pRpcMsg
;
}
memcpy
(
&
pWrite
->
p
Head
,
pHead
,
sizeof
(
SWalHead
)
+
pHead
->
len
);
memcpy
(
&
pWrite
->
wal
Head
,
pHead
,
sizeof
(
SWalHead
)
+
pHead
->
len
);
pWrite
->
pVnode
=
pVnode
;
pWrite
->
qtype
=
qtype
;
...
...
@@ -286,7 +286,7 @@ static int32_t vnodeWriteToWQueueImp(SVWriteMsg *pWrite) {
}
int32_t
queued
=
atomic_add_fetch_32
(
&
pVnode
->
queuedWMsg
,
1
);
int64_t
queuedSize
=
atomic_add_fetch_64
(
&
pVnode
->
queuedWMsgSize
,
pWrite
->
p
Head
.
len
);
int64_t
queuedSize
=
atomic_add_fetch_64
(
&
pVnode
->
queuedWMsgSize
,
pWrite
->
wal
Head
.
len
);
if
(
queued
>
MAX_QUEUED_MSG_NUM
||
queuedSize
>
MAX_QUEUED_MSG_SIZE
)
{
int32_t
ms
=
(
queued
/
MAX_QUEUED_MSG_NUM
)
*
10
+
3
;
...
...
@@ -330,7 +330,7 @@ void vnodeFreeFromWQueue(void *vparam, SVWriteMsg *pWrite) {
SVnodeObj
*
pVnode
=
vparam
;
if
(
pVnode
)
{
int32_t
queued
=
atomic_sub_fetch_32
(
&
pVnode
->
queuedWMsg
,
1
);
int64_t
queuedSize
=
atomic_sub_fetch_64
(
&
pVnode
->
queuedWMsgSize
,
pWrite
->
p
Head
.
len
);
int64_t
queuedSize
=
atomic_sub_fetch_64
(
&
pVnode
->
queuedWMsgSize
,
pWrite
->
wal
Head
.
len
);
vTrace
(
"vgId:%d, msg:%p, app:%p, free from vwqueue, queued:%d size:%"
PRId64
,
pVnode
->
vgId
,
pWrite
,
pWrite
->
rpcMsg
.
ahandle
,
queued
,
queuedSize
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录