Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e42f895f
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e42f895f
编写于
11月 22, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix select null crash issue and asan issues
上级
e2e52897
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
52 addition
and
16 deletion
+52
-16
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+1
-1
source/libs/executor/inc/tsort.h
source/libs/executor/inc/tsort.h
+6
-5
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-0
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+6
-2
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+37
-7
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+1
-1
未找到文件。
source/common/src/tdatablock.c
浏览文件 @
e42f895f
...
...
@@ -36,7 +36,7 @@ int32_t colDataGetFullLength(const SColumnInfoData* pColumnInfoData, int32_t num
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
return
pColumnInfoData
->
varmeta
.
length
+
sizeof
(
int32_t
)
*
numOfRows
;
}
else
{
return
pColumnInfoData
->
info
.
bytes
*
numOfRows
+
BitmapLen
(
numOfRows
);
return
((
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_NULL
)
?
0
:
pColumnInfoData
->
info
.
bytes
*
numOfRows
)
+
BitmapLen
(
numOfRows
);
}
}
...
...
source/libs/executor/inc/tsort.h
浏览文件 @
e42f895f
...
...
@@ -36,12 +36,13 @@ typedef struct SMultiMergeSource {
typedef
struct
SSortSource
{
SMultiMergeSource
src
;
union
{
struct
{
SArray
*
pageIdList
;
int32_t
pageIndex
;
};
struct
{
SArray
*
pageIdList
;
int32_t
pageIndex
;
}
;
struct
{
void
*
param
;
bool
onlyRef
;
};
}
SSortSource
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
e42f895f
...
...
@@ -4532,6 +4532,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
SSortSource
*
ps
=
taosMemoryCalloc
(
1
,
sizeof
(
SSortSource
));
STableMergeScanSortSourceParam
*
param
=
taosArrayGet
(
pInfo
->
sortSourceParams
,
i
);
ps
->
param
=
param
;
ps
->
onlyRef
=
true
;
tsortAddSource
(
pInfo
->
pSortHandle
,
ps
);
}
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
e42f895f
...
...
@@ -176,10 +176,10 @@ int32_t doOpenSortOperator(SOperatorInfo* pOperator) {
SSortSource
*
ps
=
taosMemoryCalloc
(
1
,
sizeof
(
SSortSource
));
ps
->
param
=
pOperator
->
pDownstream
[
0
];
ps
->
onlyRef
=
true
;
tsortAddSource
(
pInfo
->
pSortHandle
,
ps
);
int32_t
code
=
tsortOpen
(
pInfo
->
pSortHandle
);
taosMemoryFreeClear
(
ps
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
terrno
);
...
...
@@ -377,10 +377,10 @@ int32_t beginSortGroup(SOperatorInfo* pOperator) {
param
->
childOpInfo
=
pOperator
->
pDownstream
[
0
];
param
->
grpSortOpInfo
=
pInfo
;
ps
->
param
=
param
;
ps
->
onlyRef
=
false
;
tsortAddSource
(
pInfo
->
pCurrSortHandle
,
ps
);
int32_t
code
=
tsortOpen
(
pInfo
->
pCurrSortHandle
);
taosMemoryFreeClear
(
ps
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
terrno
);
...
...
@@ -471,6 +471,9 @@ void destroyGroupSortOperatorInfo(void* param) {
taosArrayDestroy
(
pInfo
->
pSortInfo
);
taosArrayDestroy
(
pInfo
->
matchInfo
.
pList
);
tsortDestroySortHandle
(
pInfo
->
pCurrSortHandle
);
pInfo
->
pCurrSortHandle
=
NULL
;
taosMemoryFreeClear
(
param
);
}
...
...
@@ -563,6 +566,7 @@ int32_t doOpenMultiwayMergeOperator(SOperatorInfo* pOperator) {
for
(
int32_t
i
=
0
;
i
<
pOperator
->
numOfDownstream
;
++
i
)
{
SSortSource
*
ps
=
taosMemoryCalloc
(
1
,
sizeof
(
SSortSource
));
ps
->
param
=
pOperator
->
pDownstream
[
i
];
ps
->
onlyRef
=
true
;
tsortAddSource
(
pInfo
->
pSortHandle
,
ps
);
}
...
...
source/libs/executor/src/tsort.c
浏览文件 @
e42f895f
...
...
@@ -110,6 +110,22 @@ static int32_t sortComparCleanup(SMsortComparParam* cmpParam) {
return
TSDB_CODE_SUCCESS
;
}
void
tsortClearOrderdSource
(
SArray
*
pOrderedSource
)
{
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
pOrderedSource
);
i
++
)
{
SSortSource
**
pSource
=
taosArrayGet
(
pOrderedSource
,
i
);
if
(
NULL
==
*
pSource
)
{
continue
;
}
if
((
*
pSource
)
->
param
&&
!
(
*
pSource
)
->
onlyRef
)
{
taosMemoryFree
((
*
pSource
)
->
param
);
}
taosMemoryFreeClear
(
*
pSource
);
}
taosArrayClear
(
pOrderedSource
);
}
void
tsortDestroySortHandle
(
SSortHandle
*
pSortHandle
)
{
if
(
pSortHandle
==
NULL
)
{
return
;
...
...
@@ -123,10 +139,8 @@ void tsortDestroySortHandle(SSortHandle* pSortHandle) {
destroyDiskbasedBuf
(
pSortHandle
->
pBuf
);
taosMemoryFreeClear
(
pSortHandle
->
idStr
);
blockDataDestroy
(
pSortHandle
->
pDataBlock
);
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
pSortHandle
->
pOrderedSource
);
i
++
)
{
SSortSource
**
pSource
=
taosArrayGet
(
pSortHandle
->
pOrderedSource
,
i
);
taosMemoryFreeClear
(
*
pSource
);
}
tsortClearOrderdSource
(
pSortHandle
->
pOrderedSource
);
taosArrayDestroy
(
pSortHandle
->
pOrderedSource
);
taosMemoryFreeClear
(
pSortHandle
);
}
...
...
@@ -561,7 +575,7 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
}
}
t
aosArrayClear
(
pHandle
->
pOrderedSource
);
t
sortClearOrderdSource
(
pHandle
->
pOrderedSource
);
taosArrayAddAll
(
pHandle
->
pOrderedSource
,
pResList
);
taosArrayDestroy
(
pResList
);
...
...
@@ -598,8 +612,11 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
size_t
sortBufSize
=
pHandle
->
numOfPages
*
pHandle
->
pageSize
;
if
(
pHandle
->
type
==
SORT_SINGLESOURCE_SORT
)
{
SSortSource
*
source
=
taosArrayGetP
(
pHandle
->
pOrderedSource
,
0
);
taosArrayClear
(
pHandle
->
pOrderedSource
);
SSortSource
**
pSource
=
taosArrayGet
(
pHandle
->
pOrderedSource
,
0
);
SSortSource
*
source
=
*
pSource
;
*
pSource
=
NULL
;
tsortClearOrderdSource
(
pHandle
->
pOrderedSource
);
while
(
1
)
{
SSDataBlock
*
pBlock
=
pHandle
->
fetchfp
(
source
->
param
);
...
...
@@ -623,6 +640,10 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
int32_t
code
=
blockDataMerge
(
pHandle
->
pDataBlock
,
pBlock
);
if
(
code
!=
0
)
{
if
(
source
->
param
&&
!
source
->
onlyRef
)
{
taosMemoryFree
(
source
->
param
);
}
taosMemoryFree
(
source
);
return
code
;
}
...
...
@@ -632,6 +653,10 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
int64_t
p
=
taosGetTimestampUs
();
code
=
blockDataSort
(
pHandle
->
pDataBlock
,
pHandle
->
pSortInfo
);
if
(
code
!=
0
)
{
if
(
source
->
param
&&
!
source
->
onlyRef
)
{
taosMemoryFree
(
source
->
param
);
}
taosMemoryFree
(
source
);
return
code
;
}
...
...
@@ -642,6 +667,11 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
}
}
if
(
source
->
param
&&
!
source
->
onlyRef
)
{
taosMemoryFree
(
source
->
param
);
}
taosMemoryFree
(
source
);
if
(
pHandle
->
pDataBlock
!=
NULL
&&
pHandle
->
pDataBlock
->
info
.
rows
>
0
)
{
size_t
size
=
blockDataGetSize
(
pHandle
->
pDataBlock
);
...
...
source/util/src/tpagedbuf.c
浏览文件 @
e42f895f
...
...
@@ -107,7 +107,7 @@ static uint64_t allocatePositionInFile(SDiskbasedBuf* pBuf, size_t size) {
static
void
setPageNotInBuf
(
SPageInfo
*
pPageInfo
)
{
pPageInfo
->
pData
=
NULL
;
}
static
FORCE_INLINE
size_t
getAllocPageSize
(
int32_t
pageSize
)
{
return
pageSize
+
POINTER_BYTES
+
2
;
}
static
FORCE_INLINE
size_t
getAllocPageSize
(
int32_t
pageSize
)
{
return
pageSize
+
POINTER_BYTES
+
sizeof
(
SFilePage
)
;
}
/**
* +--------------------------+-------------------+--------------+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录