From c37671f32f44b2f240e2a08b57866c227ead06f1 Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Thu, 16 Jul 2020 01:28:45 +0000 Subject: [PATCH] renanme function --- src/dnode/src/dnodeMgmt.c | 4 ++-- src/inc/vnode.h | 9 ++++----- src/vnode/src/vnodeMain.c | 10 +++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index 338fcd287c..a6c98ddfbd 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -416,7 +416,7 @@ static void* dnodeParseVnodeMsg(SRpcMsg *rpcMsg) { static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) { SMDCreateVnodeMsg *pCreate = dnodeParseVnodeMsg(rpcMsg); - void *pVnode = vnodeAcquireVnode(pCreate->cfg.vgId); + void *pVnode = vnodeAcquire(pCreate->cfg.vgId); if (pVnode != NULL) { dDebug("vgId:%d, already exist, return success", pCreate->cfg.vgId); vnodeRelease(pVnode); @@ -430,7 +430,7 @@ static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) { static int32_t dnodeProcessAlterVnodeMsg(SRpcMsg *rpcMsg) { SMDAlterVnodeMsg *pAlter = dnodeParseVnodeMsg(rpcMsg); - void *pVnode = vnodeAcquireVnode(pAlter->cfg.vgId); + void *pVnode = vnodeAcquire(pAlter->cfg.vgId); if (pVnode != NULL) { dDebug("vgId:%d, alter vnode msg is received", pAlter->cfg.vgId); int32_t code = vnodeAlter(pVnode, pAlter); diff --git a/src/inc/vnode.h b/src/inc/vnode.h index 845cfb250a..1e134a696e 100644 --- a/src/inc/vnode.h +++ b/src/inc/vnode.h @@ -48,11 +48,10 @@ int32_t vnodeStartStream(int32_t vgId); int32_t vnodeAlter(void *pVnode, SMDCreateVnodeMsg *pVnodeCfg); int32_t vnodeClose(int32_t vgId); -void* vnodeAcquireVnode(int32_t vgId); // add refcount -void vnodeRelease(void *pVnode); - -void* vnodeAcquireRqueue(int32_t vgId); -void* vnodeAcquireWqueue(int32_t vgId); +void* vnodeAcquire(int32_t vgId); // add refcount +void* vnodeAcquireRqueue(int32_t vgId); // add refCount, get read queue +void* vnodeAcquireWqueue(int32_t vgId); // add recCount, get write queue +void vnodeRelease(void *pVnode); // dec refCount void* vnodeGetWal(void *pVnode); int32_t vnodeProcessWrite(void *pVnode, int qtype, void *pHead, void *item); diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 3bf0ca9f55..3bef21f074 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -314,7 +314,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { } int32_t vnodeStartStream(int32_t vnode) { - SVnodeObj* pVnode = vnodeAcquireVnode(vnode); + SVnodeObj* pVnode = vnodeAcquire(vnode); if (pVnode != NULL) { tsdbStartStream(pVnode->tsdb); vnodeRelease(pVnode); @@ -387,7 +387,7 @@ void vnodeRelease(void *pVnodeRaw) { vDebug("vgId:%d, vnode is released, vnodes:%d", vgId, count); } -void *vnodeAcquireVnode(int32_t vgId) { +void *vnodeAcquire(int32_t vgId) { SVnodeObj **ppVnode = (SVnodeObj **)taosHashGet(tsDnodeVnodesHash, (const char *)&vgId, sizeof(int32_t)); if (ppVnode == NULL || *ppVnode == NULL) { terrno = TSDB_CODE_VND_INVALID_VGROUP_ID; @@ -403,7 +403,7 @@ void *vnodeAcquireVnode(int32_t vgId) { } void *vnodeAcquireRqueue(int32_t vgId) { - SVnodeObj *pVnode = vnodeAcquireVnode(vgId); + SVnodeObj *pVnode = vnodeAcquire(vgId); if (pVnode == NULL) return NULL; if (pVnode->status == TAOS_VN_STATUS_RESET) { @@ -417,7 +417,7 @@ void *vnodeAcquireRqueue(int32_t vgId) { } void *vnodeAcquireWqueue(int32_t vgId) { - SVnodeObj *pVnode = vnodeAcquireVnode(vgId); + SVnodeObj *pVnode = vnodeAcquire(vgId); if (pVnode == NULL) return NULL; if (pVnode->status == TAOS_VN_STATUS_RESET) { @@ -498,7 +498,7 @@ void vnodeBuildStatusMsg(void *param) { void vnodeSetAccess(SDMVgroupAccess *pAccess, int32_t numOfVnodes) { for (int32_t i = 0; i < numOfVnodes; ++i) { pAccess[i].vgId = htonl(pAccess[i].vgId); - SVnodeObj *pVnode = vnodeAcquireVnode(pAccess[i].vgId); + SVnodeObj *pVnode = vnodeAcquire(pAccess[i].vgId); if (pVnode != NULL) { pVnode->accessState = pAccess[i].accessState; if (pVnode->accessState != TSDB_VN_ALL_ACCCESS) { -- GitLab