提交 47970ff8 编写于 作者: S Shengliang Guan

refactor: node mgmt

上级 dd87e8f7
...@@ -104,11 +104,7 @@ static void dmCloseMgmt(SDnodeMgmt *pMgmt) { ...@@ -104,11 +104,7 @@ static void dmCloseMgmt(SDnodeMgmt *pMgmt) {
pMgmt->data.dnodeHash = NULL; pMgmt->data.dnodeHash = NULL;
} }
taosWUnLockLatch(&pMgmt->data.latch); taosWUnLockLatch(&pMgmt->data.latch);
taosMemoryFree(pMgmt);
taosMemoryFreeClear(pMgmt->data.localEp);
taosMemoryFreeClear(pMgmt->data.localFqdn);
taosMemoryFreeClear(pMgmt->data.firstEp);
taosMemoryFreeClear(pMgmt->data.secondEp);
dInfo("dnode-mgmt is cleaned up"); dInfo("dnode-mgmt is cleaned up");
} }
......
...@@ -179,7 +179,7 @@ int32_t dmStartNode(SMgmtWrapper *pWrapper) { ...@@ -179,7 +179,7 @@ int32_t dmStartNode(SMgmtWrapper *pWrapper) {
} }
void dmStopNode(SMgmtWrapper *pWrapper) { void dmStopNode(SMgmtWrapper *pWrapper) {
if (pWrapper->func.stopFp != NULL) { if (pWrapper->func.stopFp != NULL && pWrapper->pMgmt != NULL) {
(*pWrapper->func.stopFp)(pWrapper->pMgmt); (*pWrapper->func.stopFp)(pWrapper->pMgmt);
} }
} }
......
...@@ -63,15 +63,16 @@ static void dmClearVars(SDnode *pDnode) { ...@@ -63,15 +63,16 @@ static void dmClearVars(SDnode *pDnode) {
taosCloseFile(&pDnode->lockfile); taosCloseFile(&pDnode->lockfile);
pDnode->lockfile = NULL; pDnode->lockfile = NULL;
} }
taosThreadMutexDestroy(&pDnode->mutex);
memset(&pDnode->mutex, 0, sizeof(pDnode->mutex));
taosMemoryFree(pDnode);
taosMemoryFreeClear(pDnode->input.localEp); taosMemoryFreeClear(pDnode->input.localEp);
taosMemoryFreeClear(pDnode->input.localFqdn); taosMemoryFreeClear(pDnode->input.localFqdn);
taosMemoryFreeClear(pDnode->input.firstEp); taosMemoryFreeClear(pDnode->input.firstEp);
taosMemoryFreeClear(pDnode->input.secondEp); taosMemoryFreeClear(pDnode->input.secondEp);
taosMemoryFreeClear(pDnode->input.dataDir); taosMemoryFreeClear(pDnode->input.dataDir);
taosThreadMutexDestroy(&pDnode->mutex);
memset(&pDnode->mutex, 0, sizeof(pDnode->mutex));
taosMemoryFree(pDnode);
dDebug("dnode memory is cleared, data:%p", pDnode); dDebug("dnode memory is cleared, data:%p", pDnode);
} }
......
...@@ -145,7 +145,7 @@ int32_t udfStartUdfd(int32_t startDnodeId) { ...@@ -145,7 +145,7 @@ int32_t udfStartUdfd(int32_t startDnodeId) {
} }
SUdfdData *pData = &udfdGlobal; SUdfdData *pData = &udfdGlobal;
if (pData->startCalled) { if (pData->startCalled) {
fnInfo("dnode-mgmt start udfd already called"); fnInfo("dnode start udfd already called");
return 0; return 0;
} }
pData->startCalled = true; pData->startCalled = true;
...@@ -163,7 +163,7 @@ int32_t udfStartUdfd(int32_t startDnodeId) { ...@@ -163,7 +163,7 @@ int32_t udfStartUdfd(int32_t startDnodeId) {
uv_async_send(&pData->stopAsync); uv_async_send(&pData->stopAsync);
uv_thread_join(&pData->thread); uv_thread_join(&pData->thread);
pData->needCleanUp = false; pData->needCleanUp = false;
fnInfo("dnode-mgmt udfd cleaned up after spawn err"); fnInfo("dnode udfd cleaned up after spawn err");
} else { } else {
pData->needCleanUp = true; pData->needCleanUp = true;
} }
...@@ -172,7 +172,7 @@ int32_t udfStartUdfd(int32_t startDnodeId) { ...@@ -172,7 +172,7 @@ int32_t udfStartUdfd(int32_t startDnodeId) {
int32_t udfStopUdfd() { int32_t udfStopUdfd() {
SUdfdData *pData = &udfdGlobal; SUdfdData *pData = &udfdGlobal;
fnInfo("dnode-mgmt to stop udfd. need cleanup: %d, spawn err: %d", fnInfo("dnode to stop udfd. need cleanup: %d, spawn err: %d",
pData->needCleanUp, pData->spawnErr); pData->needCleanUp, pData->spawnErr);
if (!pData->needCleanUp || atomic_load_32(&pData->stopCalled)) { if (!pData->needCleanUp || atomic_load_32(&pData->stopCalled)) {
return 0; return 0;
...@@ -182,7 +182,7 @@ int32_t udfStopUdfd() { ...@@ -182,7 +182,7 @@ int32_t udfStopUdfd() {
uv_barrier_destroy(&pData->barrier); uv_barrier_destroy(&pData->barrier);
uv_async_send(&pData->stopAsync); uv_async_send(&pData->stopAsync);
uv_thread_join(&pData->thread); uv_thread_join(&pData->thread);
fnInfo("dnode-mgmt udfd cleaned up"); fnInfo("dnode udfd cleaned up");
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册