add enable white list

This commit is contained in:
yihaoDeng 2023-09-01 15:11:25 +08:00
parent 832b78c0e8
commit 5f78c27535
7 changed files with 96 additions and 96 deletions

View File

@ -88,6 +88,7 @@ extern int64_t tsMndLogRetention;
extern int8_t tsGrant; extern int8_t tsGrant;
extern int32_t tsMndGrantMode; extern int32_t tsMndGrantMode;
extern bool tsMndSkipGrant; extern bool tsMndSkipGrant;
extern bool tsEnableWhiteList;
// dnode // dnode
extern int64_t tsDndStart; extern int64_t tsDndStart;

View File

@ -423,7 +423,6 @@ typedef enum ENodeType {
QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL
} ENodeType; } ENodeType;
typedef struct { typedef struct {
int32_t vgId; int32_t vgId;
char* dbFName; char* dbFName;
@ -876,7 +875,7 @@ typedef struct {
int32_t tSerializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq); int32_t tSerializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq);
int32_t tDeserializeSDropUserReq(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 ip;
uint32_t mask; uint32_t mask;
} SIpV4Range; } SIpV4Range;
@ -985,14 +984,12 @@ typedef struct {
int64_t offset; int64_t offset;
} SInterval; } SInterval;
typedef struct STbVerInfo { typedef struct STbVerInfo {
char tbFName[TSDB_TABLE_FNAME_LEN]; char tbFName[TSDB_TABLE_FNAME_LEN];
int32_t sversion; int32_t sversion;
int32_t tversion; int32_t tversion;
} STbVerInfo; } STbVerInfo;
typedef struct { typedef struct {
int32_t code; int32_t code;
int64_t affectedRows; int64_t affectedRows;
@ -1217,11 +1214,11 @@ typedef struct {
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 tSerializeSDbCfgRsp(void* buf, int32_t bufLen, const SDbCfgRsp* pRsp);
int32_t tDeserializeSDbCfgRsp(void* buf, int32_t bufLen, SDbCfgRsp* pRsp); int32_t tDeserializeSDbCfgRsp(void* buf, int32_t bufLen, SDbCfgRsp* pRsp);
int32_t tDeserializeSDbCfgRspImpl(SDecoder* decoder, SDbCfgRsp *pRsp); int32_t tDeserializeSDbCfgRspImpl(SDecoder* decoder, SDbCfgRsp* pRsp);
void tFreeSDbCfgRsp(SDbCfgRsp *pRsp); void tFreeSDbCfgRsp(SDbCfgRsp* pRsp);
typedef struct { typedef struct {
int32_t rowNum; int32_t rowNum;
@ -1278,8 +1275,8 @@ int32_t tDeserializeSDnodeListRsp(void* buf, int32_t bufLen, SDnodeListRsp* pRsp
void tFreeSDnodeListRsp(SDnodeListRsp* pRsp); void tFreeSDnodeListRsp(SDnodeListRsp* pRsp);
typedef struct { typedef struct {
SUseDbRsp *useDbRsp; SUseDbRsp* useDbRsp;
SDbCfgRsp *cfgRsp; SDbCfgRsp* cfgRsp;
} SDbHbRsp; } SDbHbRsp;
typedef struct { typedef struct {
@ -1380,6 +1377,7 @@ typedef struct {
char locale[TD_LOCALE_LEN]; // tsLocale char locale[TD_LOCALE_LEN]; // tsLocale
char charset[TD_LOCALE_LEN]; // tsCharset char charset[TD_LOCALE_LEN]; // tsCharset
int8_t ttlChangeOnWrite; int8_t ttlChangeOnWrite;
int8_t enableWhiteList;
} SClusterCfg; } SClusterCfg;
typedef struct { typedef struct {
@ -2074,12 +2072,11 @@ typedef struct {
int32_t tversion; int32_t tversion;
} SResReadyRsp; } SResReadyRsp;
typedef struct SOperatorParam { typedef struct SOperatorParam {
int32_t opType; int32_t opType;
int32_t downstreamIdx; int32_t downstreamIdx;
void* value; void* value;
SArray* pChildren; //SArray<SOperatorParam*> SArray* pChildren; // SArray<SOperatorParam*>
} SOperatorParam; } SOperatorParam;
typedef struct STableScanOperatorParam { typedef struct STableScanOperatorParam {
@ -2173,7 +2170,6 @@ typedef struct {
int32_t tSerializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); int32_t tSerializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq);
int32_t tDeserializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq); int32_t tDeserializeSTaskDropReq(void* buf, int32_t bufLen, STaskDropReq* pReq);
typedef enum { typedef enum {
TASK_NOTIFY_FINISHED = 1, TASK_NOTIFY_FINISHED = 1,
} ETaskNotifyType; } ETaskNotifyType;
@ -3081,7 +3077,7 @@ typedef struct {
int64_t suid; int64_t suid;
} SMqRebVgReq; } 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 (tStartEncode(pCoder) < 0) return -1;
if (tEncodeI64(pCoder, pReq->leftForVer) < 0) return -1; if (tEncodeI64(pCoder, pReq->leftForVer) < 0) return -1;
if (tEncodeI32(pCoder, pReq->vgId) < 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; 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 (tStartDecode(pCoder) < 0) return -1;
if (tDecodeI64(pCoder, &pReq->leftForVer) < 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; if (tDecodeCStr(pCoder, &pReq->qmsg) < 0) return -1;
} else if (pReq->subType == TOPIC_SUB_TYPE__TABLE) { } else if (pReq->subType == TOPIC_SUB_TYPE__TABLE) {
if (tDecodeI64(pCoder, &pReq->suid) < 0) return -1; if (tDecodeI64(pCoder, &pReq->suid) < 0) return -1;
if (!tDecodeIsEnd(pCoder)){ if (!tDecodeIsEnd(pCoder)) {
if (tDecodeCStr(pCoder, &pReq->qmsg) < 0) return -1; if (tDecodeCStr(pCoder, &pReq->qmsg) < 0) return -1;
} }
} }
@ -3641,12 +3637,12 @@ typedef struct {
int32_t vgId; int32_t vgId;
STqOffsetVal offset; STqOffsetVal offset;
int64_t rows; int64_t rows;
}OffsetRows; } OffsetRows;
typedef struct{ typedef struct {
char topicName[TSDB_TOPIC_FNAME_LEN]; char topicName[TSDB_TOPIC_FNAME_LEN];
SArray* offsetRows; SArray* offsetRows;
}TopicOffsetRows; } TopicOffsetRows;
typedef struct { typedef struct {
int64_t consumerId; int64_t consumerId;
@ -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 tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq);
int32_t tDeatroySMqHbReq(SMqHbReq* pReq); int32_t tDeatroySMqHbReq(SMqHbReq* pReq);
int32_t tSerializeSMqSeekReq(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); int32_t tDeserializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq);
#define SUBMIT_REQ_AUTO_CREATE_TABLE 0x1 #define SUBMIT_REQ_AUTO_CREATE_TABLE 0x1
#define SUBMIT_REQ_COLUMN_DATA_FORMAT 0x2 #define SUBMIT_REQ_COLUMN_DATA_FORMAT 0x2

View File

@ -81,6 +81,7 @@ int64_t tsMndLogRetention = 2000;
int8_t tsGrant = 1; int8_t tsGrant = 1;
int32_t tsMndGrantMode = 0; int32_t tsMndGrantMode = 0;
bool tsMndSkipGrant = false; bool tsMndSkipGrant = false;
bool tsEnableWhiteList = false; // ip white list cfg
// dnode // dnode
int64_t tsDndStart = 0; 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, if (cfgAddInt64(pCfg, "minDiskFreeSize", tsMinDiskFreeSize, TFS_MIN_DISK_FREE_SIZE, 1024 * 1024 * 1024,
CFG_SCOPE_SERVER) != 0) CFG_SCOPE_SERVER) != 0)
return -1; return -1;
if (cfgAddBool(pCfg, "enableWhiteList", tsEnableWhiteList, CFG_SCOPE_SERVER) != 0) return -1;
GRANT_CFG_ADD; GRANT_CFG_ADD;
return 0; return 0;
@ -1047,6 +1049,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMndLogRetention = cfgGetItem(pCfg, "mndLogRetention")->i64; tsMndLogRetention = cfgGetItem(pCfg, "mndLogRetention")->i64;
tsMndSkipGrant = cfgGetItem(pCfg, "skipGrant")->bval; tsMndSkipGrant = cfgGetItem(pCfg, "skipGrant")->bval;
tsMndGrantMode = cfgGetItem(pCfg, "grantMode")->i32; tsMndGrantMode = cfgGetItem(pCfg, "grantMode")->i32;
tsEnableWhiteList = cfgGetItem(pCfg, "enableWhiteList")->bval;
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs)); tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs));

