From c575d7a8505a7135ad30d9da262613432460b003 Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Thu, 9 May 2024 10:12:28 +0800 Subject: [PATCH] enh: grant check for dual-replica-ha --- source/dnode/mnode/impl/src/mndDb.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 9bc370c466..9dc06c802c 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -911,6 +911,13 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) { goto _OVER; } + if (createReq.replications == 2) { + if ((terrno = grantCheck(TSDB_GRANT_DUAL_REPLICA_HA)) != 0) { + code = terrno; + goto _OVER; + } + } + if ((code = mndCheckDbEncryptKey(pMnode, &createReq)) != 0) { terrno = code; goto _OVER; @@ -1171,6 +1178,12 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { goto _OVER; } + if (alterReq.replications == 2) { + if ((code = grantCheck(TSDB_GRANT_DUAL_REPLICA_HA)) != 0) { + goto _OVER; + } + } + int32_t numOfTopics = 0; if (mndGetNumOfTopics(pMnode, pDb->name, &numOfTopics) != 0) { goto _OVER;