diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index ca905d41ea64460ccb04dbb9a34509b33310ab69..ea89b672a8f06c76b53dd21d42caffd7c649c5c6 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -88,7 +88,6 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { SMonMloadInfo minfo = {0}; dmGetMnodeLoads(pMgmt, &minfo); - pMgmt->data.isMnode = minfo.isMnode; pMgmt->data.mndState = minfo.load.syncState; int32_t contLen = tSerializeSStatusReq(NULL, 0, &req); diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c index 1651552fa42597120d35f88fa2b1e8f12d6d9edf..ccb0c5fe8dd3118a70be4a89efde6cc94fe6b991 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c @@ -45,23 +45,18 @@ static int32_t dmOpenMgmt(const SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) pMgmt->data.updateTime = 0; pMgmt->data.rebootTime = taosGetTimestampMs(); pMgmt->data.dropped = 0; - pMgmt->data.localEp = strdup(pInput->localEp); - pMgmt->data.localFqdn = strdup(pInput->localFqdn); - pMgmt->data.firstEp = strdup(pInput->firstEp); - pMgmt->data.secondEp = strdup(pInput->secondEp); - pMgmt->data.dataDir = strdup(pInput->dataDir); - pMgmt->data.disks = pInput->disks; - pMgmt->data.numOfDisks = pInput->numOfDisks; + pMgmt->data.localEp = pInput->localEp; + pMgmt->data.localFqdn = pInput->localFqdn; + pMgmt->data.firstEp = pInput->firstEp; + pMgmt->data.secondEp = pInput->secondEp; pMgmt->data.supportVnodes = pInput->supportVnodes; pMgmt->data.serverPort = pInput->serverPort; + pMgmt->pDnode = pInput->pDnode; + pMgmt->processCreateNodeFp = pInput->processCreateNodeFp; + pMgmt->processDropNodeFp = pInput->processDropNodeFp; + pMgmt->isNodeDeployedFp = pInput->isNodeDeployedFp; taosInitRWLatch(&pMgmt->data.latch); - if (pMgmt->data.dataDir == NULL || pMgmt->data.localEp == NULL || pMgmt->data.localFqdn == NULL || - pMgmt->data.firstEp == NULL || pMgmt->data.secondEp == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - pMgmt->data.dnodeHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); if (pMgmt->data.dnodeHash == NULL) { dError("failed to init dnode hash"); @@ -87,6 +82,7 @@ static int32_t dmOpenMgmt(const SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) dError("failed to start udfd"); } + pOutput->pMgmt = pMgmt; dInfo("dnode-mgmt is initialized"); return 0; } @@ -110,7 +106,6 @@ static void dmCloseMgmt(SDnodeMgmt *pMgmt) { taosMemoryFreeClear(pMgmt->data.localFqdn); taosMemoryFreeClear(pMgmt->data.firstEp); taosMemoryFreeClear(pMgmt->data.secondEp); - taosMemoryFreeClear(pMgmt->data.dataDir); dInfo("dnode-mgmt is cleaned up"); } diff --git a/source/dnode/mgmt/node_mgmt/src/dmExec.c b/source/dnode/mgmt/node_mgmt/src/dmExec.c index 8837853e123d618480eb187e2dcfe217dee4c4e9..50d1c8ab4634ecbb7ec0ad75f46978408e69c757 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmExec.c +++ b/source/dnode/mgmt/node_mgmt/src/dmExec.c @@ -228,7 +228,9 @@ static int32_t dmOpenNodes(SDnode *pDnode) { } else { pWrapper->procType = pDnode->ptype; } - return dmOpenNode(pWrapper); + if (dmOpenNode(pWrapper) != 0) { + return -1; + } } } diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index aaeba61081d74b6dd84ff7fe2e3331e3d5634452..fa15d1e898c8af3c6bfcda09ae0e959d3c0a40df 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -158,31 +158,26 @@ int32_t dmWriteShmFile(const char *path, const char *name, const SShm *pShm); // common define typedef struct { - int32_t dnodeId; - int64_t clusterId; - int64_t dnodeVer; - int64_t updateTime; - int64_t rebootTime; - int32_t unsyncedVgId; - ESyncState vndState; - ESyncState mndState; - bool isMnode; - bool dropped; - SEpSet mnodeEps; - SArray *dnodeEps; - SHashObj *dnodeHash; - SRWLatch latch; - SMsgCb msgCb; - TdFilePtr lockfile; - char *localEp; - char *localFqdn; - char *firstEp; - char *secondEp; - char *dataDir; - SDiskCfg *disks; - int32_t numOfDisks; - int32_t supportVnodes; - uint16_t serverPort; + int32_t dnodeId; + int64_t clusterId; + int64_t dnodeVer; + int64_t updateTime; + int64_t rebootTime; + int32_t unsyncedVgId; + ESyncState vndState; + ESyncState mndState; + bool dropped; + SEpSet mnodeEps; + SArray *dnodeEps; + SHashObj *dnodeHash; + SRWLatch latch; + SMsgCb msgCb; + const char *localEp; + const char *localFqdn; + const char *firstEp; + const char *secondEp; + int32_t supportVnodes; + uint16_t serverPort; } SDnodeData; #ifdef __cplusplus