Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
95d81604
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看板
提交
95d81604
编写于
4月 11, 2023
作者:
L
liuyao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:encode&&decode stream scan op
上级
524bb214
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
48 addition
and
4 deletion
+48
-4
include/libs/executor/executor.h
include/libs/executor/executor.h
+4
-0
include/libs/stream/streamState.h
include/libs/stream/streamState.h
+1
-0
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+2
-1
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+6
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+29
-0
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+4
-3
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+2
-0
未找到文件。
include/libs/executor/executor.h
浏览文件 @
95d81604
...
@@ -80,6 +80,10 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers);
...
@@ -80,6 +80,10 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers);
qTaskInfo_t
qCreateQueueExecTaskInfo
(
void
*
msg
,
SReadHandle
*
readers
,
int32_t
*
numOfCols
,
SSchemaWrapper
**
pSchema
);
qTaskInfo_t
qCreateQueueExecTaskInfo
(
void
*
msg
,
SReadHandle
*
readers
,
int32_t
*
numOfCols
,
SSchemaWrapper
**
pSchema
);
int32_t
qSetStreamOpOpen
(
qTaskInfo_t
tinfo
);
int32_t
qSetStreamOpOpen
(
qTaskInfo_t
tinfo
);
// todo refactor
void
qGetCheckpointVersion
(
qTaskInfo_t
tinfo
,
int64_t
*
dataVer
,
int64_t
*
ckId
);
/**
/**
* Set multiple input data blocks for the stream scan.
* Set multiple input data blocks for the stream scan.
* @param tinfo
* @param tinfo
...
...
include/libs/stream/streamState.h
浏览文件 @
95d81604
...
@@ -59,6 +59,7 @@ typedef struct {
...
@@ -59,6 +59,7 @@ typedef struct {
SStreamFileState
*
pFileState
;
SStreamFileState
*
pFileState
;
int32_t
number
;
int32_t
number
;
SSHashObj
*
parNameMap
;
SSHashObj
*
parNameMap
;
int64_t
checkPointId
;
}
SStreamState
;
}
SStreamState
;
SStreamState
*
streamStateOpen
(
char
*
path
,
SStreamTask
*
pTask
,
bool
specPath
,
int32_t
szPage
,
int32_t
pages
);
SStreamState
*
streamStateOpen
(
char
*
path
,
SStreamTask
*
pTask
,
bool
specPath
,
int32_t
szPage
,
int32_t
pages
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
95d81604
...
@@ -144,6 +144,7 @@ typedef struct {
...
@@ -144,6 +144,7 @@ typedef struct {
int64_t
fillHistoryVer2
;
int64_t
fillHistoryVer2
;
int64_t
dataVersion
;
int64_t
dataVersion
;
SStreamState
*
pState
;
SStreamState
*
pState
;
int64_t
checkPointId
;
}
SStreamTaskInfo
;
}
SStreamTaskInfo
;
typedef
struct
{
typedef
struct
{
...
...
source/libs/executor/src/executor.c
浏览文件 @
95d81604
...
@@ -176,6 +176,12 @@ int32_t qSetStreamOpOpen(qTaskInfo_t tinfo) {
...
@@ -176,6 +176,12 @@ int32_t qSetStreamOpOpen(qTaskInfo_t tinfo) {
return
code
;
return
code
;
}
}
void
qGetCheckpointVersion
(
qTaskInfo_t
tinfo
,
int64_t
*
dataVer
,
int64_t
*
ckId
)
{
SExecTaskInfo
*
pTaskInfo
=
tinfo
;
*
dataVer
=
pTaskInfo
->
streamInfo
.
dataVersion
;
*
ckId
=
pTaskInfo
->
streamInfo
.
checkPointId
;
}
int32_t
qSetMultiStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
pBlocks
,
size_t
numOfBlocks
,
int32_t
type
)
{
int32_t
qSetMultiStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
pBlocks
,
size_t
numOfBlocks
,
int32_t
type
)
{
if
(
tinfo
==
NULL
)
{
if
(
tinfo
==
NULL
)
{
return
TSDB_CODE_APP_ERROR
;
return
TSDB_CODE_APP_ERROR
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
95d81604
...
@@ -1742,6 +1742,26 @@ static void doCheckUpdate(SStreamScanInfo* pInfo, TSKEY endKey, SSDataBlock* pBl
...
@@ -1742,6 +1742,26 @@ static void doCheckUpdate(SStreamScanInfo* pInfo, TSKEY endKey, SSDataBlock* pBl
}
}
}
}
int32_t
streamScanOperatorEncode
(
SStreamScanInfo
*
pInfo
,
void
**
pBuff
)
{
int32_t
len
=
updateInfoSerialize
(
NULL
,
0
,
pInfo
->
pUpdateInfo
);
*
pBuff
=
taosMemoryCalloc
(
1
,
len
);
updateInfoSerialize
(
*
pBuff
,
len
,
pInfo
->
pUpdateInfo
);
return
len
;
}
// other properties are recovered from the execution plan
void
streamScanOperatorDeocde
(
void
*
pBuff
,
int32_t
len
,
SStreamScanInfo
*
pInfo
)
{
if
(
!
pBuff
)
{
return
;
}
SUpdateInfo
*
pUpInfo
=
updateInfoInit
(
0
,
TSDB_TIME_PRECISION_MILLI
,
0
);
int32_t
code
=
updateInfoDeserialize
(
pBuff
,
len
,
pUpInfo
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
pInfo
->
pUpdateInfo
=
pUpInfo
;
}
}
static
SSDataBlock
*
doStreamScan
(
SOperatorInfo
*
pOperator
)
{
static
SSDataBlock
*
doStreamScan
(
SOperatorInfo
*
pOperator
)
{
// NOTE: this operator does never check if current status is done or not
// NOTE: this operator does never check if current status is done or not
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
...
@@ -2000,6 +2020,10 @@ FETCH_NEXT_BLOCK:
...
@@ -2000,6 +2020,10 @@ FETCH_NEXT_BLOCK:
updateInfoDestoryColseWinSBF
(
pInfo
->
pUpdateInfo
);
updateInfoDestoryColseWinSBF
(
pInfo
->
pUpdateInfo
);
doClearBufferedBlocks
(
pInfo
);
doClearBufferedBlocks
(
pInfo
);
qDebug
(
"stream scan return empty, consume block %d"
,
totBlockNum
);
qDebug
(
"stream scan return empty, consume block %d"
,
totBlockNum
);
void
*
buff
=
NULL
;
int32_t
len
=
streamScanOperatorEncode
(
pInfo
,
&
buff
);
//todo(liuyao) save buff
taosMemoryFreeClear
(
buff
);
return
NULL
;
return
NULL
;
}
}
...
@@ -2419,6 +2443,11 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
...
@@ -2419,6 +2443,11 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pInfo
->
igExpired
=
pTableScanNode
->
igExpired
;
pInfo
->
igExpired
=
pTableScanNode
->
igExpired
;
pInfo
->
twAggSup
.
maxTs
=
INT64_MIN
;
pInfo
->
twAggSup
.
maxTs
=
INT64_MIN
;
//todo(liuyao) get buff from rocks db;
void
*
buff
=
NULL
;
int32_t
len
=
0
;
streamScanOperatorDeocde
(
buff
,
len
,
pInfo
);
setOperatorInfo
(
pOperator
,
"StreamScanOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
,
false
,
OP_NOT_OPENED
,
pInfo
,
setOperatorInfo
(
pOperator
,
"StreamScanOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pTaskInfo
);
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pRes
->
pDataBlock
);
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pRes
->
pDataBlock
);
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
95d81604
...
@@ -2409,8 +2409,9 @@ static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pN
...
@@ -2409,8 +2409,9 @@ static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pN
return
startPos
;
return
startPos
;
}
}
static
void
setStreamDataVersion
(
SExecTaskInfo
*
pTaskInfo
,
int64_t
version
)
{
static
void
setStreamDataVersion
(
SExecTaskInfo
*
pTaskInfo
,
int64_t
version
,
int64_t
ckId
)
{
pTaskInfo
->
streamInfo
.
dataVersion
=
version
;
pTaskInfo
->
streamInfo
.
dataVersion
=
version
;
pTaskInfo
->
streamInfo
.
checkPointId
=
ckId
;
}
}
static
void
doStreamIntervalAggImpl
(
SOperatorInfo
*
pOperatorInfo
,
SSDataBlock
*
pSDataBlock
,
uint64_t
groupId
,
static
void
doStreamIntervalAggImpl
(
SOperatorInfo
*
pOperatorInfo
,
SSDataBlock
*
pSDataBlock
,
uint64_t
groupId
,
...
@@ -2604,7 +2605,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
...
@@ -2604,7 +2605,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
clearFunctionContext
(
&
pOperator
->
exprSupp
);
clearFunctionContext
(
&
pOperator
->
exprSupp
);
// semi interval operator clear disk buffer
// semi interval operator clear disk buffer
clearStreamIntervalOperator
(
pInfo
);
clearStreamIntervalOperator
(
pInfo
);
setStreamDataVersion
(
pTaskInfo
,
pInfo
->
dataVersion
);
setStreamDataVersion
(
pTaskInfo
,
pInfo
->
dataVersion
,
pInfo
->
pState
->
checkPointId
);
qDebug
(
"===stream===clear semi operator"
);
qDebug
(
"===stream===clear semi operator"
);
}
else
{
}
else
{
deleteIntervalDiscBuf
(
pInfo
->
pState
,
pInfo
->
pPullDataMap
,
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
deleteMark
,
deleteIntervalDiscBuf
(
pInfo
->
pState
,
pInfo
->
pPullDataMap
,
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
deleteMark
,
...
@@ -4870,7 +4871,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
...
@@ -4870,7 +4871,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
setOperatorCompleted
(
pOperator
);
setOperatorCompleted
(
pOperator
);
if
(
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
checkPointInterval
>
pInfo
->
twAggSup
.
checkPointTs
)
{
if
(
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
checkPointInterval
>
pInfo
->
twAggSup
.
checkPointTs
)
{
streamStateCommit
(
pInfo
->
pState
);
streamStateCommit
(
pInfo
->
pState
);
setStreamDataVersion
(
pTaskInfo
,
pInfo
->
dataVersion
);
setStreamDataVersion
(
pTaskInfo
,
pInfo
->
dataVersion
,
pInfo
->
pState
->
checkPointId
);
pInfo
->
twAggSup
.
checkPointTs
=
pInfo
->
twAggSup
.
maxTs
;
pInfo
->
twAggSup
.
checkPointTs
=
pInfo
->
twAggSup
.
maxTs
;
}
}
return
NULL
;
return
NULL
;
...
...
source/libs/stream/src/streamState.c
浏览文件 @
95d81604
...
@@ -203,6 +203,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
...
@@ -203,6 +203,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
}
}
pState
->
pTdbState
->
pOwner
=
pTask
;
pState
->
pTdbState
->
pOwner
=
pTask
;
pState
->
checkPointId
=
0
;
return
pState
;
return
pState
;
...
@@ -266,6 +267,7 @@ int32_t streamStateCommit(SStreamState* pState) {
...
@@ -266,6 +267,7 @@ int32_t streamStateCommit(SStreamState* pState) {
TDB_TXN_WRITE
|
TDB_TXN_READ_UNCOMMITTED
)
<
0
)
{
TDB_TXN_WRITE
|
TDB_TXN_READ_UNCOMMITTED
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
pState
->
checkPointId
++
;
return
0
;
return
0
;
#endif
#endif
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录