提交 8298f30e 编写于 作者: H Haojun Liao

fix(stream): fix bug in checkpoint.

上级 47877898
......@@ -368,7 +368,7 @@ typedef struct SStreamMeta {
TdThreadMutex backendMutex;
// uint64_t checkpointId;
int32_t notCkptReadyTasks;
int32_t chkptNotReadyTasks;
SArray* checkpointSaved;
SArray* checkpointInUse;
int32_t checkpointCap;
......
......@@ -1523,6 +1523,12 @@ int32_t tqProcessStreamCheckPointSourceReq(STQ* pTq, int64_t sversion, char* pMs
memcpy(pRpcMsg, (SRpcMsg*)pMsg, sizeof(SRpcMsg));
taosArrayPush(pTask->pRpcMsgList, &pRpcMsg);
// todo: when generating checkpoint, no new tasks are allowed to add into current Vnode
// set the initial value for generating check point
taosWLockLatch(&pMeta->lock);
pMeta->chkptNotReadyTasks = taosArrayGetSize(pMeta->pTaskList);
taosWUnLockLatch(&pMeta->lock);
streamProcessCheckpointSourceReq(pMeta, pTask, &req);
streamMetaReleaseTask(pMeta, pTask);
return code;
......
......@@ -536,8 +536,10 @@ int32_t streamTryExec(SStreamTask* pTask) {
// check for all tasks, and do generate the vnode-wide checkpoint data.
// todo extract method
SStreamMeta* pMeta = pTask->pMeta;
int32_t remain = atomic_sub_fetch_32(&pMeta->notCkptReadyTasks, 1);
if (remain <= 0) { // all tasks are in TASK_STATUS__CK_READY state
int32_t remain = atomic_sub_fetch_32(&pMeta->chkptNotReadyTasks, 1);
ASSERT(remain >= 0);
if (remain == 0) { // all tasks are in TASK_STATUS__CK_READY state
streamBackendDoCheckpoint(pMeta, pTask->checkpointingId);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册