From e237b4ac39e29537bdf820296d1061bb2deff1fd Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 31 May 2023 09:19:05 +0800 Subject: [PATCH] refactor: do some internal refactor. --- source/dnode/vnode/src/tq/tq.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index dcfc578ac7..4f2be441e0 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -978,17 +978,20 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms tDecoderClear(&decoder); + SStreamMeta* pStreamMeta = pTq->pStreamMeta; + // 2.save task, use the newest commit version as the initial start version of stream task. - taosWLockLatch(&pTq->pStreamMeta->lock); - code = streamMetaAddDeployedTask(pTq->pStreamMeta, sversion, pTask); - int32_t numOfTasks = streamMetaGetNumOfTasks(pTq->pStreamMeta); + taosWLockLatch(&pStreamMeta->lock); + code = streamMetaAddDeployedTask(pStreamMeta, sversion, pTask); + + int32_t numOfTasks = streamMetaGetNumOfTasks(pStreamMeta); if (code < 0) { tqError("vgId:%d failed to add s-task:%s, total:%d", vgId, pTask->id.idStr, numOfTasks); - taosWUnLockLatch(&pTq->pStreamMeta->lock); + taosWUnLockLatch(&pStreamMeta->lock); return -1; } - taosWUnLockLatch(&pTq->pStreamMeta->lock); + taosWUnLockLatch(&pStreamMeta->lock); // 3.go through recover steps to fill history if (pTask->fillHistory) {