Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7dc3c6b4
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
7dc3c6b4
编写于
2月 23, 2023
作者:
X
Xiaoyu Wang
提交者:
GitHub
2月 23, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20056 from taosdata/FIX/TD-22595-main
fix: synchronize access to pVnode->inUse
上级
f6ba2d72
a78556a3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
15 deletion
+18
-15
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-1
source/dnode/vnode/src/vnd/vnodeBufPool.c
source/dnode/vnode/src/vnd/vnodeBufPool.c
+6
-1
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+11
-13
未找到文件。
source/common/src/tglobal.c
浏览文件 @
7dc3c6b4
...
@@ -61,7 +61,7 @@ int32_t tsHeartbeatInterval = 1000;
...
@@ -61,7 +61,7 @@ int32_t tsHeartbeatInterval = 1000;
int32_t
tsHeartbeatTimeout
=
20
*
1000
;
int32_t
tsHeartbeatTimeout
=
20
*
1000
;
// vnode
// vnode
int64_t
tsVndCommitMaxIntervalMs
=
60
*
1000
;
int64_t
tsVndCommitMaxIntervalMs
=
60
0
*
1000
;
// monitor
// monitor
bool
tsEnableMonitor
=
true
;
bool
tsEnableMonitor
=
true
;
...
...
source/dnode/vnode/src/vnd/vnodeBufPool.c
浏览文件 @
7dc3c6b4
...
@@ -94,6 +94,7 @@ int vnodeOpenBufPool(SVnode *pVnode) {
...
@@ -94,6 +94,7 @@ int vnodeOpenBufPool(SVnode *pVnode) {
int
vnodeCloseBufPool
(
SVnode
*
pVnode
)
{
int
vnodeCloseBufPool
(
SVnode
*
pVnode
)
{
SVBufPool
*
pPool
;
SVBufPool
*
pPool
;
taosThreadMutexLock
(
&
pVnode
->
mutex
);
for
(
pPool
=
pVnode
->
pPool
;
pPool
;
pPool
=
pVnode
->
pPool
)
{
for
(
pPool
=
pVnode
->
pPool
;
pPool
;
pPool
=
pVnode
->
pPool
)
{
pVnode
->
pPool
=
pPool
->
next
;
pVnode
->
pPool
=
pPool
->
next
;
vnodeBufPoolDestroy
(
pPool
);
vnodeBufPoolDestroy
(
pPool
);
...
@@ -103,8 +104,9 @@ int vnodeCloseBufPool(SVnode *pVnode) {
...
@@ -103,8 +104,9 @@ int vnodeCloseBufPool(SVnode *pVnode) {
vnodeBufPoolDestroy
(
pVnode
->
inUse
);
vnodeBufPoolDestroy
(
pVnode
->
inUse
);
pVnode
->
inUse
=
NULL
;
pVnode
->
inUse
=
NULL
;
}
}
vDebug
(
"vgId:%d, vnode buffer pool is closed"
,
TD_VID
(
pVnode
)
);
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
vDebug
(
"vgId:%d, vnode buffer pool is closed"
,
TD_VID
(
pVnode
));
return
0
;
return
0
;
}
}
...
@@ -244,6 +246,9 @@ void vnodeBufPoolUnRef(SVBufPool *pPool) {
...
@@ -244,6 +246,9 @@ void vnodeBufPoolUnRef(SVBufPool *pPool) {
pVnode
->
pPool
=
pPool
;
pVnode
->
pPool
=
pPool
;
taosThreadCondSignal
(
&
pVnode
->
poolNotEmpty
);
taosThreadCondSignal
(
&
pVnode
->
poolNotEmpty
);
if
(
pVnode
->
inUse
==
pPool
)
{
pVnode
->
inUse
=
NULL
;
}
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
}
}
}
}
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
7dc3c6b4
...
@@ -87,22 +87,21 @@ void vnodeUpdCommitSched(SVnode *pVnode) {
...
@@ -87,22 +87,21 @@ void vnodeUpdCommitSched(SVnode *pVnode) {
}
}
int
vnodeShouldCommit
(
SVnode
*
pVnode
)
{
int
vnodeShouldCommit
(
SVnode
*
pVnode
)
{
if
(
!
pVnode
->
inUse
||
!
osDataSpaceAvailable
())
{
return
false
;
}
SVCommitSched
*
pSched
=
&
pVnode
->
commitSched
;
SVCommitSched
*
pSched
=
&
pVnode
->
commitSched
;
int64_t
nowMs
=
taosGetMonoTimestampMs
();
int64_t
nowMs
=
taosGetMonoTimestampMs
();
bool
diskAvail
=
osDataSpaceAvailable
();
bool
needCommit
=
false
;
return
(((
pVnode
->
inUse
->
size
>
pVnode
->
inUse
->
node
.
size
)
&&
(
pSched
->
commitMs
+
SYNC_VND_COMMIT_MIN_MS
<
nowMs
))
||
taosThreadMutexLock
(
&
pVnode
->
mutex
);
(
pVnode
->
inUse
->
size
>
0
&&
pSched
->
commitMs
+
pSched
->
maxWaitMs
<
nowMs
));
if
(
!
pVnode
->
inUse
||
!
diskAvail
)
{
}
goto
_out
;
int
vnodeShouldCommitOld
(
SVnode
*
pVnode
)
{
if
(
pVnode
->
inUse
)
{
return
osDataSpaceAvailable
()
&&
(
pVnode
->
inUse
->
size
>
pVnode
->
inUse
->
node
.
size
);
}
}
return
false
;
needCommit
=
(((
pVnode
->
inUse
->
size
>
pVnode
->
inUse
->
node
.
size
)
&&
(
pSched
->
commitMs
+
SYNC_VND_COMMIT_MIN_MS
<
nowMs
))
||
(
pVnode
->
inUse
->
size
>
0
&&
pSched
->
commitMs
+
pSched
->
maxWaitMs
<
nowMs
));
_out:
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
return
needCommit
;
}
}
int
vnodeSaveInfo
(
const
char
*
dir
,
const
SVnodeInfo
*
pInfo
)
{
int
vnodeSaveInfo
(
const
char
*
dir
,
const
SVnodeInfo
*
pInfo
)
{
...
@@ -259,7 +258,6 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
...
@@ -259,7 +258,6 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
metaPrepareAsyncCommit
(
pVnode
->
pMeta
);
metaPrepareAsyncCommit
(
pVnode
->
pMeta
);
vnodeBufPoolUnRef
(
pVnode
->
inUse
);
vnodeBufPoolUnRef
(
pVnode
->
inUse
);
pVnode
->
inUse
=
NULL
;
_exit:
_exit:
if
(
code
)
{
if
(
code
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录