fix(stream): add task status check.
This commit is contained in:
parent
29e1efb757
commit
d76e3ac718
|
@ -1644,6 +1644,19 @@ int32_t tqProcessStreamCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosThreadMutexLock(&pTask->lock);
|
||||||
|
if (pTask->status.taskStatus == TASK_STATUS__HALT) {
|
||||||
|
qError("s-task:%s not ready for checkpoint, since it is halt, ignore this checkpoint:%" PRId64
|
||||||
|
", set it failure", pTask->id.idStr, req.checkpointId);
|
||||||
|
streamMetaReleaseTask(pMeta, pTask);
|
||||||
|
|
||||||
|
SRpcMsg rsp = {0};
|
||||||
|
buildCheckpointSourceRsp(&req, &pMsg->info, &rsp, 0);
|
||||||
|
tmsgSendRsp(&rsp); // error occurs
|
||||||
|
}
|
||||||
|
streamProcessCheckpointSourceReq(pTask, &req);
|
||||||
|
taosThreadMutexUnlock(&pTask->lock);
|
||||||
|
|
||||||
int32_t total = 0;
|
int32_t total = 0;
|
||||||
taosWLockLatch(&pMeta->lock);
|
taosWLockLatch(&pMeta->lock);
|
||||||
|
|
||||||
|
@ -1666,7 +1679,6 @@ int32_t tqProcessStreamCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg) {
|
||||||
|
|
||||||
// todo: when generating checkpoint, no new tasks are allowed to add into current Vnode
|
// todo: when generating checkpoint, no new tasks are allowed to add into current Vnode
|
||||||
// todo: when generating checkpoint, leader of mnode has transfer to other DNode?
|
// todo: when generating checkpoint, leader of mnode has transfer to other DNode?
|
||||||
streamProcessCheckpointSourceReq(pTask, &req);
|
|
||||||
streamMetaReleaseTask(pMeta, pTask);
|
streamMetaReleaseTask(pMeta, pTask);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,8 +136,6 @@ int32_t streamProcessCheckpointSourceReq(SStreamTask* pTask, SStreamCheckpointSo
|
||||||
ASSERT(pTask->info.taskLevel == TASK_LEVEL__SOURCE);
|
ASSERT(pTask->info.taskLevel == TASK_LEVEL__SOURCE);
|
||||||
|
|
||||||
// 1. set task status to be prepared for check point, no data are allowed to put into inputQ.
|
// 1. set task status to be prepared for check point, no data are allowed to put into inputQ.
|
||||||
taosThreadMutexLock(&pTask->lock);
|
|
||||||
|
|
||||||
pTask->status.taskStatus = TASK_STATUS__CK;
|
pTask->status.taskStatus = TASK_STATUS__CK;
|
||||||
pTask->checkpointingId = pReq->checkpointId;
|
pTask->checkpointingId = pReq->checkpointId;
|
||||||
pTask->checkpointNotReadyTasks = streamTaskGetNumOfDownstream(pTask);
|
pTask->checkpointNotReadyTasks = streamTaskGetNumOfDownstream(pTask);
|
||||||
|
@ -146,8 +144,6 @@ int32_t streamProcessCheckpointSourceReq(SStreamTask* pTask, SStreamCheckpointSo
|
||||||
// 2. let's dispatch checkpoint msg to downstream task directly and do nothing else. put the checkpoint block into
|
// 2. let's dispatch checkpoint msg to downstream task directly and do nothing else. put the checkpoint block into
|
||||||
// inputQ, to make sure all blocks with less version have been handled by this task already.
|
// inputQ, to make sure all blocks with less version have been handled by this task already.
|
||||||
int32_t code = appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER);
|
int32_t code = appendCheckpointIntoInputQ(pTask, STREAM_INPUT__CHECKPOINT_TRIGGER);
|
||||||
taosThreadMutexUnlock(&pTask->lock);
|
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue