Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ddfcba76
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,发现更多精彩内容 >>
提交
ddfcba76
编写于
3月 21, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: optimize table merge scan perf
上级
ddab83a2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
1 deletion
+16
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+16
-1
未找到文件。
source/libs/executor/src/scanoperator.c
浏览文件 @
ddfcba76
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "thash.h"
#include "thash.h"
#include "ttypes.h"
#include "ttypes.h"
#define MULTI_READER_MAX_TABLE_NUM 5000
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
...
@@ -44,6 +45,7 @@ typedef struct STableMergeScanSortSourceParam {
...
@@ -44,6 +45,7 @@ typedef struct STableMergeScanSortSourceParam {
int32_t
readerIdx
;
int32_t
readerIdx
;
uint64_t
uid
;
uint64_t
uid
;
SSDataBlock
*
inputBlock
;
SSDataBlock
*
inputBlock
;
bool
multiReader
;
STsdbReader
*
dataReader
;
STsdbReader
*
dataReader
;
}
STableMergeScanSortSourceParam
;
}
STableMergeScanSortSourceParam
;
...
@@ -2595,7 +2597,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
...
@@ -2595,7 +2597,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
void
*
p
=
tableListGetInfo
(
pTaskInfo
->
pTableInfoList
,
readIdx
+
pInfo
->
tableStartIndex
);
void
*
p
=
tableListGetInfo
(
pTaskInfo
->
pTableInfoList
,
readIdx
+
pInfo
->
tableStartIndex
);
SReadHandle
*
pHandle
=
&
pInfo
->
base
.
readHandle
;
SReadHandle
*
pHandle
=
&
pInfo
->
base
.
readHandle
;
if
(
NULL
==
source
->
dataReader
)
{
if
(
NULL
==
source
->
dataReader
||
!
source
->
multiReader
)
{
code
=
tsdbReaderOpen
(
pHandle
->
vnode
,
pQueryCond
,
p
,
1
,
pBlock
,
&
source
->
dataReader
,
GET_TASKID
(
pTaskInfo
));
code
=
tsdbReaderOpen
(
pHandle
->
vnode
,
pQueryCond
,
p
,
1
,
pBlock
,
&
source
->
dataReader
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
...
@@ -2608,6 +2610,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
...
@@ -2608,6 +2610,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
while
(
tsdbNextDataBlock
(
reader
))
{
while
(
tsdbNextDataBlock
(
reader
))
{
if
(
isTaskKilled
(
pTaskInfo
))
{
if
(
isTaskKilled
(
pTaskInfo
))
{
tsdbReleaseDataBlock
(
reader
);
tsdbReleaseDataBlock
(
reader
);
pInfo
->
base
.
dataReader
=
NULL
;
T_LONG_JMP
(
pTaskInfo
->
env
,
pTaskInfo
->
code
);
T_LONG_JMP
(
pTaskInfo
->
env
,
pTaskInfo
->
code
);
}
}
...
@@ -2641,10 +2644,18 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
...
@@ -2641,10 +2644,18 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
pInfo
->
base
.
readRecorder
.
elapsedTime
+=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
pInfo
->
base
.
readRecorder
.
elapsedTime
+=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
qTrace
(
"tsdb/read-table-data: %p, close reader"
,
reader
);
qTrace
(
"tsdb/read-table-data: %p, close reader"
,
reader
);
if
(
!
source
->
multiReader
)
{
tsdbReaderClose
(
pInfo
->
base
.
dataReader
);
source
->
dataReader
=
NULL
;
}
pInfo
->
base
.
dataReader
=
NULL
;
pInfo
->
base
.
dataReader
=
NULL
;
return
pBlock
;
return
pBlock
;
}
}
if
(
!
source
->
multiReader
)
{
tsdbReaderClose
(
pInfo
->
base
.
dataReader
);
source
->
dataReader
=
NULL
;
}
pInfo
->
base
.
dataReader
=
NULL
;
pInfo
->
base
.
dataReader
=
NULL
;
return
NULL
;
return
NULL
;
}
}
...
@@ -2716,6 +2727,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
...
@@ -2716,6 +2727,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
STableMergeScanSortSourceParam
param
=
{
0
};
STableMergeScanSortSourceParam
param
=
{
0
};
param
.
readerIdx
=
i
;
param
.
readerIdx
=
i
;
param
.
pOperator
=
pOperator
;
param
.
pOperator
=
pOperator
;
param
.
multiReader
=
(
numOfTable
<=
MULTI_READER_MAX_TABLE_NUM
)
?
true
:
false
;
param
.
inputBlock
=
createOneDataBlock
(
pInfo
->
pResBlock
,
false
);
param
.
inputBlock
=
createOneDataBlock
(
pInfo
->
pResBlock
,
false
);
blockDataEnsureCapacity
(
param
.
inputBlock
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
param
.
inputBlock
,
pOperator
->
resultInfo
.
capacity
);
...
@@ -2877,6 +2889,9 @@ void destroyTableMergeScanOperatorInfo(void* param) {
...
@@ -2877,6 +2889,9 @@ void destroyTableMergeScanOperatorInfo(void* param) {
p
->
dataReader
=
NULL
;
p
->
dataReader
=
NULL
;
}
}
tsdbReaderClose
(
pTableScanInfo
->
base
.
dataReader
);
pTableScanInfo
->
base
.
dataReader
=
NULL
;
taosArrayDestroy
(
pTableScanInfo
->
sortSourceParams
);
taosArrayDestroy
(
pTableScanInfo
->
sortSourceParams
);
tsortDestroySortHandle
(
pTableScanInfo
->
pSortHandle
);
tsortDestroySortHandle
(
pTableScanInfo
->
pSortHandle
);
pTableScanInfo
->
pSortHandle
=
NULL
;
pTableScanInfo
->
pSortHandle
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录