diff --git a/include/common/tglobal.h b/include/common/tglobal.h index d7a3d84424..1c5510ba0d 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -88,6 +88,7 @@ extern int64_t tsMndLogRetention; extern int8_t tsGrant; extern int32_t tsMndGrantMode; extern bool tsMndSkipGrant; +extern bool tsEnableWhiteList; // dnode extern int64_t tsDndStart; diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 5e039f9ced..bb843ced91 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -420,10 +420,9 @@ typedef enum ENodeType { QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN, QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE, - QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL + QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL } ENodeType; - typedef struct { int32_t vgId; char* dbFName; @@ -876,19 +875,19 @@ typedef struct { int32_t tSerializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq); int32_t tDeserializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq); -typedef struct SIpV4Range{ +typedef struct SIpV4Range { uint32_t ip; uint32_t mask; } SIpV4Range; typedef struct { - int8_t createType; - int8_t superUser; // denote if it is a super user or not - int8_t sysInfo; - int8_t enable; - char user[TSDB_USER_LEN]; - char pass[TSDB_USET_PASSWORD_LEN]; - int32_t numIpRanges; + int8_t createType; + int8_t superUser; // denote if it is a super user or not + int8_t sysInfo; + int8_t enable; + char user[TSDB_USER_LEN]; + char pass[TSDB_USET_PASSWORD_LEN]; + int32_t numIpRanges; SIpV4Range* pIpRanges; } SCreateUserReq; @@ -897,17 +896,17 @@ int32_t tDeserializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pR void tFreeSCreateUserReq(SCreateUserReq* pReq); typedef struct { - int8_t alterType; - int8_t superUser; - int8_t sysInfo; - int8_t enable; - char user[TSDB_USER_LEN]; - char pass[TSDB_USET_PASSWORD_LEN]; - char objname[TSDB_DB_FNAME_LEN]; // db or topic - char tabName[TSDB_TABLE_NAME_LEN]; - char* tagCond; - int32_t tagCondLen; - int32_t numIpRanges; + int8_t alterType; + int8_t superUser; + int8_t sysInfo; + int8_t enable; + char user[TSDB_USER_LEN]; + char pass[TSDB_USET_PASSWORD_LEN]; + char objname[TSDB_DB_FNAME_LEN]; // db or topic + char tabName[TSDB_TABLE_NAME_LEN]; + char* tagCond; + int32_t tagCondLen; + int32_t numIpRanges; SIpV4Range* pIpRanges; } SAlterUserReq; @@ -985,14 +984,12 @@ typedef struct { int64_t offset; } SInterval; - typedef struct STbVerInfo { char tbFName[TSDB_TABLE_FNAME_LEN]; int32_t sversion; int32_t tversion; } STbVerInfo; - typedef struct { int32_t code; int64_t affectedRows; @@ -1215,13 +1212,13 @@ typedef struct { int16_t sstTrigger; } SDbCfgRsp; -typedef SDbCfgRsp SDbCfgInfo; +typedef SDbCfgRsp SDbCfgInfo; -int32_t tSerializeSDbCfgRspImpl(SEncoder *encoder, const SDbCfgRsp *pRsp); +int32_t tSerializeSDbCfgRspImpl(SEncoder* encoder, const SDbCfgRsp* pRsp); int32_t tSerializeSDbCfgRsp(void* buf, int32_t bufLen, const SDbCfgRsp* pRsp); int32_t tDeserializeSDbCfgRsp(void* buf, int32_t bufLen, SDbCfgRsp* pRsp); -int32_t tDeserializeSDbCfgRspImpl(SDecoder* decoder, SDbCfgRsp *pRsp); -void tFreeSDbCfgRsp(SDbCfgRsp *pRsp); +int32_t tDeserializeSDbCfgRspImpl(SDecoder* decoder, SDbCfgRsp* pRsp); +void tFreeSDbCfgRsp(SDbCfgRsp* pRsp); typedef struct { int32_t rowNum; @@ -1278,8 +1275,8 @@ int32_t tDeserializeSDnodeListRsp(void* buf, int32_t bufLen, SDnodeListRsp* pRsp void tFreeSDnodeListRsp(SDnodeListRsp* pRsp); typedef struct { - SUseDbRsp *useDbRsp; - SDbCfgRsp *cfgRsp; + SUseDbRsp* useDbRsp; + SDbCfgRsp* cfgRsp; } SDbHbRsp; typedef struct { @@ -1380,6 +1377,7 @@ typedef struct { char locale[TD_LOCALE_LEN]; // tsLocale char charset[TD_LOCALE_LEN]; // tsCharset int8_t ttlChangeOnWrite; + int8_t enableWhiteList; } SClusterCfg; typedef struct { @@ -1414,7 +1412,7 @@ typedef struct { int64_t numOfBatchInsertReqs; int64_t numOfBatchInsertSuccessReqs; int32_t numOfCachedTables; - int32_t learnerProgress; // use one reservered + int32_t learnerProgress; // use one reservered } SVnodeLoad; typedef struct { @@ -2074,17 +2072,16 @@ typedef struct { int32_t tversion; } SResReadyRsp; - typedef struct SOperatorParam { - int32_t opType; - int32_t downstreamIdx; - void* value; - SArray* pChildren; //SArray + int32_t opType; + int32_t downstreamIdx; + void* value; + SArray* pChildren; // SArray } SOperatorParam; typedef struct STableScanOperatorParam { - bool tableSeq; - SArray* pUidList; + bool tableSeq; + SArray* pUidList; } STableScanOperatorParam; typedef struct { @@ -2173,7 +2170,6 @@ typedef struct { int32_t tSerializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); int32_t tDeserializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); - typedef enum { TASK_NOTIFY_FINISHED = 1, } ETaskNotifyType; @@ -2297,10 +2293,10 @@ typedef struct { char clientId[256]; SArray* topicNames; // SArray - int8_t withTbName; - int8_t autoCommit; - int32_t autoCommitInterval; - int8_t resetOffsetCfg; + int8_t withTbName; + int8_t autoCommit; + int32_t autoCommitInterval; + int8_t resetOffsetCfg; } SCMSubscribeReq; static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubscribeReq* pReq) { @@ -2677,7 +2673,7 @@ typedef struct { int32_t newTTL; int32_t newCommentLen; char* newComment; - int64_t ctimeMs; // fill by vnode + int64_t ctimeMs; // fill by vnode } SVAlterTbReq; int32_t tEncodeSVAlterTbReq(SEncoder* pEncoder, const SVAlterTbReq* pReq); @@ -3081,7 +3077,7 @@ typedef struct { int64_t suid; } SMqRebVgReq; -static FORCE_INLINE int tEncodeSMqRebVgReq(SEncoder *pCoder, const SMqRebVgReq* pReq) { +static FORCE_INLINE int tEncodeSMqRebVgReq(SEncoder* pCoder, const SMqRebVgReq* pReq) { if (tStartEncode(pCoder) < 0) return -1; if (tEncodeI64(pCoder, pReq->leftForVer) < 0) return -1; if (tEncodeI32(pCoder, pReq->vgId) < 0) return -1; @@ -3101,7 +3097,7 @@ static FORCE_INLINE int tEncodeSMqRebVgReq(SEncoder *pCoder, const SMqRebVgReq* return 0; } -static FORCE_INLINE int tDecodeSMqRebVgReq(SDecoder *pCoder, SMqRebVgReq* pReq) { +static FORCE_INLINE int tDecodeSMqRebVgReq(SDecoder* pCoder, SMqRebVgReq* pReq) { if (tStartDecode(pCoder) < 0) return -1; if (tDecodeI64(pCoder, &pReq->leftForVer) < 0) return -1; @@ -3117,7 +3113,7 @@ static FORCE_INLINE int tDecodeSMqRebVgReq(SDecoder *pCoder, SMqRebVgReq* pReq) if (tDecodeCStr(pCoder, &pReq->qmsg) < 0) return -1; } else if (pReq->subType == TOPIC_SUB_TYPE__TABLE) { if (tDecodeI64(pCoder, &pReq->suid) < 0) return -1; - if (!tDecodeIsEnd(pCoder)){ + if (!tDecodeIsEnd(pCoder)) { if (tDecodeCStr(pCoder, &pReq->qmsg) < 0) return -1; } } @@ -3641,12 +3637,12 @@ typedef struct { int32_t vgId; STqOffsetVal offset; int64_t rows; -}OffsetRows; +} OffsetRows; -typedef struct{ - char topicName[TSDB_TOPIC_FNAME_LEN]; - SArray* offsetRows; -}TopicOffsetRows; +typedef struct { + char topicName[TSDB_TOPIC_FNAME_LEN]; + SArray* offsetRows; +} TopicOffsetRows; typedef struct { int64_t consumerId; @@ -3659,9 +3655,9 @@ typedef struct { } SMqHbRsp; typedef struct { - SMsgHead head; - int64_t consumerId; - char subKey[TSDB_SUBSCRIBE_KEY_LEN]; + SMsgHead head; + int64_t consumerId; + char subKey[TSDB_SUBSCRIBE_KEY_LEN]; } SMqSeekReq; #define TD_AUTO_CREATE_TABLE 0x1 @@ -3715,7 +3711,7 @@ typedef struct SDeleteRes { int64_t affectedRows; char tableFName[TSDB_TABLE_NAME_LEN]; char tsColName[TSDB_COL_NAME_LEN]; - int64_t ctimeMs; // fill by vnode + int64_t ctimeMs; // fill by vnode } SDeleteRes; int32_t tEncodeDeleteRes(SEncoder* pCoder, const SDeleteRes* pRes); @@ -3793,8 +3789,8 @@ int32_t tSerializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq); int32_t tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq); int32_t tDeatroySMqHbReq(SMqHbReq* pReq); -int32_t tSerializeSMqSeekReq(void *buf, int32_t bufLen, SMqSeekReq *pReq); -int32_t tDeserializeSMqSeekReq(void *buf, int32_t bufLen, SMqSeekReq *pReq); +int32_t tSerializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq); +int32_t tDeserializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq); #define SUBMIT_REQ_AUTO_CREATE_TABLE 0x1 #define SUBMIT_REQ_COLUMN_DATA_FORMAT 0x2 @@ -3809,7 +3805,7 @@ typedef struct { SArray* aRowP; SArray* aCol; }; - int64_t ctimeMs; + int64_t ctimeMs; } SSubmitTbData; typedef struct { diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index ff9e922ee1..8971c1312c 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -81,6 +81,7 @@ int64_t tsMndLogRetention = 2000; int8_t tsGrant = 1; int32_t tsMndGrantMode = 0; bool tsMndSkipGrant = false; +bool tsEnableWhiteList = false; // ip white list cfg // dnode int64_t tsDndStart = 0; @@ -659,6 +660,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt64(pCfg, "minDiskFreeSize", tsMinDiskFreeSize, TFS_MIN_DISK_FREE_SIZE, 1024 * 1024 * 1024, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddBool(pCfg, "enableWhiteList", tsEnableWhiteList, CFG_SCOPE_SERVER) != 0) return -1; GRANT_CFG_ADD; return 0; @@ -1047,6 +1049,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsMndLogRetention = cfgGetItem(pCfg, "mndLogRetention")->i64; tsMndSkipGrant = cfgGetItem(pCfg, "skipGrant")->bval; tsMndGrantMode = cfgGetItem(pCfg, "grantMode")->i32; + tsEnableWhiteList = cfgGetItem(pCfg, "enableWhiteList")->bval; tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs)); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 7bf6520140..0553f73bb3 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1060,6 +1060,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tEncodeCStr(&encoder, pReq->clusterCfg.timezone) < 0) return -1; if (tEncodeCStr(&encoder, pReq->clusterCfg.locale) < 0) return -1; if (tEncodeCStr(&encoder, pReq->clusterCfg.charset) < 0) return -1; + if (tEncodeI8(&encoder, pReq->clusterCfg.enableWhiteList) < 0) return -1; // vnode loads int32_t vlen = (int32_t)taosArrayGetSize(pReq->pVloads); @@ -1147,6 +1148,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tDecodeCStrTo(&decoder, pReq->clusterCfg.timezone) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->clusterCfg.locale) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->clusterCfg.charset) < 0) return -1; + if (tDecodeI8(&decoder, &pReq->clusterCfg.enableWhiteList) < 0) return -1; // vnode loads int32_t vlen = 0; @@ -1416,9 +1418,7 @@ int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pR return 0; } -void tFreeSCreateUserReq(SCreateUserReq* pReq) { - taosMemoryFree(pReq->pIpRanges); -} +void tFreeSCreateUserReq(SCreateUserReq *pReq) { taosMemoryFree(pReq->pIpRanges); } int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) { SEncoder encoder = {0}; @@ -4761,7 +4761,7 @@ int32_t tDeserializeSAlterVnodeReplicaReq(void *buf, int32_t bufLen, SAlterVnode if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; } } - if (!tDecodeIsEnd(&decoder)){ + if (!tDecodeIsEnd(&decoder)) { if (tDecodeI32(&decoder, &pReq->changeVersion) < 0) return -1; } @@ -5632,17 +5632,17 @@ void tFreeSSubQueryMsg(SSubQueryMsg *pReq) { taosMemoryFreeClear(pReq->msg); } -int32_t tSerializeSOperatorParam(SEncoder* pEncoder, SOperatorParam* pOpParam) { +int32_t tSerializeSOperatorParam(SEncoder *pEncoder, SOperatorParam *pOpParam) { if (tEncodeI32(pEncoder, pOpParam->opType) < 0) return -1; if (tEncodeI32(pEncoder, pOpParam->downstreamIdx) < 0) return -1; switch (pOpParam->opType) { case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: { - STableScanOperatorParam* pScan = (STableScanOperatorParam*)pOpParam->value; + STableScanOperatorParam *pScan = (STableScanOperatorParam *)pOpParam->value; if (tEncodeI8(pEncoder, pScan->tableSeq) < 0) return -1; int32_t uidNum = taosArrayGetSize(pScan->pUidList); if (tEncodeI32(pEncoder, uidNum) < 0) return -1; for (int32_t m = 0; m < uidNum; ++m) { - int64_t* pUid = taosArrayGet(pScan->pUidList, m); + int64_t *pUid = taosArrayGet(pScan->pUidList, m); if (tEncodeI64(pEncoder, *pUid) < 0) return -1; } break; @@ -5650,25 +5650,25 @@ int32_t tSerializeSOperatorParam(SEncoder* pEncoder, SOperatorParam* pOpParam) { default: return TSDB_CODE_INVALID_PARA; } - + int32_t n = taosArrayGetSize(pOpParam->pChildren); if (tEncodeI32(pEncoder, n) < 0) return -1; for (int32_t i = 0; i < n; ++i) { - SOperatorParam* pChild = *(SOperatorParam**)taosArrayGet(pOpParam->pChildren, i); + SOperatorParam *pChild = *(SOperatorParam **)taosArrayGet(pOpParam->pChildren, i); if (tSerializeSOperatorParam(pEncoder, pChild) < 0) return -1; } return 0; } -int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam* pOpParam) { +int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam *pOpParam) { if (tDecodeI32(pDecoder, &pOpParam->opType) < 0) return -1; if (tDecodeI32(pDecoder, &pOpParam->downstreamIdx) < 0) return -1; switch (pOpParam->opType) { case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: { - STableScanOperatorParam* pScan = taosMemoryMalloc(sizeof(STableScanOperatorParam)); + STableScanOperatorParam *pScan = taosMemoryMalloc(sizeof(STableScanOperatorParam)); if (NULL == pScan) return -1; - if (tDecodeI8(pDecoder, (int8_t*)&pScan->tableSeq) < 0) return -1; + if (tDecodeI8(pDecoder, (int8_t *)&pScan->tableSeq) < 0) return -1; int32_t uidNum = 0; int64_t uid = 0; if (tDecodeI32(pDecoder, &uidNum) < 0) return -1; @@ -5695,7 +5695,7 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam* pOpParam) pOpParam->pChildren = taosArrayInit(childrenNum, POINTER_BYTES); if (NULL == pOpParam->pChildren) return -1; for (int32_t i = 0; i < childrenNum; ++i) { - SOperatorParam* pChild = taosMemoryCalloc(1, sizeof(SOperatorParam)); + SOperatorParam *pChild = taosMemoryCalloc(1, sizeof(SOperatorParam)); if (NULL == pChild) return -1; if (tDeserializeSOperatorParam(pDecoder, pChild) < 0) return -1; taosArrayPush(pOpParam->pChildren, &pChild); @@ -5707,7 +5707,6 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam* pOpParam) return 0; } - int32_t tSerializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) { int32_t headLen = sizeof(SMsgHead); if (buf != NULL) { @@ -5768,7 +5767,7 @@ int32_t tDeserializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) if (NULL == pReq->pOpParam) return -1; if (tDeserializeSOperatorParam(&decoder, pReq->pOpParam) < 0) return -1; } - + tEndDecode(&decoder); tDecoderClear(&decoder); @@ -5956,7 +5955,7 @@ int32_t tDeserializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pR if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1; if (tDecodeI64(&decoder, &pReq->refId) < 0) return -1; if (tDecodeI32(&decoder, &pReq->execId) < 0) return -1; - if (tDecodeI32(&decoder, (int32_t*)&pReq->type) < 0) return -1; + if (tDecodeI32(&decoder, (int32_t *)&pReq->type) < 0) return -1; tEndDecode(&decoder); @@ -5964,7 +5963,6 @@ int32_t tDeserializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pR return 0; } - int32_t tSerializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); @@ -5982,7 +5980,7 @@ int32_t tSerializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp if (tEncodeI32(&encoder, pVer->tversion) < 0) return -1; } } - + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -6010,7 +6008,7 @@ int32_t tDeserializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pR if (tDecodeI32(&decoder, &tbVer.tversion) < 0) return -1; if (NULL == taosArrayPush(pRsp->tbVerInfo, &tbVer)) return -1; } - + tEndDecode(&decoder); tDecoderClear(&decoder); diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 1bce20ff44..e6b7c0cb68 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -91,6 +91,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { req.clusterCfg.statusInterval = tsStatusInterval; req.clusterCfg.checkTime = 0; req.clusterCfg.ttlChangeOnWrite = tsTtlChangeOnWrite; + req.clusterCfg.enableWhiteList = tsEnableWhiteList ? 1 : 0; char timestr[32] = "1970-01-01 00:00:00.00"; (void)taosParseTime(timestr, &req.clusterCfg.checkTime, (int32_t)strlen(timestr), TSDB_TIME_PRECISION_MILLI, 0); memcpy(req.clusterCfg.timezone, tsTimezoneStr, TD_TIMEZONE_LEN); diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 1bf13c8fb5..90d54e7f58 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -136,6 +136,7 @@ typedef enum { DND_REASON_LOCALE_NOT_MATCH, DND_REASON_CHARSET_NOT_MATCH, DND_REASON_TTL_CHANGE_ON_WRITE_NOT_MATCH, + DND_REASON_ENABLE_WHITELIST_NOT_MATCH, DND_REASON_OTHERS } EDndReason; diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 115c33cff1..a11bd2556e 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -15,6 +15,8 @@ #define _DEFAULT_SOURCE #include "mndDnode.h" +#include "audit.h" +#include "mndCluster.h" #include "mndDb.h" #include "mndMnode.h" #include "mndPrivilege.h" @@ -25,8 +27,6 @@ #include "mndUser.h" #include "mndVgroup.h" #include "tmisce.h" -#include "mndCluster.h" -#include "audit.h" #define TSDB_DNODE_VER_NUMBER 2 #define TSDB_DNODE_RESERVE_SIZE 64 @@ -421,6 +421,11 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, SDnodeObj *pDnode, const S tsTtlChangeOnWrite); return DND_REASON_TTL_CHANGE_ON_WRITE_NOT_MATCH; } + int8_t enable = tsEnableWhiteList ? 1 : 0; + if (pCfg->enableWhiteList != enable) { + mError("dnode:%d, enable :%d inconsistent with cluster:%d", pDnode->id, pCfg->enableWhiteList, enable); + return DND_REASON_ENABLE_WHITELIST_NOT_MATCH; + } return 0; } @@ -926,14 +931,10 @@ _OVER: extern int32_t mndProcessRestoreDnodeReqImpl(SRpcMsg *pReq); -int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq){ - return mndProcessRestoreDnodeReqImpl(pReq); -} +int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq) { return mndProcessRestoreDnodeReqImpl(pReq); } #ifndef TD_ENTERPRISE -int32_t mndProcessRestoreDnodeReqImpl(SRpcMsg *pReq){ - return 0; -} +int32_t mndProcessRestoreDnodeReqImpl(SRpcMsg *pReq) { return 0; } #endif static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SMnodeObj *pMObj, SQnodeObj *pQObj, @@ -1004,15 +1005,14 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) { goto _OVER; } - mInfo("dnode:%d, start to drop, ep:%s:%d, force:%s, unsafe:%s", - dropReq.dnodeId, dropReq.fqdn, dropReq.port, dropReq.force?"true":"false", dropReq.unsafe?"true":"false"); + mInfo("dnode:%d, start to drop, ep:%s:%d, force:%s, unsafe:%s", dropReq.dnodeId, dropReq.fqdn, dropReq.port, + dropReq.force ? "true" : "false", dropReq.unsafe ? "true" : "false"); if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_MNODE) != 0) { goto _OVER; } bool force = dropReq.force; - if(dropReq.unsafe) - { + if (dropReq.unsafe) { force = true; } @@ -1043,19 +1043,19 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) { } int32_t numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id); - bool isonline = mndIsDnodeOnline(pDnode, taosGetTimestampMs()); + bool isonline = mndIsDnodeOnline(pDnode, taosGetTimestampMs()); if (isonline && force) { terrno = TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE; mError("dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d", pDnode->id, terrstr(), - numOfVnodes, pMObj != NULL, pQObj != NULL, pSObj != NULL); + numOfVnodes, pMObj != NULL, pQObj != NULL, pSObj != NULL); goto _OVER; } if (!isonline && !force) { terrno = TSDB_CODE_DNODE_OFFLINE; mError("dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d", pDnode->id, terrstr(), - numOfVnodes, pMObj != NULL, pQObj != NULL, pSObj != NULL); + numOfVnodes, pMObj != NULL, pQObj != NULL, pSObj != NULL); goto _OVER; } @@ -1065,8 +1065,8 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) { char obj1[30] = {0}; sprintf(obj1, "%d", dropReq.dnodeId); - //char obj2[150] = {0}; - //sprintf(obj2, "%s:%d", dropReq.fqdn, dropReq.port); + // char obj2[150] = {0}; + // sprintf(obj2, "%s:%d", dropReq.fqdn, dropReq.port); char detail[100] = {0}; sprintf(detail, "force:%d, unsafe:%d", dropReq.force, dropReq.unsafe); @@ -1164,8 +1164,8 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { if (code < 0) return code; if (flag < 0) { - mError("dnode:%d, failed to config ttlBatchDropNum since value:%d. Valid range: [0, %d]", cfgReq.dnodeId, - flag, INT32_MAX); + mError("dnode:%d, failed to config ttlBatchDropNum since value:%d. Valid range: [0, %d]", cfgReq.dnodeId, flag, + INT32_MAX); terrno = TSDB_CODE_INVALID_CFG; return -1; }