From fe368d0ffec89f2f9bfc269199ddfdef89299f2b Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Sat, 16 Apr 2022 08:03:19 +0000 Subject: [PATCH] refact vnode --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 1 - source/dnode/vnode/inc/vnode.h | 8 -------- source/dnode/vnode/src/inc/meta.h | 3 +-- source/dnode/vnode/src/inc/tq.h | 4 +--- source/dnode/vnode/src/meta/metaMain.c | 8 ++++---- source/dnode/vnode/src/tq/tq.c | 4 +--- source/dnode/vnode/src/vnd/vnodeOpen.c | 4 ++-- 7 files changed, 9 insertions(+), 23 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 12e956fa4c..7eb08a8f4f 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -96,7 +96,6 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->tsdbCfg.keep1 = pCreate->daysToKeep0; pCfg->tsdbCfg.lruCacheSize = pCreate->cacheBlockSize; pCfg->tsdbCfg.retentions = pCreate->pRetensions; - pCfg->metaCfg.lruSize = pCreate->cacheBlockSize; pCfg->walCfg.level = TAOS_WAL_WRITE; pCfg->walCfg.fsyncPeriod = 0; pCfg->walCfg.retentionPeriod = 0; diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index b45077bbc3..c1e96ffcb1 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -37,9 +37,7 @@ extern "C" { // vnode typedef struct SVnode SVnode; -typedef struct SMetaCfg SMetaCfg; // todo: remove typedef struct STsdbCfg STsdbCfg; // todo: remove -typedef struct STqCfg STqCfg; // todo: remove typedef struct SVnodeCfg SVnodeCfg; int vnodeInit(int nthreads); @@ -134,10 +132,6 @@ struct STsdbCfg { SArray *retentions; }; -struct STqCfg { - int32_t reserved; -}; - struct SVnodeCfg { int32_t vgId; uint64_t dbId; @@ -151,8 +145,6 @@ struct SVnodeCfg { int8_t streamMode; bool isWeak; STsdbCfg tsdbCfg; - SMetaCfg metaCfg; - STqCfg tqCfg; SWalCfg walCfg; SMsgCb msgCb; uint32_t hashBegin; diff --git a/source/dnode/vnode/src/inc/meta.h b/source/dnode/vnode/src/inc/meta.h index 94a1266f46..f30696c9ac 100644 --- a/source/dnode/vnode/src/inc/meta.h +++ b/source/dnode/vnode/src/inc/meta.h @@ -40,7 +40,7 @@ typedef struct SMSmaCursor SMSmaCursor; #define META_CHILD_TABLE TD_CHILD_TABLE #define META_NORMAL_TABLE TD_NORMAL_TABLE -SMeta* metaOpen(const char* path, const SMetaCfg* pMetaCfg, SMemAllocatorFactory* pMAF); +SMeta* metaOpen(const char* path, SMemAllocatorFactory* pMAF); void metaClose(SMeta* pMeta); void metaRemove(const char* path); int metaCreateTable(SMeta* pMeta, STbCfg* pTbCfg); @@ -97,7 +97,6 @@ tb_uid_t metaGenerateUid(SMeta* pMeta); struct SMeta { char* path; SVnode* pVnode; - SMetaCfg options; SMetaDB* pDB; SMetaIdx* pIdx; SMetaCache* pCache; diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index ce81006661..ed33473b16 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -160,7 +160,6 @@ struct STQ { // the handle of meta kvstore bool writeTrigger; char* path; - STqCfg* tqConfig; STqMemRef tqMemRef; STqMetaStore* tqMeta; // STqPushMgr* tqPushMgr; @@ -251,8 +250,7 @@ int tqInit(); void tqCleanUp(); // open in each vnode -STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal, SMeta* pMeta, STqCfg* tqConfig, - SMemAllocatorFactory* allocFac); +STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal, SMeta* pMeta, SMemAllocatorFactory* allocFac); void tqClose(STQ*); // required by vnode int tqPushMsg(STQ*, void* msg, int32_t msgLen, tmsg_t msgType, int64_t version); diff --git a/source/dnode/vnode/src/meta/metaMain.c b/source/dnode/vnode/src/meta/metaMain.c index dd60e56371..879a7e8a6f 100644 --- a/source/dnode/vnode/src/meta/metaMain.c +++ b/source/dnode/vnode/src/meta/metaMain.c @@ -17,16 +17,16 @@ #include "vnodeInt.h" -static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF); +static SMeta *metaNew(const char *path, SMemAllocatorFactory *pMAF); static void metaFree(SMeta *pMeta); static int metaOpenImpl(SMeta *pMeta); static void metaCloseImpl(SMeta *pMeta); -SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF) { +SMeta *metaOpen(const char *path, SMemAllocatorFactory *pMAF) { SMeta *pMeta = NULL; // Allocate handle - pMeta = metaNew(path, pMetaCfg, pMAF); + pMeta = metaNew(path, pMAF); if (pMeta == NULL) { // TODO: handle error return NULL; @@ -54,7 +54,7 @@ void metaClose(SMeta *pMeta) { void metaRemove(const char *path) { taosRemoveDir(path); } /* ------------------------ STATIC METHODS ------------------------ */ -static SMeta *metaNew(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF) { +static SMeta *metaNew(const char *path, SMemAllocatorFactory *pMAF) { SMeta *pMeta; size_t psize = strlen(path); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 3a4168e759..0aa6023eaf 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -19,15 +19,13 @@ int32_t tqInit() { return tqPushMgrInit(); } void tqCleanUp() { tqPushMgrCleanUp(); } -STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal, SMeta* pVnodeMeta, STqCfg* tqConfig, - SMemAllocatorFactory* allocFac) { +STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal, SMeta* pVnodeMeta, SMemAllocatorFactory* allocFac) { STQ* pTq = taosMemoryMalloc(sizeof(STQ)); if (pTq == NULL) { terrno = TSDB_CODE_TQ_OUT_OF_MEMORY; return NULL; } pTq->path = strdup(path); - pTq->tqConfig = tqConfig; pTq->pVnode = pVnode; pTq->pWal = pWal; pTq->pVnodeMeta = pVnodeMeta; diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index c8943a023a..ea27cda998 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -132,7 +132,7 @@ static int vnodeOpenImpl(SVnode *pVnode) { // Open meta sprintf(dir, "%s/meta", pVnode->path); - pVnode->pMeta = metaOpen(dir, &(pVnode->config.metaCfg), vBufPoolGetMAF(pVnode)); + pVnode->pMeta = metaOpen(dir, vBufPoolGetMAF(pVnode)); if (pVnode->pMeta == NULL) { // TODO: handle error return -1; @@ -157,7 +157,7 @@ static int vnodeOpenImpl(SVnode *pVnode) { // Open TQ sprintf(dir, "%s/tq", pVnode->path); - pVnode->pTq = tqOpen(dir, pVnode, pVnode->pWal, pVnode->pMeta, &(pVnode->config.tqCfg), vBufPoolGetMAF(pVnode)); + pVnode->pTq = tqOpen(dir, pVnode, pVnode->pWal, pVnode->pMeta, vBufPoolGetMAF(pVnode)); if (pVnode->pTq == NULL) { // TODO: handle error return -1;