From 1b15f93b6d8c24b4eb8f857af0335830f3d547ae Mon Sep 17 00:00:00 2001 From: Shengliang Date: Tue, 10 May 2022 23:14:34 +0800 Subject: [PATCH] refactor: node mgmt --- source/dnode/mgmt/node_common/src/dmFile.c | 3 +-- source/dnode/mgmt/node_mgmt/src/dmObj.c | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/dnode/mgmt/node_common/src/dmFile.c b/source/dnode/mgmt/node_common/src/dmFile.c index a5ed36a177..3dc3cdcaf7 100644 --- a/source/dnode/mgmt/node_common/src/dmFile.c +++ b/source/dnode/mgmt/node_common/src/dmFile.c @@ -149,7 +149,6 @@ int32_t dmReadShmFile(SMgmtWrapper *pWrapper) { snprintf(file, sizeof(file), "%s%sshmfile", pWrapper->path, TD_DIRSEP); pFile = taosOpenFile(file, TD_FILE_READ); if (pFile == NULL) { - // dDebug("node:%s, file %s not exist", pWrapper->name, file); code = 0; goto _OVER; } @@ -173,7 +172,7 @@ int32_t dmReadShmFile(SMgmtWrapper *pWrapper) { } } - if (!tsMultiProcess || pWrapper->nodeType == DNODE) { + if (!tsMultiProcess) { if (pWrapper->procShm.id >= 0) { dDebug("node:%s, shmid:%d, is closed, size:%d", pWrapper->name, pWrapper->procShm.id, pWrapper->procShm.size); taosDropShm(&pWrapper->procShm); diff --git a/source/dnode/mgmt/node_mgmt/src/dmObj.c b/source/dnode/mgmt/node_mgmt/src/dmObj.c index 3f766ee707..4578c9add0 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmObj.c +++ b/source/dnode/mgmt/node_mgmt/src/dmObj.c @@ -98,13 +98,13 @@ SDnode *dmCreate(const SDnodeOpt *pOption) { smSetMgmtFp(&pDnode->wrappers[SNODE]); bmSetMgmtFp(&pDnode->wrappers[BNODE]); - for (EDndNodeType n = DNODE; n < NODE_END; ++n) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; + for (EDndNodeType ntype = DNODE; ntype < NODE_END; ++ntype) { + SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype]; snprintf(path, sizeof(path), "%s%s%s", pDnode->data.dataDir, TD_DIRSEP, pWrapper->name); pWrapper->path = strdup(path); pWrapper->procShm.id = -1; pWrapper->pDnode = pDnode; - pWrapper->nodeType = n; + pWrapper->nodeType = ntype; pWrapper->procType = DND_PROC_SINGLE; taosInitRWLatch(&pWrapper->latch); @@ -113,7 +113,7 @@ SDnode *dmCreate(const SDnodeOpt *pOption) { goto _OVER; } - if (n != DNODE && dmReadShmFile(pWrapper) != 0) { + if (ntype != DNODE && dmReadShmFile(pWrapper) != 0) { dError("node:%s, failed to read shm file since %s", pWrapper->name, terrstr()); goto _OVER; } -- GitLab