Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7c6fbd77
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看板
提交
7c6fbd77
编写于
6月 14, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(stream): do some internal refactor and support secondary scan for history data.
上级
11f0c3b3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
101 addition
and
68 deletion
+101
-68
include/libs/executor/executor.h
include/libs/executor/executor.h
+3
-3
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+4
-4
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+33
-11
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+49
-37
source/libs/stream/src/streamRecover.c
source/libs/stream/src/streamRecover.c
+12
-13
未找到文件。
include/libs/executor/executor.h
浏览文件 @
7c6fbd77
...
@@ -220,11 +220,11 @@ void* qExtractReaderFromStreamScanner(void* scanner);
...
@@ -220,11 +220,11 @@ void* qExtractReaderFromStreamScanner(void* scanner);
int32_t
qExtractStreamScanner
(
qTaskInfo_t
tinfo
,
void
**
scanner
);
int32_t
qExtractStreamScanner
(
qTaskInfo_t
tinfo
,
void
**
scanner
);
int32_t
qS
treamSetParamForRecover
(
qTaskInfo_t
tinfo
);
int32_t
qS
etStreamOperatorOptionForScanHistory
(
qTaskInfo_t
tinfo
);
int32_t
qStreamSource
RecoverStep1
(
qTaskInfo_t
tinfo
,
SVersionRange
*
pVerRange
,
STimeWindow
*
pWindow
);
int32_t
qStreamSource
ScanParamForHistoryScan
(
qTaskInfo_t
tinfo
,
SVersionRange
*
pVerRange
,
STimeWindow
*
pWindow
);
int32_t
qStreamSourceRecoverStep2
(
qTaskInfo_t
tinfo
,
int64_t
ver
);
int32_t
qStreamSourceRecoverStep2
(
qTaskInfo_t
tinfo
,
int64_t
ver
);
int32_t
qStreamRecoverFinish
(
qTaskInfo_t
tinfo
);
int32_t
qStreamRecoverFinish
(
qTaskInfo_t
tinfo
);
int32_t
q
StreamRestoreParam
(
qTaskInfo_t
tinfo
);
int32_t
q
RestoreStreamOperatorOption
(
qTaskInfo_t
tinfo
);
bool
qStreamRecoverScanFinished
(
qTaskInfo_t
tinfo
);
bool
qStreamRecoverScanFinished
(
qTaskInfo_t
tinfo
);
void
qStreamCloseTsdbReader
(
void
*
task
);
void
qStreamCloseTsdbReader
(
void
*
task
);
void
resetTaskInfo
(
qTaskInfo_t
tinfo
);
void
resetTaskInfo
(
qTaskInfo_t
tinfo
);
...
...
include/libs/stream/tstream.h
浏览文件 @
7c6fbd77
...
@@ -451,7 +451,7 @@ typedef struct {
...
@@ -451,7 +451,7 @@ typedef struct {
SMsgHead
msgHead
;
SMsgHead
msgHead
;
int64_t
streamId
;
int64_t
streamId
;
int32_t
taskId
;
int32_t
taskId
;
}
SStream
RecoverStep1
Req
,
SStreamRecoverStep2Req
;
}
SStream
ScanHistory
Req
,
SStreamRecoverStep2Req
;
typedef
struct
{
typedef
struct
{
int64_t
streamId
;
int64_t
streamId
;
...
@@ -582,9 +582,9 @@ int32_t streamSetStatusNormal(SStreamTask* pTask);
...
@@ -582,9 +582,9 @@ int32_t streamSetStatusNormal(SStreamTask* pTask);
const
char
*
streamGetTaskStatusStr
(
int32_t
status
);
const
char
*
streamGetTaskStatusStr
(
int32_t
status
);
// source level
// source level
int32_t
streamS
ourceRecoverPrepareStep1
(
SStreamTask
*
pTask
,
SVersionRange
*
pVerRange
,
STimeWindow
*
pWindow
);
int32_t
streamS
etParamForStreamScanner
(
SStreamTask
*
pTask
,
SVersionRange
*
pVerRange
,
STimeWindow
*
pWindow
);
int32_t
streamBuildSourceRecover1Req
(
SStreamTask
*
pTask
,
SStream
RecoverStep1
Req
*
pReq
);
int32_t
streamBuildSourceRecover1Req
(
SStreamTask
*
pTask
,
SStream
ScanHistory
Req
*
pReq
);
int32_t
streamSource
RecoverScanStep1
(
SStreamTask
*
pTask
);
int32_t
streamSource
ScanHistoryData
(
SStreamTask
*
pTask
);
//int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver);
//int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver);
int32_t
streamDispatchScanHistoryFinishMsg
(
SStreamTask
*
pTask
);
int32_t
streamDispatchScanHistoryFinishMsg
(
SStreamTask
*
pTask
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
7c6fbd77
...
@@ -1066,10 +1066,9 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms
...
@@ -1066,10 +1066,9 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms
int32_t
tqProcessTaskScanHistory
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
int32_t
tqProcessTaskScanHistory
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
char
*
msg
=
pMsg
->
pCont
;
char
*
msg
=
pMsg
->
pCont
;
int32_t
msgLen
=
pMsg
->
contLen
;
SStreamMeta
*
pMeta
=
pTq
->
pStreamMeta
;
SStreamMeta
*
pMeta
=
pTq
->
pStreamMeta
;
SStream
RecoverStep1Req
*
pReq
=
(
SStreamRecoverStep1
Req
*
)
msg
;
SStream
ScanHistoryReq
*
pReq
=
(
SStreamScanHistory
Req
*
)
msg
;
SStreamTask
*
pTask
=
streamMetaAcquireTask
(
pMeta
,
pReq
->
taskId
);
SStreamTask
*
pTask
=
streamMetaAcquireTask
(
pMeta
,
pReq
->
taskId
);
if
(
pTask
==
NULL
)
{
if
(
pTask
==
NULL
)
{
...
@@ -1089,16 +1088,14 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1089,16 +1088,14 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
tqDebug
(
"s-task:%s start history data scan stage(step 1), status:%s"
,
pTask
->
id
.
idStr
,
streamGetTaskStatusStr
(
pTask
->
status
.
taskStatus
));
tqDebug
(
"s-task:%s start history data scan stage(step 1), status:%s"
,
pTask
->
id
.
idStr
,
streamGetTaskStatusStr
(
pTask
->
status
.
taskStatus
));
int64_t
st
=
taosGetTimestampMs
();
int64_t
st
=
taosGetTimestampMs
();
int8_t
schedStatus
=
atomic_val_compare_exchange_8
(
&
pTask
->
status
.
schedStatus
,
TASK_SCHED_STATUS__INACTIVE
,
// todo set the correct status flag
TASK_SCHED_STATUS__WAITING
);
int8_t
schedStatus
=
atomic_val_compare_exchange_8
(
&
pTask
->
status
.
schedStatus
,
TASK_SCHED_STATUS__INACTIVE
,
TASK_SCHED_STATUS__WAITING
);
if
(
schedStatus
!=
TASK_SCHED_STATUS__INACTIVE
)
{
if
(
schedStatus
!=
TASK_SCHED_STATUS__INACTIVE
)
{
ASSERT
(
0
);
ASSERT
(
0
);
return
0
;
return
0
;
}
}
streamSource
RecoverScanStep1
(
pTask
);
streamSource
ScanHistoryData
(
pTask
);
if
(
atomic_load_8
(
&
pTask
->
status
.
taskStatus
)
==
TASK_STATUS__DROPPING
)
{
if
(
atomic_load_8
(
&
pTask
->
status
.
taskStatus
)
==
TASK_STATUS__DROPPING
)
{
tqDebug
(
"s-task:%s is dropped, abort recover in step1"
,
pTask
->
id
.
idStr
);
tqDebug
(
"s-task:%s is dropped, abort recover in step1"
,
pTask
->
id
.
idStr
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
...
@@ -1124,21 +1121,47 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1124,21 +1121,47 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
taosMsleep
(
100
);
taosMsleep
(
100
);
}
}
taosMsleep
(
10000
);
// now we can stop the stream task execution
pStreamTask
->
status
.
taskStatus
=
TASK_STATUS__HALT
;
pStreamTask
->
status
.
taskStatus
=
TASK_STATUS__HALT
;
tqDebug
(
"s-task:%s level:%d status is set to halt by history scan task:%s"
,
pStreamTask
->
id
.
idStr
,
tqDebug
(
"s-task:%s level:%d status is set to halt by history scan task:%s"
,
pStreamTask
->
id
.
idStr
,
pStreamTask
->
info
.
taskLevel
,
pTask
->
id
.
idStr
);
pStreamTask
->
info
.
taskLevel
,
pTask
->
id
.
idStr
);
// if it's an source task, extract the last version in wal.
// if it's an source task, extract the last version in wal.
int64_t
ver
=
pTask
->
dataRange
.
range
.
maxVer
;
int64_t
ver
=
pTask
->
dataRange
.
range
.
maxVer
+
1
;
int64_t
latestVer
=
walReaderGetCurrentVer
(
pStreamTask
->
exec
.
pWalReader
);
int64_t
latestVer
=
walReaderGetCurrentVer
(
pStreamTask
->
exec
.
pWalReader
);
if
(
latestVer
>=
ver
)
{
if
(
latestVer
>=
ver
)
{
ver
=
latestVer
;
ver
=
latestVer
;
}
else
{
ASSERT
(
latestVer
==
-
1
);
}
}
// 2. do secondary scan of the history data, the time window remain, and the version range is updated to [pTask->dataRange.range.maxVer, ver1]
// 2. do secondary scan of the history data, the time window remain, and the version range is updated to [pTask->dataRange.range.maxVer, ver1]
SVersionRange
*
pRange
=
&
pTask
->
dataRange
.
range
;
pRange
->
minVer
=
pRange
->
maxVer
+
1
;
pRange
->
maxVer
=
ver
;
if
(
pRange
->
minVer
==
pRange
->
maxVer
)
{
tqDebug
(
"s-task:%s no need to perform secondary scan-history-data(step 2), since no new data ingest"
,
pTask
->
id
.
idStr
);
}
else
{
tqDebug
(
"s-task:%s level:%d verRange:%"
PRId64
" - %"
PRId64
" do secondary scan-history-data after halt the related stream task:%s"
,
pTask
->
id
.
idStr
,
pTask
->
info
.
taskLevel
,
pRange
->
minVer
,
pRange
->
maxVer
,
pStreamTask
->
id
.
idStr
);
ASSERT
(
pTask
->
status
.
schedStatus
==
TASK_SCHED_STATUS__WAITING
);
st
=
taosGetTimestampMs
();
streamSetParamForStreamScanner
(
pTask
,
pRange
,
&
pTask
->
dataRange
.
window
);
streamSourceScanHistoryData
(
pTask
);
if
(
atomic_load_8
(
&
pTask
->
status
.
taskStatus
)
==
TASK_STATUS__DROPPING
)
{
tqDebug
(
"s-task:%s is dropped, abort recover in step1"
,
pTask
->
id
.
idStr
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
return
0
;
}
el
=
(
taosGetTimestampMs
()
-
st
)
/
1000
.
0
;
tqDebug
(
"s-task:%s history data scan stage(step 2) ended, elapsed time:%.2fs"
,
pTask
->
id
.
idStr
,
el
);
}
// 3. notify the downstream tasks to transfer executor state after handle all history blocks.
// 3. notify the downstream tasks to transfer executor state after handle all history blocks.
pTask
->
status
.
transferState
=
true
;
pTask
->
status
.
transferState
=
true
;
...
@@ -1177,7 +1200,6 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1177,7 +1200,6 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
}
}
return
0
;
return
0
;
}
}
// notify the downstream tasks to transfer executor state after handle all history blocks.
// notify the downstream tasks to transfer executor state after handle all history blocks.
...
...
source/libs/executor/src/executor.c
浏览文件 @
7c6fbd77
...
@@ -92,6 +92,7 @@ static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) {
...
@@ -92,6 +92,7 @@ static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) {
qError
(
"join not supported for stream block scan, %s"
PRIx64
,
id
);
qError
(
"join not supported for stream block scan, %s"
PRIx64
,
id
);
return
TSDB_CODE_APP_ERROR
;
return
TSDB_CODE_APP_ERROR
;
}
}
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
return
doSetStreamOpOpen
(
pOperator
->
pDownstream
[
0
],
id
);
return
doSetStreamOpOpen
(
pOperator
->
pDownstream
[
0
],
id
);
}
}
...
@@ -869,12 +870,20 @@ int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner) {
...
@@ -869,12 +870,20 @@ int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner) {
}
}
}
}
int32_t
qStreamSource
RecoverStep1
(
qTaskInfo_t
tinfo
,
SVersionRange
*
pVerRange
,
STimeWindow
*
pWindow
)
{
int32_t
qStreamSource
ScanParamForHistoryScan
(
qTaskInfo_t
tinfo
,
SVersionRange
*
pVerRange
,
STimeWindow
*
pWindow
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
ASSERT
(
pTaskInfo
->
execModel
==
OPTR_EXEC_MODEL_STREAM
);
ASSERT
(
pTaskInfo
->
execModel
==
OPTR_EXEC_MODEL_STREAM
);
pTaskInfo
->
streamInfo
.
fillHistoryVer
=
*
pVerRange
;
pTaskInfo
->
streamInfo
.
fillHistoryWindow
=
*
pWindow
;
SStreamTaskInfo
*
pStreamInfo
=
&
pTaskInfo
->
streamInfo
;
pTaskInfo
->
streamInfo
.
recoverStep
=
STREAM_RECOVER_STEP__PREPARE1
;
pStreamInfo
->
fillHistoryVer
=
*
pVerRange
;
pStreamInfo
->
fillHistoryWindow
=
*
pWindow
;
pStreamInfo
->
recoverStep
=
STREAM_RECOVER_STEP__PREPARE1
;
qDebug
(
"%s set param for stream scanner for scan history data, Ver:%"
PRId64
" - %"
PRId64
", window:%"
PRId64
" - %"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pStreamInfo
->
fillHistoryVer
.
minVer
,
pStreamInfo
->
fillHistoryVer
.
maxVer
,
pWindow
->
skey
,
pWindow
->
ekey
);
return
0
;
return
0
;
}
}
...
@@ -893,55 +902,58 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo) {
...
@@ -893,55 +902,58 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo) {
return
0
;
return
0
;
}
}
int32_t
qS
treamSetParamForRecover
(
qTaskInfo_t
tinfo
)
{
int32_t
qS
etStreamOperatorOptionForScanHistory
(
qTaskInfo_t
tinfo
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
SOperatorInfo
*
pOperator
=
pTaskInfo
->
pRoot
;
SOperatorInfo
*
pOperator
=
pTaskInfo
->
pRoot
;
while
(
1
)
{
while
(
1
)
{
i
f
(
pOperator
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
||
i
nt32_t
type
=
pOperator
->
operatorType
;
pOperator
->
operatorT
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
||
if
(
type
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
||
t
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
||
pOperator
->
operatorT
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
)
{
t
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
)
{
SStreamIntervalOperatorInfo
*
pInfo
=
pOperator
->
info
;
SStreamIntervalOperatorInfo
*
pInfo
=
pOperator
->
info
;
ASSERT
(
pInfo
->
twAggSup
.
calTrigger
==
STREAM_TRIGGER_AT_ONCE
||
STimeWindowAggSupp
*
pSup
=
&
pInfo
->
twAggSup
;
pInfo
->
twAggSup
.
calTrigger
==
STREAM_TRIGGER_WINDOW_CLOSE
);
ASSERT
(
pInfo
->
twAggSup
.
calTriggerSaved
==
0
&&
pInfo
->
twAggSup
.
deleteMarkSaved
==
0
);
qInfo
(
"save stream param for interval: %d, %"
PRId64
,
pInfo
->
twAggSup
.
calTrigger
,
pInfo
->
twAggSup
.
deleteMark
);
ASSERT
(
pSup
->
calTrigger
==
STREAM_TRIGGER_AT_ONCE
||
pSup
->
calTrigger
==
STREAM_TRIGGER_WINDOW_CLOSE
);
ASSERT
(
pSup
->
calTriggerSaved
==
0
&&
pSup
->
deleteMarkSaved
==
0
);
pInfo
->
twAggSup
.
calTriggerSaved
=
pInfo
->
twAggSup
.
calTrigger
;
qInfo
(
"save stream param for interval: %d, %"
PRId64
,
pSup
->
calTrigger
,
pSup
->
deleteMark
);
pInfo
->
twAggSup
.
deleteMarkSaved
=
pInfo
->
twAggSup
.
deleteMark
;
pInfo
->
twAggSup
.
calTrigger
=
STREAM_TRIGGER_AT_ONCE
;
pSup
->
calTriggerSaved
=
pSup
->
calTrigger
;
pInfo
->
twAggSup
.
deleteMark
=
INT64_MAX
;
pSup
->
deleteMarkSaved
=
pSup
->
deleteMark
;
pSup
->
calTrigger
=
STREAM_TRIGGER_AT_ONCE
;
pSup
->
deleteMark
=
INT64_MAX
;
pInfo
->
ignoreExpiredDataSaved
=
pInfo
->
ignoreExpiredData
;
pInfo
->
ignoreExpiredDataSaved
=
pInfo
->
ignoreExpiredData
;
pInfo
->
ignoreExpiredData
=
false
;
pInfo
->
ignoreExpiredData
=
false
;
}
else
if
(
pOperator
->
operatorT
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION
||
}
else
if
(
t
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION
||
pOperator
->
operatorT
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION
||
t
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION
||
pOperator
->
operatorT
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION
)
{
t
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION
)
{
SStreamSessionAggOperatorInfo
*
pInfo
=
pOperator
->
info
;
SStreamSessionAggOperatorInfo
*
pInfo
=
pOperator
->
info
;
ASSERT
(
pInfo
->
twAggSup
.
calTrigger
==
STREAM_TRIGGER_AT_ONCE
||
STimeWindowAggSupp
*
pSup
=
&
pInfo
->
twAggSup
;
pInfo
->
twAggSup
.
calTrigger
==
STREAM_TRIGGER_WINDOW_CLOSE
);
ASSERT
(
p
Info
->
twAggSup
.
calTriggerSaved
==
0
&&
pInfo
->
twAggSup
.
deleteMarkSaved
==
0
);
ASSERT
(
p
Sup
->
calTrigger
==
STREAM_TRIGGER_AT_ONCE
||
pSup
->
calTrigger
==
STREAM_TRIGGER_WINDOW_CLOSE
);
qInfo
(
"save stream param for session: %d, %"
PRId64
,
pInfo
->
twAggSup
.
calTrigger
,
pInfo
->
twAggSup
.
deleteMark
);
ASSERT
(
pSup
->
calTriggerSaved
==
0
&&
pSup
->
deleteMarkSaved
==
0
);
pInfo
->
twAggSup
.
calTriggerSaved
=
pInfo
->
twAggSup
.
calTrigger
;
qInfo
(
"save stream param for session: %d, %"
PRId64
,
pSup
->
calTrigger
,
pSup
->
deleteMark
);
pInfo
->
twAggSup
.
deleteMarkSaved
=
pInfo
->
twAggSup
.
deleteMark
;
pInfo
->
twAggSup
.
calTrigger
=
STREAM_TRIGGER_AT_ONCE
;
pSup
->
calTriggerSaved
=
pSup
->
calTrigger
;
pInfo
->
twAggSup
.
deleteMark
=
INT64_MAX
;
pSup
->
deleteMarkSaved
=
pSup
->
deleteMark
;
pSup
->
calTrigger
=
STREAM_TRIGGER_AT_ONCE
;
pSup
->
deleteMark
=
INT64_MAX
;
pInfo
->
ignoreExpiredDataSaved
=
pInfo
->
ignoreExpiredData
;
pInfo
->
ignoreExpiredDataSaved
=
pInfo
->
ignoreExpiredData
;
pInfo
->
ignoreExpiredData
=
false
;
pInfo
->
ignoreExpiredData
=
false
;
}
else
if
(
pOperator
->
operatorT
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE
)
{
}
else
if
(
t
ype
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE
)
{
SStreamStateAggOperatorInfo
*
pInfo
=
pOperator
->
info
;
SStreamStateAggOperatorInfo
*
pInfo
=
pOperator
->
info
;
ASSERT
(
pInfo
->
twAggSup
.
calTrigger
==
STREAM_TRIGGER_AT_ONCE
||
STimeWindowAggSupp
*
pSup
=
&
pInfo
->
twAggSup
;
pInfo
->
twAggSup
.
calTrigger
==
STREAM_TRIGGER_WINDOW_CLOSE
);
ASSERT
(
pInfo
->
twAggSup
.
calTriggerSaved
==
0
&&
pInfo
->
twAggSup
.
deleteMarkSaved
==
0
);
ASSERT
(
pSup
->
calTrigger
==
STREAM_TRIGGER_AT_ONCE
||
pSup
->
calTrigger
==
STREAM_TRIGGER_WINDOW_CLOSE
);
ASSERT
(
pSup
->
calTriggerSaved
==
0
&&
pSup
->
deleteMarkSaved
==
0
);
qInfo
(
"save stream param for state: %d, %"
PRId64
,
p
Info
->
twAggSup
.
calTrigger
,
pInfo
->
twAggSup
.
deleteMark
);
qInfo
(
"save stream param for state: %d, %"
PRId64
,
p
Sup
->
calTrigger
,
pSup
->
deleteMark
);
p
Info
->
twAggSup
.
calTriggerSaved
=
pInfo
->
twAggSup
.
calTrigger
;
p
Sup
->
calTriggerSaved
=
pSup
->
calTrigger
;
p
Info
->
twAggSup
.
deleteMarkSaved
=
pInfo
->
twAggSup
.
deleteMark
;
p
Sup
->
deleteMarkSaved
=
pSup
->
deleteMark
;
p
Info
->
twAggSup
.
calTrigger
=
STREAM_TRIGGER_AT_ONCE
;
p
Sup
->
calTrigger
=
STREAM_TRIGGER_AT_ONCE
;
p
Info
->
twAggSup
.
deleteMark
=
INT64_MAX
;
p
Sup
->
deleteMark
=
INT64_MAX
;
pInfo
->
ignoreExpiredDataSaved
=
pInfo
->
ignoreExpiredData
;
pInfo
->
ignoreExpiredDataSaved
=
pInfo
->
ignoreExpiredData
;
pInfo
->
ignoreExpiredData
=
false
;
pInfo
->
ignoreExpiredData
=
false
;
}
}
...
@@ -962,7 +974,7 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) {
...
@@ -962,7 +974,7 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) {
return
0
;
return
0
;
}
}
int32_t
q
StreamRestoreParam
(
qTaskInfo_t
tinfo
)
{
int32_t
q
RestoreStreamOperatorOption
(
qTaskInfo_t
tinfo
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
SOperatorInfo
*
pOperator
=
pTaskInfo
->
pRoot
;
SOperatorInfo
*
pOperator
=
pTaskInfo
->
pRoot
;
...
...
source/libs/stream/src/streamRecover.c
浏览文件 @
7c6fbd77
...
@@ -36,11 +36,11 @@ static int32_t doLaunchScanHistoryTask(SStreamTask* pTask) {
...
@@ -36,11 +36,11 @@ static int32_t doLaunchScanHistoryTask(SStreamTask* pTask) {
pRange
->
minVer
,
pRange
->
maxVer
);
pRange
->
minVer
,
pRange
->
maxVer
);
streamSetParamForScanHistoryData
(
pTask
);
streamSetParamForScanHistoryData
(
pTask
);
streamS
ourceRecoverPrepareStep1
(
pTask
,
pRange
,
&
pTask
->
dataRange
.
window
);
streamS
etParamForStreamScanner
(
pTask
,
pRange
,
&
pTask
->
dataRange
.
window
);
SStream
RecoverStep1
Req
req
;
SStream
ScanHistory
Req
req
;
streamBuildSourceRecover1Req
(
pTask
,
&
req
);
streamBuildSourceRecover1Req
(
pTask
,
&
req
);
int32_t
len
=
sizeof
(
SStream
RecoverStep1
Req
);
int32_t
len
=
sizeof
(
SStream
ScanHistory
Req
);
void
*
serializedReq
=
rpcMallocCont
(
len
);
void
*
serializedReq
=
rpcMallocCont
(
len
);
if
(
serializedReq
==
NULL
)
{
if
(
serializedReq
==
NULL
)
{
...
@@ -242,13 +242,13 @@ int32_t streamProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRs
...
@@ -242,13 +242,13 @@ int32_t streamProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRs
// common
// common
int32_t
streamSetParamForScanHistoryData
(
SStreamTask
*
pTask
)
{
int32_t
streamSetParamForScanHistoryData
(
SStreamTask
*
pTask
)
{
void
*
exec
=
pTask
->
exec
.
pExecutor
;
qDebug
(
"s-task:%s set operator option for scan-history-data"
,
pTask
->
id
.
idStr
)
;
return
qS
treamSetParamForRecover
(
exec
);
return
qS
etStreamOperatorOptionForScanHistory
(
pTask
->
exec
.
pExecutor
);
}
}
int32_t
streamRestoreParam
(
SStreamTask
*
pTask
)
{
int32_t
streamRestoreParam
(
SStreamTask
*
pTask
)
{
void
*
exec
=
pTask
->
exec
.
pExecutor
;
qDebug
(
"s-task:%s restore operator param after scan-history-data"
,
pTask
->
id
.
idStr
)
;
return
q
StreamRestoreParam
(
exec
);
return
q
RestoreStreamOperatorOption
(
pTask
->
exec
.
pExecutor
);
}
}
int32_t
streamSetStatusNormal
(
SStreamTask
*
pTask
)
{
int32_t
streamSetStatusNormal
(
SStreamTask
*
pTask
)
{
...
@@ -258,19 +258,18 @@ int32_t streamSetStatusNormal(SStreamTask* pTask) {
...
@@ -258,19 +258,18 @@ int32_t streamSetStatusNormal(SStreamTask* pTask) {
}
}
// source
// source
int32_t
streamSourceRecoverPrepareStep1
(
SStreamTask
*
pTask
,
SVersionRange
*
pVerRange
,
STimeWindow
*
pWindow
)
{
int32_t
streamSetParamForStreamScanner
(
SStreamTask
*
pTask
,
SVersionRange
*
pVerRange
,
STimeWindow
*
pWindow
)
{
void
*
exec
=
pTask
->
exec
.
pExecutor
;
return
qStreamSourceScanParamForHistoryScan
(
pTask
->
exec
.
pExecutor
,
pVerRange
,
pWindow
);
return
qStreamSourceRecoverStep1
(
exec
,
pVerRange
,
pWindow
);
}
}
int32_t
streamBuildSourceRecover1Req
(
SStreamTask
*
pTask
,
SStream
RecoverStep1
Req
*
pReq
)
{
int32_t
streamBuildSourceRecover1Req
(
SStreamTask
*
pTask
,
SStream
ScanHistory
Req
*
pReq
)
{
pReq
->
msgHead
.
vgId
=
pTask
->
info
.
nodeId
;
pReq
->
msgHead
.
vgId
=
pTask
->
info
.
nodeId
;
pReq
->
streamId
=
pTask
->
id
.
streamId
;
pReq
->
streamId
=
pTask
->
id
.
streamId
;
pReq
->
taskId
=
pTask
->
id
.
taskId
;
pReq
->
taskId
=
pTask
->
id
.
taskId
;
return
0
;
return
0
;
}
}
int32_t
streamSource
RecoverScanStep1
(
SStreamTask
*
pTask
)
{
int32_t
streamSource
ScanHistoryData
(
SStreamTask
*
pTask
)
{
return
streamScanExec
(
pTask
,
100
);
return
streamScanExec
(
pTask
,
100
);
}
}
...
@@ -393,7 +392,7 @@ int32_t streamAggRecoverPrepare(SStreamTask* pTask) {
...
@@ -393,7 +392,7 @@ int32_t streamAggRecoverPrepare(SStreamTask* pTask) {
int32_t
streamAggChildrenRecoverFinish
(
SStreamTask
*
pTask
)
{
int32_t
streamAggChildrenRecoverFinish
(
SStreamTask
*
pTask
)
{
void
*
exec
=
pTask
->
exec
.
pExecutor
;
void
*
exec
=
pTask
->
exec
.
pExecutor
;
if
(
q
StreamRestoreParam
(
exec
)
<
0
)
{
if
(
q
RestoreStreamOperatorOption
(
exec
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
if
(
qStreamRecoverFinish
(
exec
)
<
0
)
{
if
(
qStreamRecoverFinish
(
exec
)
<
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录