From 08c9fc40f4381b4b9e6b1a0ea73d7ab7cdf31ba0 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 20 Mar 2022 11:59:35 +0800 Subject: [PATCH] shm --- source/dnode/mgmt/container/src/dndObj.c | 15 +++++++++++++++ source/dnode/mgmt/main/src/dndMain.c | 5 ++++- source/dnode/mgmt/mnode/src/mmInt.c | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/source/dnode/mgmt/container/src/dndObj.c b/source/dnode/mgmt/container/src/dndObj.c index 9f56ef7206..75a06d5859 100644 --- a/source/dnode/mgmt/container/src/dndObj.c +++ b/source/dnode/mgmt/container/src/dndObj.c @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + #define _DEFAULT_SOURCE #include "dndInt.h" diff --git a/source/dnode/mgmt/main/src/dndMain.c b/source/dnode/mgmt/main/src/dndMain.c index 87aa463e3a..3aff3446da 100644 --- a/source/dnode/mgmt/main/src/dndMain.c +++ b/source/dnode/mgmt/main/src/dndMain.c @@ -28,7 +28,10 @@ static struct { static void dndSigintHandle(int signum, void *info, void *ctx) { dInfo("signal:%d is received", signum); - dndHandleEvent(global.pDnode, DND_EVENT_STOP); + SDnode *pDnode = atomic_val_compare_exchange_ptr(&global.pDnode, 0, global.pDnode); + if (pDnode != NULL) { + dndHandleEvent(pDnode, DND_EVENT_STOP); + } } static void dndSetSignalHandle() { diff --git a/source/dnode/mgmt/mnode/src/mmInt.c b/source/dnode/mgmt/mnode/src/mmInt.c index ad9a2dbd75..a3c2d40510 100644 --- a/source/dnode/mgmt/mnode/src/mmInt.c +++ b/source/dnode/mgmt/mnode/src/mmInt.c @@ -58,7 +58,7 @@ static void mmBuildOptionForDeploy(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { SReplica *pReplica = &pOption->replicas[0]; pReplica->id = 1; pReplica->port = pDnode->serverPort; - memcpy(pReplica->fqdn, pDnode->localFqdn, TSDB_FQDN_LEN); + tstrncpy(pReplica->fqdn, pDnode->localFqdn, TSDB_FQDN_LEN); pMgmt->selfIndex = pOption->selfIndex; pMgmt->replica = pOption->replica; -- GitLab