Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bb8840d4
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
bb8840d4
编写于
6月 16, 2023
作者:
D
dapan1121
提交者:
GitHub
6月 16, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21749 from taosdata/szhou/fix-ts3543
fix: table merge scan oom with muliti-level merge sort
上级
9a3781ea
e35553d6
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
12 addition
and
13 deletion
+12
-13
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+6
-13
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+6
-0
未找到文件。
source/libs/executor/src/scanoperator.c
浏览文件 @
bb8840d4
...
...
@@ -55,7 +55,6 @@ typedef struct STableMergeScanSortSourceParam {
int32_t
readerIdx
;
uint64_t
uid
;
SSDataBlock
*
inputBlock
;
bool
multiReader
;
STsdbReader
*
dataReader
;
}
STableMergeScanSortSourceParam
;
...
...
@@ -2658,8 +2657,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
int64_t
st
=
taosGetTimestampUs
();
void
*
p
=
tableListGetInfo
(
pInfo
->
base
.
pTableListInfo
,
readIdx
+
pInfo
->
tableStartIndex
);
SReadHandle
*
pHandle
=
&
pInfo
->
base
.
readHandle
;
if
(
NULL
==
source
->
dataReader
||
!
source
->
multiReader
)
{
if
(
NULL
==
source
->
dataReader
)
{
code
=
pAPI
->
tsdReader
.
tsdReaderOpen
(
pHandle
->
vnode
,
pQueryCond
,
p
,
1
,
pBlock
,
(
void
**
)
&
source
->
dataReader
,
GET_TASKID
(
pTaskInfo
),
false
,
NULL
);
if
(
code
!=
0
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
...
...
@@ -2723,19 +2721,14 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
pInfo
->
base
.
readRecorder
.
elapsedTime
+=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
qTrace
(
"tsdb/read-table-data: %p, close reader"
,
reader
);
if
(
!
source
->
multiReader
)
{
pAPI
->
tsdReader
.
tsdReaderClose
(
pInfo
->
base
.
dataReader
);
source
->
dataReader
=
NULL
;
}
pInfo
->
base
.
dataReader
=
NULL
;
return
pBlock
;
}
if
(
!
source
->
multiReader
)
{
pAPI
->
tsdReader
.
tsdReaderClose
(
pInfo
->
base
.
dataReader
);
pAPI
->
tsdReader
.
tsdReaderClose
(
source
->
dataReader
);
source
->
dataReader
=
NULL
;
}
pInfo
->
base
.
dataReader
=
NULL
;
return
NULL
;
}
...
...
@@ -2791,7 +2784,8 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
// todo the total available buffer should be determined by total capacity of buffer of this task.
// the additional one is reserved for merge result
pInfo
->
sortBufSize
=
pInfo
->
bufPageSize
*
(
tableEndIdx
-
tableStartIdx
+
1
+
1
);
// pInfo->sortBufSize = pInfo->bufPageSize * (tableEndIdx - tableStartIdx + 1 + 1);
pInfo
->
sortBufSize
=
pInfo
->
bufPageSize
*
(
256
+
1
);
int32_t
numOfBufPage
=
pInfo
->
sortBufSize
/
pInfo
->
bufPageSize
;
pInfo
->
pSortHandle
=
tsortCreateSortHandle
(
pInfo
->
pSortInfo
,
SORT_MULTISOURCE_MERGE
,
pInfo
->
bufPageSize
,
numOfBufPage
,
pInfo
->
pSortInputBlock
,
pTaskInfo
->
id
.
str
);
...
...
@@ -2806,7 +2800,6 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
STableMergeScanSortSourceParam
param
=
{
0
};
param
.
readerIdx
=
i
;
param
.
pOperator
=
pOperator
;
param
.
multiReader
=
(
numOfTable
<=
MULTI_READER_MAX_TABLE_NUM
)
?
true
:
false
;
param
.
inputBlock
=
createOneDataBlock
(
pInfo
->
pResBlock
,
false
);
blockDataEnsureCapacity
(
param
.
inputBlock
,
pOperator
->
resultInfo
.
capacity
);
...
...
source/libs/executor/src/tsort.c
浏览文件 @
bb8840d4
...
...
@@ -101,7 +101,11 @@ static int32_t sortComparCleanup(SMsortComparParam* cmpParam) {
for
(
int32_t
i
=
0
;
i
<
cmpParam
->
numOfSources
;
++
i
)
{
SSortSource
*
pSource
=
cmpParam
->
pSources
[
i
];
blockDataDestroy
(
pSource
->
src
.
pBlock
);
if
(
pSource
->
pageIdList
)
{
taosArrayDestroy
(
pSource
->
pageIdList
);
}
taosMemoryFreeClear
(
pSource
);
cmpParam
->
pSources
[
i
]
=
NULL
;
}
cmpParam
->
numOfSources
=
0
;
...
...
@@ -123,9 +127,11 @@ void tsortClearOrderdSource(SArray* pOrderedSource, int64_t *fetchUs, int64_t *f
// release pageIdList
if
((
*
pSource
)
->
pageIdList
)
{
taosArrayDestroy
((
*
pSource
)
->
pageIdList
);
(
*
pSource
)
->
pageIdList
=
NULL
;
}
if
((
*
pSource
)
->
param
&&
!
(
*
pSource
)
->
onlyRef
)
{
taosMemoryFree
((
*
pSource
)
->
param
);
(
*
pSource
)
->
param
=
NULL
;
}
if
(
!
(
*
pSource
)
->
onlyRef
&&
(
*
pSource
)
->
src
.
pBlock
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录