diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index f6976aa2cc5f2b40471bb013a6241db4317651d8..4d335d73534b452b71753b63d6d1b814b0df674b 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -225,17 +225,17 @@ static int32_t dnodeOpenVnode(int32_t vnode, char *rootDir) { vnodeObj.status = TSDB_VN_STATUS_NOT_READY; vnodeObj.refCount = 1; vnodeObj.version = 0; - vnodeObj.wworker = dnodeAllocateWriteWorker(&vnodeObj); - vnodeObj.rworker = dnodeAllocateReadWorker(&vnodeObj); vnodeObj.wal = NULL; vnodeObj.tsdb = pTsdb; vnodeObj.replica = NULL; vnodeObj.events = NULL; vnodeObj.cq = NULL; - taosAddIntHash(tsDnodeVnodesHash, vnodeObj.vgId, (char *) (&vnodeObj)); + SVnodeObj *pVnode = (SVnodeObj *)taosAddIntHash(tsDnodeVnodesHash, vnodeObj.vgId, (char *)(&vnodeObj)); + pVnode->wworker = dnodeAllocateWriteWorker(pVnode); + pVnode->rworker = dnodeAllocateReadWorker(pVnode); - dTrace("open vnode:%d in %s", vnodeObj.vgId, rootDir); + dTrace("open vnode:%d in %s", pVnode->vgId, rootDir); return TSDB_CODE_SUCCESS; } @@ -314,17 +314,17 @@ static int32_t dnodeCreateVnode(SMDCreateVnodeMsg *pVnodeCfg) { vnodeObj.status = TSDB_VN_STATUS_NOT_READY; vnodeObj.refCount = 1; vnodeObj.version = 0; - vnodeObj.wworker = dnodeAllocateWriteWorker(&vnodeObj); - vnodeObj.rworker = dnodeAllocateReadWorker(&vnodeObj); vnodeObj.wal = NULL; vnodeObj.tsdb = pTsdb; vnodeObj.replica = NULL; vnodeObj.events = NULL; vnodeObj.cq = NULL; - taosAddIntHash(tsDnodeVnodesHash, vnodeObj.vgId, (char *) (&vnodeObj)); + SVnodeObj *pVnode = (SVnodeObj *)taosAddIntHash(tsDnodeVnodesHash, vnodeObj.vgId, (char *)(&vnodeObj)); + pVnode->wworker = dnodeAllocateWriteWorker(pVnode); + pVnode->rworker = dnodeAllocateReadWorker(pVnode); - dPrint("vgroup:%d, vnode:%d is created", vnodeObj.vgId, vnodeObj.vgId); + dPrint("vgroup:%d, vnode:%d is created", pVnode->vgId, pVnode->vgId); return TSDB_CODE_SUCCESS; } diff --git a/src/dnode/src/dnodeRead.c b/src/dnode/src/dnodeRead.c index c928f5ee91951a1ec2b90dd5cd00261161e127ca..d6ecf2fa66b0cf4cbaaa4cbcd061d6ff13d6c4a9 100644 --- a/src/dnode/src/dnodeRead.c +++ b/src/dnode/src/dnodeRead.c @@ -220,11 +220,15 @@ static void dnodeProcessReadResult(void *pVnode, SReadMsg *pRead) { code = terrno; } - SRpcMsg rsp; - rsp.handle = pRead->rpcMsg.handle; - rsp.code = code; - rsp.pCont = NULL; - rpcSendResponse(&rsp); + //TODO: query handle is returned by dnodeProcessQueryMsg + if (0) { + SRpcMsg rsp; + rsp.handle = pRead->rpcMsg.handle; + rsp.code = code; + rsp.pCont = NULL; + rpcSendResponse(&rsp); + } + rpcFreeCont(pRead->rpcMsg.pCont); // free the received message }