commit
1d1167676f
|
@ -126,7 +126,9 @@ int32_t mmPutRpcMsgToReadQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
return mmPutRpcMsgToWorker(&pMgmt->readWorker, pMsg);
|
return mmPutRpcMsgToWorker(&pMgmt->readWorker, pMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mmPutRpcMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) { return mmPutRpcMsgToWorker(&pMgmt->syncWorker, pMsg); }
|
int32_t mmPutRpcMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
|
return mmPutRpcMsgToWorker(&pMgmt->syncWorker, pMsg);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
|
int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
|
||||||
SSingleWorkerCfg qCfg = {
|
SSingleWorkerCfg qCfg = {
|
||||||
|
|
|
@ -70,12 +70,11 @@ static void vmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (terrno != 0) code = terrno;
|
if (terrno != 0) code = terrno;
|
||||||
vmSendRsp(pMsg, code);
|
vmSendRsp(pMsg, code);
|
||||||
|
}
|
||||||
dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
|
dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
taosFreeQitem(pMsg);
|
taosFreeQitem(pMsg);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
SVnodeObj *pVnode = pInfo->ahandle;
|
SVnodeObj *pVnode = pInfo->ahandle;
|
||||||
|
@ -85,12 +84,11 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (terrno != 0) code = terrno;
|
if (terrno != 0) code = terrno;
|
||||||
vmSendRsp(pMsg, code);
|
vmSendRsp(pMsg, code);
|
||||||
|
}
|
||||||
dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
|
dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
taosFreeQitem(pMsg);
|
taosFreeQitem(pMsg);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
||||||
SVnodeObj *pVnode = pInfo->ahandle;
|
SVnodeObj *pVnode = pInfo->ahandle;
|
||||||
|
@ -216,13 +214,12 @@ static void vmProcessMergeQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (terrno != 0) code = terrno;
|
if (terrno != 0) code = terrno;
|
||||||
vmSendRsp(pMsg, code);
|
vmSendRsp(pMsg, code);
|
||||||
|
}
|
||||||
dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
|
dTrace("msg:%p, is freed, code:0x%x", pMsg, code);
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
taosFreeQitem(pMsg);
|
taosFreeQitem(pMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t vmPutNodeMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtype) {
|
static int32_t vmPutNodeMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtype) {
|
||||||
SRpcMsg * pRpc = pMsg;
|
SRpcMsg * pRpc = pMsg;
|
||||||
|
|
|
@ -129,7 +129,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver) {
|
int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver, SRpcHandleInfo handleInfo) {
|
||||||
if (msgType != TDMT_VND_SUBMIT) return 0;
|
if (msgType != TDMT_VND_SUBMIT) return 0;
|
||||||
void* pIter = NULL;
|
void* pIter = NULL;
|
||||||
STqExec* pExec = NULL;
|
STqExec* pExec = NULL;
|
||||||
|
@ -239,10 +239,9 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
|
||||||
|
|
||||||
void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
|
void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
|
||||||
tEncodeSMqDataBlkRsp(&abuf, &rsp);
|
tEncodeSMqDataBlkRsp(&abuf, &rsp);
|
||||||
pMsg->pCont = buf;
|
|
||||||
pMsg->contLen = tlen;
|
SRpcMsg resp = {.info = handleInfo, .pCont = buf, .contLen = tlen, .code = 0};
|
||||||
pMsg->code = 0;
|
tmsgSendRsp(&resp);
|
||||||
tmsgSendRsp(pMsg);
|
|
||||||
|
|
||||||
atomic_store_ptr(&pExec->pushHandle.handle, NULL);
|
atomic_store_ptr(&pExec->pushHandle.handle, NULL);
|
||||||
taosWUnLockLatch(&pExec->pushHandle.lock);
|
taosWUnLockLatch(&pExec->pushHandle.lock);
|
||||||
|
@ -663,10 +662,9 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
|
|
||||||
void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
|
void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
|
||||||
tEncodeSMqDataBlkRsp(&abuf, &rsp);
|
tEncodeSMqDataBlkRsp(&abuf, &rsp);
|
||||||
pMsg->pCont = buf;
|
|
||||||
pMsg->contLen = tlen;
|
SRpcMsg resp = {.info = pMsg->info, .pCont = buf, .contLen = tlen, .code = 0};
|
||||||
pMsg->code = 0;
|
tmsgSendRsp(&resp);
|
||||||
tmsgSendRsp(pMsg);
|
|
||||||
|
|
||||||
tqDebug("vg %d offset %ld from consumer %ld (epoch %d) send rsp, block num: %d, reqOffset: %ld, rspOffset: %ld",
|
tqDebug("vg %d offset %ld from consumer %ld (epoch %d) send rsp, block num: %d, reqOffset: %ld, rspOffset: %ld",
|
||||||
TD_VID(pTq->pVnode), fetchOffset, consumerId, pReq->epoch, rsp.blockNum, rsp.reqOffset, rsp.rspOffset);
|
TD_VID(pTq->pVnode), fetchOffset, consumerId, pReq->epoch, rsp.blockNum, rsp.reqOffset, rsp.rspOffset);
|
||||||
|
@ -845,12 +843,10 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
/*rsp.pBlockData = pRes;*/
|
/*rsp.pBlockData = pRes;*/
|
||||||
|
|
||||||
/*taosArrayDestroyEx(rsp.pBlockData, (void (*)(void*))tDeleteSSDataBlock);*/
|
/*taosArrayDestroyEx(rsp.pBlockData, (void (*)(void*))tDeleteSSDataBlock);*/
|
||||||
pMsg->pCont = buf;
|
SRpcMsg resp = {.info = pMsg->info, pCont = buf, .contLen = msgLen, .code = 0};
|
||||||
pMsg->contLen = msgLen;
|
|
||||||
pMsg->code = 0;
|
|
||||||
tqDebug("vg %d offset %ld msgType %d from consumer %ld (epoch %d) actual rsp", TD_VID(pTq->pVnode), fetchOffset,
|
tqDebug("vg %d offset %ld msgType %d from consumer %ld (epoch %d) actual rsp", TD_VID(pTq->pVnode), fetchOffset,
|
||||||
pHead->msgType, consumerId, pReq->epoch);
|
pHead->msgType, consumerId, pReq->epoch);
|
||||||
tmsgSendRsp(pMsg);
|
tmsgSendRsp(&resp);
|
||||||
taosMemoryFree(pHead);
|
taosMemoryFree(pHead);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -878,10 +874,9 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
|
||||||
|
|
||||||
void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
|
void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
|
||||||
tEncodeSMqPollRspV2(&abuf, &rspV2);
|
tEncodeSMqPollRspV2(&abuf, &rspV2);
|
||||||
pMsg->pCont = buf;
|
|
||||||
pMsg->contLen = tlen;
|
SRpcMsg resp = {.info = pMsg->info, .pCont = buf, .contLen = tlen, .code = 0};
|
||||||
pMsg->code = 0;
|
tmsgSendRsp(&resp);
|
||||||
tmsgSendRsp(pMsg);
|
|
||||||
tqDebug("vg %d offset %ld from consumer %ld (epoch %d) not rsp", TD_VID(pTq->pVnode), fetchOffset, consumerId,
|
tqDebug("vg %d offset %ld from consumer %ld (epoch %d) not rsp", TD_VID(pTq->pVnode), fetchOffset, consumerId,
|
||||||
pReq->epoch);
|
pReq->epoch);
|
||||||
/*}*/
|
/*}*/
|
||||||
|
|
|
@ -184,8 +184,12 @@ int vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
|
||||||
case TDMT_VND_TASK_PIPE_EXEC:
|
case TDMT_VND_TASK_PIPE_EXEC:
|
||||||
case TDMT_VND_TASK_MERGE_EXEC:
|
case TDMT_VND_TASK_MERGE_EXEC:
|
||||||
return tqProcessTaskExec(pVnode->pTq, msgstr, msgLen, 0);
|
return tqProcessTaskExec(pVnode->pTq, msgstr, msgLen, 0);
|
||||||
case TDMT_VND_STREAM_TRIGGER:
|
case TDMT_VND_STREAM_TRIGGER: {
|
||||||
return tqProcessStreamTrigger(pVnode->pTq, pMsg->pCont, pMsg->contLen, 0);
|
// refactor, avoid double free
|
||||||
|
int code = tqProcessStreamTrigger(pVnode->pTq, pMsg->pCont, pMsg->contLen, 0);
|
||||||
|
pMsg->pCont = NULL;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
case TDMT_VND_QUERY_HEARTBEAT:
|
case TDMT_VND_QUERY_HEARTBEAT:
|
||||||
return qWorkerProcessHbMsg(pVnode, pVnode->pQuery, pMsg);
|
return qWorkerProcessHbMsg(pVnode, pVnode->pQuery, pMsg);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -94,7 +94,9 @@ void rpcFreeCont(void* cont) {
|
||||||
if (cont == NULL) {
|
if (cont == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFree((char*)cont - TRANS_MSG_OVERHEAD);
|
taosMemoryFree((char*)cont - TRANS_MSG_OVERHEAD);
|
||||||
|
tTrace("free mem: %p", (char*)cont - TRANS_MSG_OVERHEAD);
|
||||||
}
|
}
|
||||||
void* rpcReallocCont(void* ptr, int contLen) {
|
void* rpcReallocCont(void* ptr, int contLen) {
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
|
|
|
@ -133,6 +133,7 @@ int transAllocBuffer(SConnBuffer* connBuf, uv_buf_t* uvBuf) {
|
||||||
} else {
|
} else {
|
||||||
p->cap = p->total;
|
p->cap = p->total;
|
||||||
p->buf = taosMemoryRealloc(p->buf, p->cap);
|
p->buf = taosMemoryRealloc(p->buf, p->cap);
|
||||||
|
tTrace("internal malloc mem: %p, size: %d", p->buf, p->cap);
|
||||||
|
|
||||||
uvBuf->base = p->buf + p->len;
|
uvBuf->base = p->buf + p->len;
|
||||||
uvBuf->len = p->cap - p->len;
|
uvBuf->len = p->cap - p->len;
|
||||||
|
|
|
@ -469,6 +469,8 @@ static void uvStartSendResp(SSrvMsg* smsg) {
|
||||||
|
|
||||||
if (pConn->broken == true) {
|
if (pConn->broken == true) {
|
||||||
// persist by
|
// persist by
|
||||||
|
transFreeMsg(smsg->msg.pCont);
|
||||||
|
taosMemoryFree(smsg);
|
||||||
transUnrefSrvHandle(pConn);
|
transUnrefSrvHandle(pConn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue