Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f0e9656b
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看板
提交
f0e9656b
编写于
1月 10, 2023
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'fix/long_query' of
https://github.com/taosdata/TDengine
into fix/long_query
上级
3178843b
851dba51
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
21 deletion
+37
-21
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+37
-21
未找到文件。
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
f0e9656b
...
...
@@ -79,12 +79,16 @@ _exit:
}
return
code
;
}
int
vnodeBegin
(
SVnode
*
pVnode
)
{
// alloc buffer pool
static
int32_t
vnodeGetBufPoolToUse
(
SVnode
*
pVnode
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
taosThreadMutexLock
(
&
pVnode
->
mutex
);
int32_t
nTry
=
0
;
while
(
++
nTry
)
{
for
(;;)
{
++
nTry
;
if
(
pVnode
->
freeList
)
{
vDebug
(
"vgId:%d allocate free buffer pool on %d try, pPool:%p id:%d"
,
TD_VID
(
pVnode
),
nTry
,
pVnode
->
freeList
,
pVnode
->
freeList
->
id
);
...
...
@@ -97,12 +101,8 @@ int vnodeBegin(SVnode *pVnode) {
}
else
{
vInfo
(
"vgId:%d no free buffer pool on %d try, try to recycle..."
,
TD_VID
(
pVnode
),
nTry
);
terrno
=
vnodeTryRecycleBufPool
(
pVnode
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d %s failed since %s"
,
TD_VID
(
pVnode
),
__func__
,
tstrerror
(
terrno
));
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
return
-
1
;
}
code
=
vnodeTryRecycleBufPool
(
pVnode
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
pVnode
->
freeList
==
NULL
)
{
vDebug
(
"vgId:%d no free buffer pool on %d try, wait %d ms..."
,
TD_VID
(
pVnode
),
nTry
,
WAIT_TIME_MILI_SEC
);
...
...
@@ -115,37 +115,53 @@ int vnodeBegin(SVnode *pVnode) {
int32_t
rc
=
taosThreadCondTimedWait
(
&
pVnode
->
poolNotEmpty
,
&
pVnode
->
mutex
,
&
ts
);
if
(
rc
&&
rc
!=
ETIMEDOUT
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
rc
);
vError
(
"vgId:%d %s failed since %s"
,
TD_VID
(
pVnode
),
__func__
,
tstrerror
(
terrno
));
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
return
-
1
;
code
=
TAOS_SYSTEM_ERROR
(
rc
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
}
}
_exit:
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
if
(
code
)
{
vError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
return
code
;
}
int
vnodeBegin
(
SVnode
*
pVnode
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
pVnode
->
state
.
commitID
++
;
// alloc buffer pool
code
=
vnodeGetBufPoolToUse
(
pVnode
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// begin meta
if
(
metaBegin
(
pVnode
->
pMeta
,
META_BEGIN_HEAP_BUFFERPOOL
)
<
0
)
{
vError
(
"vgId:%d, failed to begin meta since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
))
;
return
-
1
;
code
=
terrno
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
// begin tsdb
if
(
tsdbBegin
(
pVnode
->
pTsdb
)
<
0
)
{
vError
(
"vgId:%d, failed to begin tsdb since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
))
;
return
-
1
;
code
=
terrno
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
// begin sma
if
(
VND_IS_RSMA
(
pVnode
)
&&
smaBegin
(
pVnode
->
pSma
)
<
0
)
{
vError
(
"vgId:%d, failed to begin sma since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
))
;
return
-
1
;
code
=
terrno
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
)
;
}
return
0
;
_exit:
if
(
code
)
{
vError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
return
code
;
}
void
vnodeUpdCommitSched
(
SVnode
*
pVnode
)
{
...
...
@@ -160,7 +176,7 @@ int vnodeShouldCommit(SVnode *pVnode) {
}
SVCommitSched
*
pSched
=
&
pVnode
->
commitSched
;
int64_t
nowMs
=
taosGetMonoTimestampMs
();
int64_t
nowMs
=
taosGetMonoTimestampMs
();
return
(((
pVnode
->
inUse
->
size
>
pVnode
->
inUse
->
node
.
size
)
&&
(
pSched
->
commitMs
+
SYNC_VND_COMMIT_MIN_MS
<
nowMs
))
||
(
pVnode
->
inUse
->
size
>
0
&&
pSched
->
commitMs
+
pSched
->
maxWaitMs
<
nowMs
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录