From c2eadc27060ce70dcd402053f6a96e700d7061fd Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 7 Jan 2022 23:03:06 -0800 Subject: [PATCH] minor changes --- include/dnode/vnode/vnode.h | 2 ++ source/dnode/mgmt/impl/src/dndVnodes.c | 8 ++++++-- source/dnode/vnode/impl/src/vnodeMain.c | 7 +++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/dnode/vnode/vnode.h b/include/dnode/vnode/vnode.h index af56d69b11..f3ad0b0176 100644 --- a/include/dnode/vnode/vnode.h +++ b/include/dnode/vnode/vnode.h @@ -32,6 +32,8 @@ extern "C" { /* ------------------------ TYPES EXPOSED ------------------------ */ typedef struct SVnode SVnode; typedef struct SVnodeCfg { + int32_t vgId; + /** vnode buffer pool options */ struct { /** write buffer size */ diff --git a/source/dnode/mgmt/impl/src/dndVnodes.c b/source/dnode/mgmt/impl/src/dndVnodes.c index 6427ab080a..baa15f9d33 100644 --- a/source/dnode/mgmt/impl/src/dndVnodes.c +++ b/source/dnode/mgmt/impl/src/dndVnodes.c @@ -412,7 +412,10 @@ static void *dnodeOpenVnodeFunc(void *param) { pMgmt->openVnodes, pMgmt->totalVnodes); dndReportStartup(pDnode, "open-vnodes", stepDesc); - SVnode *pImpl = vnodeOpen(pCfg->path, NULL); + SVnodeCfg vnodeCfg = {0}; + vnodeCfg.vgId = pCfg->vgId; + + SVnode *pImpl = vnodeOpen(pCfg->path, &vnodeCfg); if (pImpl == NULL) { dError("vgId:%d, failed to open vnode by thread:%d", pCfg->vgId, pThread->threadIndex); pThread->failed++; @@ -550,6 +553,7 @@ static SCreateVnodeMsg *dndParseCreateVnodeReq(SRpcMsg *rpcMsg) { } static void dndGenerateVnodeCfg(SCreateVnodeMsg *pCreate, SVnodeCfg *pCfg) { + pCfg->vgId = pCreate->vgId; pCfg->wsize = pCreate->cacheBlockSize; pCfg->ssize = pCreate->cacheBlockSize; pCfg->wsize = pCreate->cacheBlockSize; @@ -610,7 +614,7 @@ int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *rpcMsg) { return 0; } - SVnode *pImpl = vnodeOpen(wrapperCfg.path, NULL /*pCfg*/); + SVnode *pImpl = vnodeOpen(wrapperCfg.path, &vnodeCfg); if (pImpl == NULL) { return -1; } diff --git a/source/dnode/vnode/impl/src/vnodeMain.c b/source/dnode/vnode/impl/src/vnodeMain.c index 88175646ae..c87749203a 100644 --- a/source/dnode/vnode/impl/src/vnodeMain.c +++ b/source/dnode/vnode/impl/src/vnodeMain.c @@ -20,13 +20,12 @@ static void vnodeFree(SVnode *pVnode); static int vnodeOpenImpl(SVnode *pVnode); static void vnodeCloseImpl(SVnode *pVnode); -SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) { +SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfgInput) { SVnode *pVnode = NULL; // Set default options - if (pVnodeCfg == NULL) { - pVnodeCfg = &defaultVnodeOptions; - } + SVnodeCfg *pVnodeCfg = &defaultVnodeOptions; + pVnodeCfg->vgId = pVnodeCfg->vgId; // Validate options if (vnodeValidateOptions(pVnodeCfg) < 0) { -- GitLab