View File

@ -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.timezone) < 0) return -1;
if (tEncodeCStr(&encoder, pReq->clusterCfg.locale) < 0) return -1; if (tEncodeCStr(&encoder, pReq->clusterCfg.locale) < 0) return -1;
if (tEncodeCStr(&encoder, pReq->clusterCfg.charset) < 0) return -1; if (tEncodeCStr(&encoder, pReq->clusterCfg.charset) < 0) return -1;
if (tEncodeI8(&encoder, pReq->clusterCfg.enableWhiteList) < 0) return -1;
// vnode loads // vnode loads
int32_t vlen = (int32_t)taosArrayGetSize(pReq->pVloads); 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.timezone) < 0) return -1;
if (tDecodeCStrTo(&decoder, pReq->clusterCfg.locale) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->clusterCfg.locale) < 0) return -1;
if (tDecodeCStrTo(&decoder, pReq->clusterCfg.charset) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->clusterCfg.charset) < 0) return -1;
if (tDecodeI8(&decoder, &pReq->clusterCfg.enableWhiteList) < 0) return -1;
// vnode loads // vnode loads
int32_t vlen = 0; int32_t vlen = 0;
@ -1416,9 +1418,7 @@ int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pR
return 0; return 0;
} }
void tFreeSCreateUserReq(SCreateUserReq* pReq) { void tFreeSCreateUserReq(SCreateUserReq *pReq) { taosMemoryFree(pReq->pIpRanges); }
taosMemoryFree(pReq->pIpRanges);
}
int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) { int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) {
SEncoder encoder = {0}; SEncoder encoder = {0};
@ -4761,7 +4761,7 @@ int32_t tDeserializeSAlterVnodeReplicaReq(void *buf, int32_t bufLen, SAlterVnode
if (tDecodeSReplica(&decoder, pReplica) < 0) return -1; if (tDecodeSReplica(&decoder, pReplica) < 0) return -1;
} }
} }
if (!tDecodeIsEnd(&decoder)){ if (!tDecodeIsEnd(&decoder)) {
if (tDecodeI32(&decoder, &pReq->changeVersion) < 0) return -1; if (tDecodeI32(&decoder, &pReq->changeVersion) < 0) return -1;
} }
@ -5632,17 +5632,17 @@ void tFreeSSubQueryMsg(SSubQueryMsg *pReq) {
taosMemoryFreeClear(pReq->msg); 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->opType) < 0) return -1;
if (tEncodeI32(pEncoder, pOpParam->downstreamIdx) < 0) return -1; if (tEncodeI32(pEncoder, pOpParam->downstreamIdx) < 0) return -1;
switch (pOpParam->opType) { switch (pOpParam->opType) {
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: { 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; if (tEncodeI8(pEncoder, pScan->tableSeq) < 0) return -1;
int32_t uidNum = taosArrayGetSize(pScan->pUidList); int32_t uidNum = taosArrayGetSize(pScan->pUidList);
if (tEncodeI32(pEncoder, uidNum) < 0) return -1; if (tEncodeI32(pEncoder, uidNum) < 0) return -1;
for (int32_t m = 0; m < uidNum; ++m) { 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; if (tEncodeI64(pEncoder, *pUid) < 0) return -1;
} }
break; break;
@ -5654,21 +5654,21 @@ int32_t tSerializeSOperatorParam(SEncoder* pEncoder, SOperatorParam* pOpParam) {
int32_t n = taosArrayGetSize(pOpParam->pChildren); int32_t n = taosArrayGetSize(pOpParam->pChildren);
if (tEncodeI32(pEncoder, n) < 0) return -1; if (tEncodeI32(pEncoder, n) < 0) return -1;
for (int32_t i = 0; i < n; ++i) { 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; if (tSerializeSOperatorParam(pEncoder, pChild) < 0) return -1;
} }
return 0; 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->opType) < 0) return -1;
if (tDecodeI32(pDecoder, &pOpParam->downstreamIdx) < 0) return -1; if (tDecodeI32(pDecoder, &pOpParam->downstreamIdx) < 0) return -1;
switch (pOpParam->opType) { switch (pOpParam->opType) {
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: { case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: {
STableScanOperatorParam* pScan = taosMemoryMalloc(sizeof(STableScanOperatorParam)); STableScanOperatorParam *pScan = taosMemoryMalloc(sizeof(STableScanOperatorParam));
if (NULL == pScan) return -1; 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; int32_t uidNum = 0;
int64_t uid = 0; int64_t uid = 0;
if (tDecodeI32(pDecoder, &uidNum) < 0) return -1; if (tDecodeI32(pDecoder, &uidNum) < 0) return -1;
@ -5695,7 +5695,7 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam* pOpParam)
pOpParam->pChildren = taosArrayInit(childrenNum, POINTER_BYTES); pOpParam->pChildren = taosArrayInit(childrenNum, POINTER_BYTES);
if (NULL == pOpParam->pChildren) return -1; if (NULL == pOpParam->pChildren) return -1;
for (int32_t i = 0; i < childrenNum; ++i) { 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 (NULL == pChild) return -1;
if (tDeserializeSOperatorParam(pDecoder, pChild) < 0) return -1; if (tDeserializeSOperatorParam(pDecoder, pChild) < 0) return -1;
taosArrayPush(pOpParam->pChildren, &pChild); taosArrayPush(pOpParam->pChildren, &pChild);
@ -5707,7 +5707,6 @@ int32_t tDeserializeSOperatorParam(SDecoder *pDecoder, SOperatorParam* pOpParam)
return 0; return 0;
} }
int32_t tSerializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) { int32_t tSerializeSResFetchReq(void *buf, int32_t bufLen, SResFetchReq *pReq) {
int32_t headLen = sizeof(SMsgHead); int32_t headLen = sizeof(SMsgHead);
if (buf != NULL) { if (buf != NULL) {
@ -5956,7 +5955,7 @@ int32_t tDeserializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pR
if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1; if (tDecodeU64(&decoder, &pReq->taskId) < 0) return -1;
if (tDecodeI64(&decoder, &pReq->refId) < 0) return -1; if (tDecodeI64(&decoder, &pReq->refId) < 0) return -1;
if (tDecodeI32(&decoder, &pReq->execId) < 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); tEndDecode(&decoder);
@ -5964,7 +5963,6 @@ int32_t tDeserializeSTaskNotifyReq(void *buf, int32_t bufLen, STaskNotifyReq *pR
return 0; return 0;
} }
int32_t tSerializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp) { int32_t tSerializeSQueryTableRsp(void *buf, int32_t bufLen, SQueryTableRsp *pRsp) {
SEncoder encoder = {0}; SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen); tEncoderInit(&encoder, buf, bufLen);

View File

@ -91,6 +91,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
req.clusterCfg.statusInterval = tsStatusInterval; req.clusterCfg.statusInterval = tsStatusInterval;
req.clusterCfg.checkTime = 0; req.clusterCfg.checkTime = 0;
req.clusterCfg.ttlChangeOnWrite = tsTtlChangeOnWrite; req.clusterCfg.ttlChangeOnWrite = tsTtlChangeOnWrite;
req.clusterCfg.enableWhiteList = tsEnableWhiteList ? 1 : 0;
char timestr[32] = "1970-01-01 00:00:00.00"; 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); (void)taosParseTime(timestr, &req.clusterCfg.checkTime, (int32_t)strlen(timestr), TSDB_TIME_PRECISION_MILLI, 0);
memcpy(req.clusterCfg.timezone, tsTimezoneStr, TD_TIMEZONE_LEN); memcpy(req.clusterCfg.timezone, tsTimezoneStr, TD_TIMEZONE_LEN);

View File

@ -136,6 +136,7 @@ typedef enum {
DND_REASON_LOCALE_NOT_MATCH, DND_REASON_LOCALE_NOT_MATCH,
DND_REASON_CHARSET_NOT_MATCH, DND_REASON_CHARSET_NOT_MATCH,
DND_REASON_TTL_CHANGE_ON_WRITE_NOT_MATCH, DND_REASON_TTL_CHANGE_ON_WRITE_NOT_MATCH,
DND_REASON_ENABLE_WHITELIST_NOT_MATCH,
DND_REASON_OTHERS DND_REASON_OTHERS
} EDndReason; } EDndReason;

View File

@ -15,6 +15,8 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "mndDnode.h" #include "mndDnode.h"
#include "audit.h"
#include "mndCluster.h"
#include "mndDb.h" #include "mndDb.h"
#include "mndMnode.h" #include "mndMnode.h"
#include "mndPrivilege.h" #include "mndPrivilege.h"
@ -25,8 +27,6 @@
#include "mndUser.h" #include "mndUser.h"
#include "mndVgroup.h" #include "mndVgroup.h"
#include "tmisce.h" #include "tmisce.h"
#include "mndCluster.h"
#include "audit.h"
#define TSDB_DNODE_VER_NUMBER 2 #define TSDB_DNODE_VER_NUMBER 2
#define TSDB_DNODE_RESERVE_SIZE 64 #define TSDB_DNODE_RESERVE_SIZE 64
@ -421,6 +421,11 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, SDnodeObj *pDnode, const S
tsTtlChangeOnWrite); tsTtlChangeOnWrite);
return DND_REASON_TTL_CHANGE_ON_WRITE_NOT_MATCH; 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; return 0;
} }
@ -926,14 +931,10 @@ _OVER:
extern int32_t mndProcessRestoreDnodeReqImpl(SRpcMsg *pReq); extern int32_t mndProcessRestoreDnodeReqImpl(SRpcMsg *pReq);
int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq){ int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq) { return mndProcessRestoreDnodeReqImpl(pReq); }
return mndProcessRestoreDnodeReqImpl(pReq);
}
#ifndef TD_ENTERPRISE #ifndef TD_ENTERPRISE
int32_t mndProcessRestoreDnodeReqImpl(SRpcMsg *pReq){ int32_t mndProcessRestoreDnodeReqImpl(SRpcMsg *pReq) { return 0; }
return 0;
}
#endif #endif
static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SMnodeObj *pMObj, SQnodeObj *pQObj, 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; goto _OVER;
} }
mInfo("dnode:%d, start to drop, ep:%s:%d, force:%s, unsafe:%s", mInfo("dnode:%d, start to drop, ep:%s:%d, force:%s, unsafe:%s", dropReq.dnodeId, dropReq.fqdn, dropReq.port,
dropReq.dnodeId, dropReq.fqdn, dropReq.port, dropReq.force?"true":"false", dropReq.unsafe?"true":"false"); dropReq.force ? "true" : "false", dropReq.unsafe ? "true" : "false");
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_MNODE) != 0) { if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_MNODE) != 0) {
goto _OVER; goto _OVER;
} }
bool force = dropReq.force; bool force = dropReq.force;
if(dropReq.unsafe) if (dropReq.unsafe) {
{
force = true; force = true;
} }
@ -1065,8 +1065,8 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
char obj1[30] = {0}; char obj1[30] = {0};
sprintf(obj1, "%d", dropReq.dnodeId); sprintf(obj1, "%d", dropReq.dnodeId);
//char obj2[150] = {0}; // char obj2[150] = {0};
//sprintf(obj2, "%s:%d", dropReq.fqdn, dropReq.port); // sprintf(obj2, "%s:%d", dropReq.fqdn, dropReq.port);
char detail[100] = {0}; char detail[100] = {0};
sprintf(detail, "force:%d, unsafe:%d", dropReq.force, dropReq.unsafe); 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 (code < 0) return code;
if (flag < 0) { if (flag < 0) {
mError("dnode:%d, failed to config ttlBatchDropNum since value:%d. Valid range: [0, %d]", cfgReq.dnodeId, mError("dnode:%d, failed to config ttlBatchDropNum since value:%d. Valid range: [0, %d]", cfgReq.dnodeId, flag,
flag, INT32_MAX); INT32_MAX);
terrno = TSDB_CODE_INVALID_CFG; terrno = TSDB_CODE_INVALID_CFG;
return -1; return -1;
} }