Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0dd93301
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,发现更多精彩内容 >>
提交
0dd93301
编写于
6月 05, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(stream): make history task for stream running.
上级
e8549ce5
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
120 addition
and
34 deletion
+120
-34
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+3
-3
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+1
-1
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+5
-4
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+8
-21
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+34
-0
source/libs/stream/inc/streamInc.h
source/libs/stream/inc/streamInc.h
+1
-1
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+2
-0
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+2
-1
source/libs/stream/src/streamRecover.c
source/libs/stream/src/streamRecover.c
+63
-3
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
0dd93301
...
@@ -552,10 +552,11 @@ bool streamTaskShouldPause(const SStreamStatus* pStatus);
...
@@ -552,10 +552,11 @@ bool streamTaskShouldPause(const SStreamStatus* pStatus);
int32_t
streamScanExec
(
SStreamTask
*
pTask
,
int32_t
batchSz
);
int32_t
streamScanExec
(
SStreamTask
*
pTask
,
int32_t
batchSz
);
// recover and fill history
// recover and fill history
int32_t
streamTaskCheckDownstream
(
SStreamTask
*
pTask
,
int64_t
version
);
int32_t
streamTaskCheckDownstream
Tasks
(
SStreamTask
*
pTask
);
int32_t
streamTaskLaunchRecover
(
SStreamTask
*
pTask
);
int32_t
streamTaskLaunchRecover
(
SStreamTask
*
pTask
);
int32_t
streamTaskCheckStatus
(
SStreamTask
*
pTask
);
int32_t
streamTaskCheckStatus
(
SStreamTask
*
pTask
);
int32_t
streamProcessTaskCheckRsp
(
SStreamTask
*
pTask
,
const
SStreamTaskCheckRsp
*
pRsp
,
int64_t
version
);
int32_t
streamProcessCheckRsp
(
SStreamTask
*
pTask
,
const
SStreamTaskCheckRsp
*
pRsp
);
int32_t
streamTaskStartHistoryTask
(
SStreamTask
*
pTask
,
int64_t
ver
);
// common
// common
int32_t
streamSetParamForRecover
(
SStreamTask
*
pTask
);
int32_t
streamSetParamForRecover
(
SStreamTask
*
pTask
);
...
@@ -570,7 +571,6 @@ int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver);
...
@@ -570,7 +571,6 @@ int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver);
int32_t
streamDispatchRecoverFinishReq
(
SStreamTask
*
pTask
);
int32_t
streamDispatchRecoverFinishReq
(
SStreamTask
*
pTask
);
// agg level
// agg level
int32_t
streamAggRecoverPrepare
(
SStreamTask
*
pTask
);
int32_t
streamAggRecoverPrepare
(
SStreamTask
*
pTask
);
// int32_t streamAggChildrenRecoverFinish(SStreamTask* pTask);
int32_t
streamProcessRecoverFinishReq
(
SStreamTask
*
pTask
,
int32_t
childId
);
int32_t
streamProcessRecoverFinishReq
(
SStreamTask
*
pTask
,
int32_t
childId
);
void
streamMetaInit
();
void
streamMetaInit
();
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
0dd93301
...
@@ -92,7 +92,7 @@ static void vmProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
...
@@ -92,7 +92,7 @@ static void vmProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
dGTrace
(
"vgId:%d, msg:%p get from vnode-stream queue"
,
pVnode
->
vgId
,
pMsg
);
dGTrace
(
"vgId:%d, msg:%p get from vnode-stream queue"
,
pVnode
->
vgId
,
pMsg
);
int32_t
code
=
vnodeProcess
Fetch
Msg
(
pVnode
->
pImpl
,
pMsg
,
pInfo
);
int32_t
code
=
vnodeProcess
Stream
Msg
(
pVnode
->
pImpl
,
pMsg
,
pInfo
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
if
(
terrno
!=
0
)
code
=
terrno
;
if
(
terrno
!=
0
)
code
=
terrno
;
dGError
(
"vgId:%d, msg:%p failed to process stream msg %s since %s"
,
pVnode
->
vgId
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
),
dGError
(
"vgId:%d, msg:%p failed to process stream msg %s since %s"
,
pVnode
->
vgId
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
),
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
0dd93301
...
@@ -238,10 +238,6 @@ int32_t mndAddSinkTaskToStream(SStreamObj* pStream, SArray* pTaskList, SMnode* p
...
@@ -238,10 +238,6 @@ int32_t mndAddSinkTaskToStream(SStreamObj* pStream, SArray* pTaskList, SMnode* p
return
0
;
return
0
;
}
}
static
int32_t
mndScheduleFillHistoryStreamTask
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
)
{
return
0
;
}
static
int32_t
addSourceStreamTask
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SArray
*
pTaskList
,
SArray
*
pSinkTaskList
,
static
int32_t
addSourceStreamTask
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SArray
*
pTaskList
,
SArray
*
pSinkTaskList
,
SStreamObj
*
pStream
,
SSubplan
*
plan
,
uint64_t
uid
,
int8_t
fillHistory
,
SStreamObj
*
pStream
,
SSubplan
*
plan
,
uint64_t
uid
,
int8_t
fillHistory
,
bool
hasExtraSink
)
{
bool
hasExtraSink
)
{
...
@@ -250,6 +246,11 @@ static int32_t addSourceStreamTask(SMnode* pMnode, SVgObj* pVgroup, SArray* pTas
...
@@ -250,6 +246,11 @@ static int32_t addSourceStreamTask(SMnode* pMnode, SVgObj* pVgroup, SArray* pTas
return
terrno
;
return
terrno
;
}
}
if
(
fillHistory
)
{
// todo set the correct ts, which should be last key of queried table.
pTask
->
dataRange
.
window
.
skey
=
INT64_MIN
;
pTask
->
dataRange
.
window
.
ekey
=
taosGetTimestampMs
();
}
// sink or dispatch
// sink or dispatch
if
(
hasExtraSink
)
{
if
(
hasExtraSink
)
{
mndAddDispatcherForInnerTask
(
pMnode
,
pStream
,
pSinkTaskList
,
pTask
);
mndAddDispatcherForInnerTask
(
pMnode
,
pStream
,
pSinkTaskList
,
pTask
);
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
0dd93301
...
@@ -95,6 +95,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
...
@@ -95,6 +95,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
int32_t
vnodeProcessSyncMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
);
int32_t
vnodeProcessSyncMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
);
int32_t
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int32_t
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int32_t
vnodeProcessFetchMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SQueueInfo
*
pInfo
);
int32_t
vnodeProcessFetchMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SQueueInfo
*
pInfo
);
int32_t
vnodeProcessStreamMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SQueueInfo
*
pInfo
);
void
vnodeProposeWriteMsg
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
);
void
vnodeProposeWriteMsg
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
);
void
vnodeApplyWriteMsg
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
);
void
vnodeApplyWriteMsg
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
);
void
vnodeProposeCommitOnNeed
(
SVnode
*
pVnode
,
bool
atExit
);
void
vnodeProposeCommitOnNeed
(
SVnode
*
pVnode
,
bool
atExit
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
0dd93301
...
@@ -979,7 +979,7 @@ int32_t tqProcessStreamTaskCheckRsp(STQ* pTq, int64_t sversion, char* msg, int32
...
@@ -979,7 +979,7 @@ int32_t tqProcessStreamTaskCheckRsp(STQ* pTq, int64_t sversion, char* msg, int32
return
-
1
;
return
-
1
;
}
}
code
=
streamProcess
TaskCheckRsp
(
pTask
,
&
rsp
,
sversion
);
code
=
streamProcess
CheckRsp
(
pTask
,
&
rsp
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
code
;
return
code
;
}
}
...
@@ -1032,25 +1032,7 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms
...
@@ -1032,25 +1032,7 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms
tqDebug
(
"s-task:%s fill history task, wait for being launched"
,
pTask
->
id
.
idStr
);
tqDebug
(
"s-task:%s fill history task, wait for being launched"
,
pTask
->
id
.
idStr
);
}
else
{
}
else
{
if
(
pTask
->
historyTaskId
.
taskId
!=
0
)
{
if
(
pTask
->
historyTaskId
.
taskId
!=
0
)
{
// todo fix the bug: 1. maybe failed to located the fill history task, since it is not built yet. 2. race condition
streamTaskStartHistoryTask
(
pTask
,
sversion
);
// an fill history task needs to be started.
// Set the execute conditions, including the query time window and the version range
SStreamTask
*
pHTask
=
taosHashGet
(
pStreamMeta
->
pTasks
,
&
pTask
->
historyTaskId
.
taskId
,
sizeof
(
pTask
->
historyTaskId
.
taskId
));
pHTask
->
dataRange
.
range
.
minVer
=
0
;
pHTask
->
dataRange
.
range
.
maxVer
=
sversion
;
pHTask
->
dataRange
.
window
.
skey
=
INT64_MIN
;
pHTask
->
dataRange
.
window
.
ekey
=
1000000
;
tqDebug
(
"s-task:%s set the launch condition for fill history task:%s, window:%"
PRId64
" - %"
PRId64
" verrange:%"
PRId64
" - %"
PRId64
,
pTask
->
id
.
idStr
,
pHTask
->
id
.
idStr
,
pHTask
->
dataRange
.
window
.
skey
,
pHTask
->
dataRange
.
window
.
ekey
,
pHTask
->
dataRange
.
range
.
minVer
,
pHTask
->
dataRange
.
range
.
maxVer
);
// check if downstream tasks have been ready
streamTaskCheckDownstream
(
pHTask
,
sversion
);
}
}
}
}
...
@@ -1091,8 +1073,11 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1091,8 +1073,11 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
}
}
double
el
=
(
taosGetTimestampMs
()
-
st
)
/
1000
.
0
;
double
el
=
(
taosGetTimestampMs
()
-
st
)
/
1000
.
0
;
tqDebug
(
"s-task:%s non-blocking recover stage(step 1) ended, elapsed time:%.2fs"
,
pTask
->
id
.
idStr
,
el
);
tqDebug
(
"s-task:%s history scan stage(step 1) ended, elapsed time:%.2fs"
,
pTask
->
id
.
idStr
,
el
);
// todo transfer the executor status, and then destroy this stream task
#if 0
// build msg to launch next step
// build msg to launch next step
SStreamRecoverStep2Req req;
SStreamRecoverStep2Req req;
code = streamBuildSourceRecover2Req(pTask, &req);
code = streamBuildSourceRecover2Req(pTask, &req);
...
@@ -1123,6 +1108,8 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -1123,6 +1108,8 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
SRpcMsg rpcMsg = {
SRpcMsg rpcMsg = {
.code = 0, .contLen = len, .msgType = TDMT_VND_STREAM_RECOVER_BLOCKING_STAGE, .pCont = serializedReq};
.code = 0, .contLen = len, .msgType = TDMT_VND_STREAM_RECOVER_BLOCKING_STAGE, .pCont = serializedReq};
tmsgPutToQueue(&pTq->pVnode->msgCb, WRITE_QUEUE, &rpcMsg);
tmsgPutToQueue(&pTq->pVnode->msgCb, WRITE_QUEUE, &rpcMsg);
#endif
return
0
;
return
0
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
0dd93301
...
@@ -588,6 +588,40 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
...
@@ -588,6 +588,40 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
}
}
}
}
int32_t
vnodeProcessStreamMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SQueueInfo
*
pInfo
)
{
vTrace
(
"vgId:%d, msg:%p in fetch queue is processing"
,
pVnode
->
config
.
vgId
,
pMsg
);
if
((
pMsg
->
msgType
==
TDMT_SCH_FETCH
||
pMsg
->
msgType
==
TDMT_VND_TABLE_META
||
pMsg
->
msgType
==
TDMT_VND_TABLE_CFG
||
pMsg
->
msgType
==
TDMT_VND_BATCH_META
)
&&
!
syncIsReadyForRead
(
pVnode
->
sync
))
{
vnodeRedirectRpcMsg
(
pVnode
,
pMsg
,
terrno
);
return
0
;
}
switch
(
pMsg
->
msgType
)
{
case
TDMT_STREAM_TASK_RUN
:
return
tqProcessTaskRunReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_TASK_DISPATCH
:
return
tqProcessTaskDispatchReq
(
pVnode
->
pTq
,
pMsg
,
true
);
case
TDMT_STREAM_TASK_CHECK
:
return
tqProcessStreamTaskCheckReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_TASK_DISPATCH_RSP
:
return
tqProcessTaskDispatchRsp
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_RETRIEVE
:
return
tqProcessTaskRetrieveReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_RETRIEVE_RSP
:
return
tqProcessTaskRetrieveRsp
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_VND_STREAM_RECOVER_NONBLOCKING_STAGE
:
return
tqProcessTaskRecover1Req
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_RECOVER_FINISH
:
return
tqProcessTaskRecoverFinishReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_RECOVER_FINISH_RSP
:
return
tqProcessTaskRecoverFinishRsp
(
pVnode
->
pTq
,
pMsg
);
default:
vError
(
"unknown msg type:%d in fetch queue"
,
pMsg
->
msgType
);
return
TSDB_CODE_APP_ERROR
;
}
}
// TODO: remove the function
// TODO: remove the function
void
smaHandleRes
(
void
*
pVnode
,
int64_t
smaId
,
const
SArray
*
data
)
{
void
smaHandleRes
(
void
*
pVnode
,
int64_t
smaId
,
const
SArray
*
data
)
{
// TODO
// TODO
...
...
source/libs/stream/inc/streamInc.h
浏览文件 @
0dd93301
...
@@ -31,7 +31,7 @@ typedef struct {
...
@@ -31,7 +31,7 @@ typedef struct {
void
*
timer
;
void
*
timer
;
}
SStreamGlobalEnv
;
}
SStreamGlobalEnv
;
static
SStreamGlobalEnv
streamEnv
;
extern
SStreamGlobalEnv
streamEnv
;
int32_t
streamDispatchStreamBlock
(
SStreamTask
*
pTask
);
int32_t
streamDispatchStreamBlock
(
SStreamTask
*
pTask
);
...
...
source/libs/stream/src/stream.c
浏览文件 @
0dd93301
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
#define ONE_MB_F (1048576.0)
#define ONE_MB_F (1048576.0)
#define QUEUE_MEM_SIZE_IN_MB(_q) (taosQueueMemorySize(_q) / ONE_MB_F)
#define QUEUE_MEM_SIZE_IN_MB(_q) (taosQueueMemorySize(_q) / ONE_MB_F)
SStreamGlobalEnv
streamEnv
;
int32_t
streamInit
()
{
int32_t
streamInit
()
{
int8_t
old
;
int8_t
old
;
while
(
1
)
{
while
(
1
)
{
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
0dd93301
...
@@ -387,9 +387,10 @@ int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver) {
...
@@ -387,9 +387,10 @@ int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver) {
}
}
// todo handle the fill history task
// todo handle the fill history task
ASSERT
(
0
);
if
(
pTask
->
fillHistory
)
{
if
(
pTask
->
fillHistory
)
{
ASSERT
(
pTask
->
status
.
taskStatus
==
TASK_STATUS__WAIT_DOWNSTREAM
);
ASSERT
(
pTask
->
status
.
taskStatus
==
TASK_STATUS__WAIT_DOWNSTREAM
);
streamTaskCheckDownstream
(
pTask
,
ver
);
streamTaskCheckDownstream
Tasks
(
pTask
);
}
}
}
}
...
...
source/libs/stream/src/streamRecover.c
浏览文件 @
0dd93301
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
*/
*/
#include "streamInc.h"
#include "streamInc.h"
#include "ttimer.h"
int32_t
streamTaskLaunchRecover
(
SStreamTask
*
pTask
)
{
int32_t
streamTaskLaunchRecover
(
SStreamTask
*
pTask
)
{
qDebug
(
"s-task:%s at node %d launch recover"
,
pTask
->
id
.
idStr
,
pTask
->
nodeId
);
qDebug
(
"s-task:%s at node %d launch recover"
,
pTask
->
id
.
idStr
,
pTask
->
nodeId
);
...
@@ -54,8 +55,9 @@ int32_t streamTaskLaunchRecover(SStreamTask* pTask) {
...
@@ -54,8 +55,9 @@ int32_t streamTaskLaunchRecover(SStreamTask* pTask) {
}
}
// check status
// check status
int32_t
streamTaskCheckDownstream
(
SStreamTask
*
pTask
,
int64_t
ver
)
{
int32_t
streamTaskCheckDownstreamTasks
(
SStreamTask
*
pTask
)
{
qDebug
(
"s-task:%s in fill history stage, ver:%"
PRId64
,
pTask
->
id
.
idStr
,
ver
);
qDebug
(
"s-task:%s in fill history stage, ver:%"
PRId64
" ekey:%"
PRId64
,
pTask
->
id
.
idStr
,
pTask
->
dataRange
.
range
.
maxVer
,
pTask
->
dataRange
.
window
.
ekey
);
SStreamTaskCheckReq
req
=
{
SStreamTaskCheckReq
req
=
{
.
streamId
=
pTask
->
id
.
streamId
,
.
streamId
=
pTask
->
id
.
streamId
,
...
@@ -135,7 +137,7 @@ int32_t streamTaskCheckStatus(SStreamTask* pTask) {
...
@@ -135,7 +137,7 @@ int32_t streamTaskCheckStatus(SStreamTask* pTask) {
return
atomic_load_8
(
&
pTask
->
status
.
taskStatus
)
==
TASK_STATUS__NORMAL
?
1
:
0
;
return
atomic_load_8
(
&
pTask
->
status
.
taskStatus
)
==
TASK_STATUS__NORMAL
?
1
:
0
;
}
}
int32_t
streamProcess
TaskCheckRsp
(
SStreamTask
*
pTask
,
const
SStreamTaskCheckRsp
*
pRsp
,
int64_t
ver
)
{
int32_t
streamProcess
CheckRsp
(
SStreamTask
*
pTask
,
const
SStreamTaskCheckRsp
*
pRsp
)
{
ASSERT
(
pTask
->
id
.
taskId
==
pRsp
->
upstreamTaskId
);
ASSERT
(
pTask
->
id
.
taskId
==
pRsp
->
upstreamTaskId
);
qDebug
(
"s-task:%s at node %d recv check rsp from task:0x%x at node %d: status %d"
,
pTask
->
id
.
idStr
,
qDebug
(
"s-task:%s at node %d recv check rsp from task:0x%x at node %d: status %d"
,
pTask
->
id
.
idStr
,
...
@@ -297,6 +299,64 @@ int32_t streamProcessRecoverFinishReq(SStreamTask* pTask, int32_t childId) {
...
@@ -297,6 +299,64 @@ int32_t streamProcessRecoverFinishReq(SStreamTask* pTask, int32_t childId) {
return
0
;
return
0
;
}
}
static
void
doCheckDownstreamStatus
(
SStreamTask
*
pTask
,
SStreamTask
*
pHTask
)
{
pHTask
->
dataRange
.
range
.
minVer
=
0
;
pHTask
->
dataRange
.
range
.
maxVer
=
pTask
->
chkInfo
.
currentVer
;
qDebug
(
"s-task:%s set the launch condition for fill history task:%s, window:%"
PRId64
" - %"
PRId64
" verrange:%"
PRId64
" - %"
PRId64
,
pTask
->
id
.
idStr
,
pHTask
->
id
.
idStr
,
pHTask
->
dataRange
.
window
.
skey
,
pHTask
->
dataRange
.
window
.
ekey
,
pHTask
->
dataRange
.
range
.
minVer
,
pHTask
->
dataRange
.
range
.
maxVer
);
// check if downstream tasks have been ready
streamTaskCheckDownstreamTasks
(
pHTask
);
}
static
void
tryLaunchHistoryTask
(
void
*
param
,
void
*
tmrId
)
{
SStreamTask
*
pTask
=
param
;
SStreamMeta
*
pMeta
=
pTask
->
pMeta
;
SStreamTask
**
pHTask
=
taosHashGet
(
pMeta
->
pTasks
,
&
pTask
->
historyTaskId
.
taskId
,
sizeof
(
pTask
->
historyTaskId
.
taskId
));
if
(
pHTask
==
NULL
)
{
qWarn
(
"s-task:%s vgId:%d failed to launch history task:0x%x, since it is not built yet"
,
pTask
->
id
.
idStr
,
pMeta
->
vgId
,
pTask
->
historyTaskId
.
taskId
);
taosTmrReset
(
tryLaunchHistoryTask
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
,
&
pTask
->
timer
);
return
;
}
doCheckDownstreamStatus
(
pTask
,
*
pHTask
);
}
// todo fix the bug: 2. race condition
// an fill history task needs to be started.
int32_t
streamTaskStartHistoryTask
(
SStreamTask
*
pTask
,
int64_t
ver
)
{
SStreamMeta
*
pMeta
=
pTask
->
pMeta
;
if
(
pTask
->
historyTaskId
.
taskId
==
0
)
{
return
TSDB_CODE_SUCCESS
;
}
// Set the execute conditions, including the query time window and the version range
SStreamTask
**
pHTask
=
taosHashGet
(
pMeta
->
pTasks
,
&
pTask
->
historyTaskId
.
taskId
,
sizeof
(
pTask
->
historyTaskId
.
taskId
));
if
(
pHTask
==
NULL
)
{
qWarn
(
"s-task:%s vgId:%d failed to launch history task:0x%x, since it is not built yet"
,
pTask
->
id
.
idStr
,
pMeta
->
vgId
,
pTask
->
historyTaskId
.
taskId
);
if
(
pTask
->
timer
==
NULL
)
{
pTask
->
timer
=
taosTmrStart
(
tryLaunchHistoryTask
,
100
,
pTask
,
streamEnv
.
timer
);
if
(
pTask
->
timer
==
NULL
)
{
// todo failed to create timer
}
}
// try again in 500ms
return
TSDB_CODE_SUCCESS
;
}
doCheckDownstreamStatus
(
pTask
,
*
pHTask
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
tEncodeSStreamTaskCheckReq
(
SEncoder
*
pEncoder
,
const
SStreamTaskCheckReq
*
pReq
)
{
int32_t
tEncodeSStreamTaskCheckReq
(
SEncoder
*
pEncoder
,
const
SStreamTaskCheckReq
*
pReq
)
{
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pReq
->
reqId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pReq
->
reqId
)
<
0
)
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录