Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f9d643dd
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f9d643dd
编写于
12月 27, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
12月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19178 from taosdata/fix/set_scan_limit
enh: set scan limit
上级
c844922a
39eb62d8
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
105 addition
and
78 deletion
+105
-78
include/libs/executor/executor.h
include/libs/executor/executor.h
+1
-0
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+67
-61
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+4
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+28
-16
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+5
-1
未找到文件。
include/libs/executor/executor.h
浏览文件 @
f9d643dd
...
...
@@ -213,6 +213,7 @@ int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver);
int32_t
qStreamSourceRecoverStep2
(
qTaskInfo_t
tinfo
,
int64_t
ver
);
int32_t
qStreamRecoverFinish
(
qTaskInfo_t
tinfo
);
int32_t
qStreamRestoreParam
(
qTaskInfo_t
tinfo
);
bool
qStreamRecoverScanFinished
(
qTaskInfo_t
tinfo
);
#ifdef __cplusplus
}
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
f9d643dd
...
...
@@ -136,6 +136,7 @@ typedef struct {
SSchemaWrapper
*
schema
;
char
tbName
[
TSDB_TABLE_NAME_LEN
];
int8_t
recoverStep
;
int8_t
recoverScanFinished
;
SQueryTableDataCond
tableCond
;
int64_t
fillHistoryVer1
;
int64_t
fillHistoryVer2
;
...
...
@@ -182,7 +183,7 @@ struct SExecTaskInfo {
SSubplan
*
pSubplan
;
struct
SOperatorInfo
*
pRoot
;
SLocalFetch
localFetch
;
SArray
*
pResultBlockList
;
// result block list
SArray
*
pResultBlockList
;
// result block list
STaskStopInfo
stopInfo
;
};
...
...
@@ -263,7 +264,7 @@ typedef struct SExchangeInfo {
// SArray<SSDataBlock*>, result block list, used to keep the multi-block that
// passed by downstream operator
SArray
*
pResultBlockList
;
SArray
*
pRecycledBlocks
;
// build a pool for small data block to avoid to repeatly create and then destroy.
SArray
*
pRecycledBlocks
;
// build a pool for small data block to avoid to repeatly create and then destroy.
SSDataBlock
*
pDummyBlock
;
// dummy block, not keep data
bool
seqLoadData
;
// sequential load data or not, false by default
int32_t
current
;
...
...
@@ -468,6 +469,11 @@ typedef struct SStreamScanInfo {
SNodeList
*
pGroupTags
;
SNode
*
pTagCond
;
SNode
*
pTagIndexCond
;
// recover
int32_t
blockRecoverContiCnt
;
int32_t
blockRecoverTotCnt
;
}
SStreamScanInfo
;
typedef
struct
{
...
...
source/libs/executor/src/executor.c
浏览文件 @
f9d643dd
...
...
@@ -936,6 +936,10 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) {
}
return
0
;
}
bool
qStreamRecoverScanFinished
(
qTaskInfo_t
tinfo
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
return
pTaskInfo
->
streamInfo
.
recoverScanFinished
;
}
void
*
qExtractReaderFromStreamScanner
(
void
*
scanner
)
{
SStreamScanInfo
*
pInfo
=
scanner
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
f9d643dd
...
...
@@ -744,8 +744,8 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
tableListGetGroupList
(
pTaskInfo
->
pTableInfoList
,
pInfo
->
currentGroupId
,
&
pList
,
&
num
);
ASSERT
(
pInfo
->
base
.
dataReader
==
NULL
);
int32_t
code
=
tsdbReaderOpen
(
pInfo
->
base
.
readHandle
.
vnode
,
&
pInfo
->
base
.
cond
,
pList
,
num
,
pInfo
->
pResBlock
,
(
STsdbReader
**
)
&
pInfo
->
base
.
dataReader
,
GET_TASKID
(
pTaskInfo
));
int32_t
code
=
tsdbReaderOpen
(
pInfo
->
base
.
readHandle
.
vnode
,
&
pInfo
->
base
.
cond
,
pList
,
num
,
pInfo
->
pResBlock
,
(
STsdbReader
**
)
&
pInfo
->
base
.
dataReader
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
}
...
...
@@ -962,8 +962,8 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
SSDataBlock
*
pBlock
=
pTableScanInfo
->
pResBlock
;
STsdbReader
*
pReader
=
NULL
;
int32_t
code
=
tsdbReaderOpen
(
pTableScanInfo
->
base
.
readHandle
.
vnode
,
&
cond
,
&
tblInfo
,
1
,
pBlock
,
(
STsdbReader
**
)
&
pReader
,
GET_TASKID
(
pTaskInfo
));
int32_t
code
=
tsdbReaderOpen
(
pTableScanInfo
->
base
.
readHandle
.
vnode
,
&
cond
,
&
tblInfo
,
1
,
pBlock
,
(
STsdbReader
**
)
&
pReader
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
...
...
@@ -971,7 +971,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
}
if
(
tsdbNextDataBlock
(
pReader
))
{
/*SSDataBlock* p = */
tsdbRetrieveDataBlock
(
pReader
,
NULL
);
/*SSDataBlock* p = */
tsdbRetrieveDataBlock
(
pReader
,
NULL
);
doSetTagColumnData
(
&
pTableScanInfo
->
base
,
pBlock
,
pTaskInfo
,
pBlock
->
info
.
rows
);
pBlock
->
info
.
id
.
groupId
=
getTableGroupId
(
pTaskInfo
->
pTableInfoList
,
pBlock
->
info
.
id
.
uid
);
}
...
...
@@ -1729,11 +1729,18 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
pTSInfo
->
scanTimes
=
0
;
pTSInfo
->
currentGroupId
=
-
1
;
pTaskInfo
->
streamInfo
.
recoverStep
=
STREAM_RECOVER_STEP__SCAN
;
pTaskInfo
->
streamInfo
.
recoverScanFinished
=
false
;
}
if
(
pTaskInfo
->
streamInfo
.
recoverStep
==
STREAM_RECOVER_STEP__SCAN
)
{
if
(
pInfo
->
blockRecoverContiCnt
>
100
)
{
pInfo
->
blockRecoverTotCnt
+=
pInfo
->
blockRecoverContiCnt
;
pInfo
->
blockRecoverContiCnt
=
0
;
return
NULL
;
}
SSDataBlock
*
pBlock
=
doTableScan
(
pInfo
->
pTableScanOp
);
if
(
pBlock
!=
NULL
)
{
pInfo
->
blockRecoverContiCnt
++
;
calBlockTbName
(
pInfo
,
pBlock
);
if
(
pInfo
->
pUpdateInfo
)
{
TSKEY
maxTs
=
updateInfoFillBlockData
(
pInfo
->
pUpdateInfo
,
pBlock
,
pInfo
->
primaryTsIndex
);
...
...
@@ -1751,6 +1758,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
pTSInfo
->
base
.
cond
.
startVersion
=
-
1
;
pTSInfo
->
base
.
cond
.
endVersion
=
-
1
;
pTaskInfo
->
streamInfo
.
recoverScanFinished
=
true
;
return
NULL
;
}
...
...
@@ -2262,7 +2270,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
if
(
pHandle
->
initTableReader
)
{
pTSInfo
->
scanMode
=
TABLE_SCAN__TABLE_ORDER
;
pTSInfo
->
base
.
dataReader
=
NULL
;
code
=
tsdbReaderOpen
(
pHandle
->
vnode
,
&
pTSInfo
->
base
.
cond
,
pList
,
num
,
pTSInfo
->
pResBlock
,
&
pTSInfo
->
base
.
dataReader
,
NULL
);
code
=
tsdbReaderOpen
(
pHandle
->
vnode
,
&
pTSInfo
->
base
.
cond
,
pList
,
num
,
pTSInfo
->
pResBlock
,
&
pTSInfo
->
base
.
dataReader
,
NULL
);
if
(
code
!=
0
)
{
terrno
=
code
;
destroyTableScanOperatorInfo
(
pTableScanOp
);
...
...
@@ -2333,7 +2342,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pRes
->
pDataBlock
);
__optr_fn_t
nextFn
=
pTaskInfo
->
execModel
==
OPTR_EXEC_MODEL_STREAM
?
doStreamScan
:
doQueueScan
;
pOperator
->
fpSet
=
createOperatorFpSet
(
optrDummyOpenFn
,
nextFn
,
NULL
,
destroyStreamScanOperatorInfo
,
optrDefaultBufFn
,
NULL
);
pOperator
->
fpSet
=
createOperatorFpSet
(
optrDummyOpenFn
,
nextFn
,
NULL
,
destroyStreamScanOperatorInfo
,
optrDefaultBufFn
,
NULL
);
return
pOperator
;
...
...
@@ -2470,7 +2480,8 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
pOperator
->
fpSet
=
createOperatorFpSet
(
optrDummyOpenFn
,
doTagScan
,
NULL
,
destroyTagScanOperatorInfo
,
optrDefaultBufFn
,
NULL
);
pOperator
->
fpSet
=
createOperatorFpSet
(
optrDummyOpenFn
,
doTagScan
,
NULL
,
destroyTagScanOperatorInfo
,
optrDefaultBufFn
,
NULL
);
return
pOperator
;
...
...
@@ -2495,7 +2506,8 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
void
*
p
=
tableListGetInfo
(
pTaskInfo
->
pTableInfoList
,
readIdx
+
pInfo
->
tableStartIndex
);
SReadHandle
*
pHandle
=
&
pInfo
->
base
.
readHandle
;
int32_t
code
=
tsdbReaderOpen
(
pHandle
->
vnode
,
pQueryCond
,
p
,
1
,
pBlock
,
&
pInfo
->
base
.
dataReader
,
GET_TASKID
(
pTaskInfo
));
int32_t
code
=
tsdbReaderOpen
(
pHandle
->
vnode
,
pQueryCond
,
p
,
1
,
pBlock
,
&
pInfo
->
base
.
dataReader
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
0
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
}
...
...
@@ -3019,8 +3031,8 @@ SOperatorInfo* createTableCountScanOperatorInfo(SReadHandle* readHandle, STableC
setOperatorInfo
(
pOperator
,
"TableCountScanOperator"
,
QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
optrDummyOpenFn
,
doTableCountScan
,
NULL
,
destoryTableCountScanOperator
,
optrDefaultBufFn
,
NULL
);
pOperator
->
fpSet
=
createOperatorFpSet
(
optrDummyOpenFn
,
doTableCountScan
,
NULL
,
destoryTableCountScanOperator
,
optrDefaultBufFn
,
NULL
);
return
pOperator
;
_error:
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
f9d643dd
...
...
@@ -116,7 +116,11 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
ASSERT
(
0
);
}
if
(
output
==
NULL
)
{
if
(
qStreamRecoverScanFinished
(
exec
))
{
finished
=
true
;
}
else
{
qSetStreamOpOpen
(
exec
);
}
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录