diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index ef05278129..afc06bb1e7 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -117,6 +117,23 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO vnodePreprocessWriteReqs(pVnode->pImpl, pArray); + numOfMsgs = taosArrayGetSize(pArray); + for (int32_t i = 0; i < numOfMsgs; i++) { + SNodeMsg *pMsg = *(SNodeMsg **)taosArrayGet(pArray, i); + SRpcMsg *pRpc = &pMsg->rpcMsg; + SRpcMsg *pRsp = NULL; + + int32_t code = vnodeProcessWriteReq(pVnode->pImpl, pRpc, &pRsp); + if (pRsp != NULL) { + pRsp->ahandle = pRpc->ahandle; + tmsgSendRsp(pRsp); + taosMemoryFree(pRsp); + } else { + if (code != 0 && terrno != 0) code = terrno; + vmSendRsp(pVnode->pWrapper, pMsg, code); + } + } + // sync integration response /* for (int i = 0; i < taosArrayGetSize(pArray); i++) { @@ -147,23 +164,6 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO } */ - numOfMsgs = taosArrayGetSize(pArray); - for (int32_t i = 0; i < numOfMsgs; i++) { - SNodeMsg *pMsg = *(SNodeMsg **)taosArrayGet(pArray, i); - SRpcMsg *pRpc = &pMsg->rpcMsg; - SRpcMsg *pRsp = NULL; - - int32_t code = vnodeProcessWriteReq(pVnode->pImpl, pRpc, &pRsp); - if (pRsp != NULL) { - pRsp->ahandle = pRpc->ahandle; - tmsgSendRsp(pRsp); - taosMemoryFree(pRsp); - } else { - if (code != 0 && terrno != 0) code = terrno; - vmSendRsp(pVnode->pWrapper, pMsg, code); - } - } - for (int32_t i = 0; i < numOfMsgs; i++) { SNodeMsg *pMsg = *(SNodeMsg **)taosArrayGet(pArray, i); dTrace("msg:%p, is freed", pMsg);