Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6914c4dd
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看板
未验证
提交
6914c4dd
编写于
6月 25, 2023
作者:
D
dapan1121
提交者:
GitHub
6月 25, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21804 from taosdata/fix/TD-24895
fix: merge tree free rc issue
上级
3b394b72
5135d753
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
44 addition
and
7 deletion
+44
-7
include/util/tlosertree.h
include/util/tlosertree.h
+1
-1
source/libs/executor/inc/tsort.h
source/libs/executor/inc/tsort.h
+4
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+5
-0
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+10
-0
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+21
-3
source/util/src/tlosertree.c
source/util/src/tlosertree.c
+3
-3
未找到文件。
include/util/tlosertree.h
浏览文件 @
6914c4dd
...
...
@@ -43,7 +43,7 @@ typedef struct SMultiwayMergeTreeInfo {
int32_t
tMergeTreeCreate
(
SMultiwayMergeTreeInfo
**
pTree
,
uint32_t
numOfEntries
,
void
*
param
,
__merge_compare_fn_t
compareFn
);
void
tMergeTreeDestroy
(
SMultiwayMergeTreeInfo
*
pTree
);
void
tMergeTreeDestroy
(
SMultiwayMergeTreeInfo
*
*
pTree
);
void
tMergeTreeAdjust
(
SMultiwayMergeTreeInfo
*
pTree
,
int32_t
idx
);
...
...
source/libs/executor/inc/tsort.h
浏览文件 @
6914c4dd
...
...
@@ -170,6 +170,10 @@ SSortExecInfo tsortGetSortExecInfo(SSortHandle* pHandle);
*/
int32_t
getProperSortPageSize
(
size_t
rowSize
,
uint32_t
numOfCols
);
bool
tsortIsClosed
(
SSortHandle
*
pHandle
);
void
tsortSetClosed
(
SSortHandle
*
pHandle
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
6914c4dd
...
...
@@ -2895,6 +2895,11 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock*
}
}
if
(
tsortIsClosed
(
pHandle
))
{
terrno
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
T_LONG_JMP
(
pOperator
->
pTaskInfo
->
env
,
terrno
);
}
bool
limitReached
=
applyLimitOffset
(
&
pInfo
->
limitInfo
,
pResBlock
,
pTaskInfo
);
qDebug
(
"%s get sorted row block, rows:%"
PRId64
", limit:%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pResBlock
->
info
.
rows
,
pInfo
->
limitInfo
.
numOfOutputRows
);
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
6914c4dd
...
...
@@ -228,6 +228,11 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) {
// multi-group case not handle here
SSDataBlock
*
pBlock
=
NULL
;
while
(
1
)
{
if
(
tsortIsClosed
(
pInfo
->
pSortHandle
))
{
terrno
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
T_LONG_JMP
(
pOperator
->
pTaskInfo
->
env
,
terrno
);
}
pBlock
=
getSortedBlockData
(
pInfo
->
pSortHandle
,
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
pInfo
->
matchInfo
.
pList
,
pInfo
);
if
(
pBlock
==
NULL
)
{
...
...
@@ -439,6 +444,11 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
SSDataBlock
*
pBlock
=
NULL
;
while
(
pInfo
->
pCurrSortHandle
!=
NULL
)
{
if
(
tsortIsClosed
(
pInfo
->
pCurrSortHandle
))
{
terrno
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
T_LONG_JMP
(
pOperator
->
pTaskInfo
->
env
,
terrno
);
}
// beginSortGroup would fetch all child blocks of pInfo->currGroupId;
ASSERT
(
pInfo
->
childOpStatus
!=
CHILD_OP_SAME_GROUP
);
pBlock
=
getGroupSortedBlockData
(
pInfo
->
pCurrSortHandle
,
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
...
...
source/libs/executor/src/tsort.c
浏览文件 @
6914c4dd
...
...
@@ -46,6 +46,7 @@ struct SSortHandle {
SMsortComparParam
cmpParam
;
int32_t
numOfCompletedSources
;
bool
opened
;
int8_t
closed
;
const
char
*
idStr
;
bool
inMemSort
;
bool
needAdjust
;
...
...
@@ -152,7 +153,7 @@ void tsortDestroySortHandle(SSortHandle* pSortHandle) {
tsortClose
(
pSortHandle
);
if
(
pSortHandle
->
pMergeTree
!=
NULL
)
{
tMergeTreeDestroy
(
pSortHandle
->
pMergeTree
);
tMergeTreeDestroy
(
&
pSortHandle
->
pMergeTree
);
}
destroyDiskbasedBuf
(
pSortHandle
->
pBuf
);
...
...
@@ -581,6 +582,11 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
SArray
*
pPageIdList
=
taosArrayInit
(
4
,
sizeof
(
int32_t
));
while
(
1
)
{
if
(
tsortIsClosed
(
pHandle
))
{
code
=
terrno
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
return
code
;
}
SSDataBlock
*
pDataBlock
=
getSortedBlockDataInner
(
pHandle
,
&
pHandle
->
cmpParam
,
numOfRows
);
if
(
pDataBlock
==
NULL
)
{
break
;
...
...
@@ -609,7 +615,7 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
}
sortComparCleanup
(
&
pHandle
->
cmpParam
);
tMergeTreeDestroy
(
pHandle
->
pMergeTree
);
tMergeTreeDestroy
(
&
pHandle
->
pMergeTree
);
pHandle
->
numOfCompletedSources
=
0
;
SSDataBlock
*
pBlock
=
createOneDataBlock
(
pHandle
->
pDataBlock
,
false
);
...
...
@@ -803,10 +809,19 @@ int32_t tsortOpen(SSortHandle* pHandle) {
}
int32_t
tsortClose
(
SSortHandle
*
pHandle
)
{
// do nothing
atomic_val_compare_exchange_8
(
&
pHandle
->
closed
,
0
,
1
);
taosMsleep
(
10
);
return
TSDB_CODE_SUCCESS
;
}
bool
tsortIsClosed
(
SSortHandle
*
pHandle
)
{
return
atomic_val_compare_exchange_8
(
&
pHandle
->
closed
,
1
,
2
);
}
void
tsortSetClosed
(
SSortHandle
*
pHandle
)
{
atomic_store_8
(
&
pHandle
->
closed
,
2
);
}
int32_t
tsortSetFetchRawDataFp
(
SSortHandle
*
pHandle
,
_sort_fetch_block_fn_t
fetchFp
,
void
(
*
fp
)(
SSDataBlock
*
,
void
*
),
void
*
param
)
{
pHandle
->
fetchfp
=
fetchFp
;
...
...
@@ -826,6 +841,9 @@ int32_t tsortSetCompareGroupId(SSortHandle* pHandle, bool compareGroupId) {
}
STupleHandle
*
tsortNextTuple
(
SSortHandle
*
pHandle
)
{
if
(
tsortIsClosed
(
pHandle
))
{
return
NULL
;
}
if
(
pHandle
->
cmpParam
.
numOfSources
==
pHandle
->
numOfCompletedSources
)
{
return
NULL
;
}
...
...
source/util/src/tlosertree.c
浏览文件 @
6914c4dd
...
...
@@ -71,12 +71,12 @@ int32_t tMergeTreeCreate(SMultiwayMergeTreeInfo** pTree, uint32_t numOfSources,
return
0
;
}
void
tMergeTreeDestroy
(
SMultiwayMergeTreeInfo
*
pTree
)
{
if
(
pTree
==
NULL
)
{
void
tMergeTreeDestroy
(
SMultiwayMergeTreeInfo
*
*
pTree
)
{
if
(
pTree
==
NULL
||
*
pTree
==
NULL
)
{
return
;
}
taosMemoryFreeClear
(
pTree
);
taosMemoryFreeClear
(
*
pTree
);
}
void
tMergeTreeAdjust
(
SMultiwayMergeTreeInfo
*
pTree
,
int32_t
idx
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录