From f7b8f0043ef245dea63c92df8bc6a7e0719bd62a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 27 Apr 2022 11:41:44 +0800 Subject: [PATCH 1/3] fix: startup is not allowed when fqdn is changed --- source/dnode/mgmt/implement/src/dmEps.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/dnode/mgmt/implement/src/dmEps.c b/source/dnode/mgmt/implement/src/dmEps.c index ae1cd513b5..77f9651e53 100644 --- a/source/dnode/mgmt/implement/src/dmEps.c +++ b/source/dnode/mgmt/implement/src/dmEps.c @@ -156,11 +156,6 @@ PRASE_DNODE_OVER: if (root != NULL) cJSON_Delete(root); if (pFile != NULL) taosCloseFile(&pFile); - if (dmIsEpChanged(pDnode, pDnode->data.dnodeId, pDnode->data.localEp)) { - dError("localEp %s different with %s and need reconfigured", pDnode->data.localEp, file); - return -1; - } - if (taosArrayGetSize(pDnode->data.dnodeEps) == 0) { SDnodeEp dnodeEp = {0}; dnodeEp.isMnode = 1; @@ -170,6 +165,11 @@ PRASE_DNODE_OVER: dmResetEps(pDnode, pDnode->data.dnodeEps); + if (dmIsEpChanged(pDnode, pDnode->data.dnodeId, pDnode->data.localEp)) { + dError("localEp %s different with %s and need reconfigured", pDnode->data.localEp, file); + return -1; + } + terrno = code; return code; } From 20c513f42e94c7ea36eed60ca2c4138f85c9be2c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 27 Apr 2022 14:05:10 +0800 Subject: [PATCH 2/3] fix: startup is not allowed when fqdn is changed --- source/dnode/mgmt/implement/src/dmEps.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/dnode/mgmt/implement/src/dmEps.c b/source/dnode/mgmt/implement/src/dmEps.c index 77f9651e53..ee4c13eb79 100644 --- a/source/dnode/mgmt/implement/src/dmEps.c +++ b/source/dnode/mgmt/implement/src/dmEps.c @@ -291,13 +291,17 @@ static void dmPrintEps(SDnode *pDnode) { static bool dmIsEpChanged(SDnode *pDnode, int32_t dnodeId, const char *ep) { bool changed = false; + if (dnodeId == 0) return changed; taosRLockLatch(&pDnode->data.latch); SDnodeEp *pDnodeEp = taosHashGet(pDnode->data.dnodeHash, &dnodeId, sizeof(int32_t)); if (pDnodeEp != NULL) { - char epstr[TSDB_EP_LEN + 1]; + char epstr[TSDB_EP_LEN + 1] = {0}; snprintf(epstr, TSDB_EP_LEN, "%s:%u", pDnodeEp->ep.fqdn, pDnodeEp->ep.port); - changed = strcmp(ep, epstr) != 0; + changed = (strcmp(ep, epstr) != 0); + if (changed) { + dError("localEp %s different from %s", ep, epstr); + } } taosRUnLockLatch(&pDnode->data.latch); From 767d467bdbf6cfeb3cd78c5bda31c681fe4c95a7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 27 Apr 2022 14:31:53 +0800 Subject: [PATCH 3/3] fix: startup is not allowed when fqdn is changed --- source/dnode/mgmt/implement/src/dmEps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mgmt/implement/src/dmEps.c b/source/dnode/mgmt/implement/src/dmEps.c index ee4c13eb79..853c238316 100644 --- a/source/dnode/mgmt/implement/src/dmEps.c +++ b/source/dnode/mgmt/implement/src/dmEps.c @@ -120,7 +120,7 @@ int32_t dmReadEps(SDnode *pDnode) { goto PRASE_DNODE_OVER; } - dnodeEp.id = dnodeId->valueint; + dnodeEp.id = did->valueint; cJSON *dnodeFqdn = cJSON_GetObjectItem(node, "fqdn"); if (!dnodeFqdn || dnodeFqdn->type != cJSON_String || dnodeFqdn->valuestring == NULL) { @@ -300,7 +300,7 @@ static bool dmIsEpChanged(SDnode *pDnode, int32_t dnodeId, const char *ep) { snprintf(epstr, TSDB_EP_LEN, "%s:%u", pDnodeEp->ep.fqdn, pDnodeEp->ep.port); changed = (strcmp(ep, epstr) != 0); if (changed) { - dError("localEp %s different from %s", ep, epstr); + dError("dnode:%d, localEp %s different from %s", dnodeId, ep, epstr); } }