Merge pull request #22216 from taosdata/fix/TD-24937
enh/TD-24937:check cluster ttlChangeOnWrite consistency
This commit is contained in:
commit
5ca52ce74d
|
@ -1144,6 +1144,7 @@ typedef struct {
|
||||||
char timezone[TD_TIMEZONE_LEN]; // tsTimezone
|
char timezone[TD_TIMEZONE_LEN]; // tsTimezone
|
||||||
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;
|
||||||
} SClusterCfg;
|
} SClusterCfg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -1103,6 +1103,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
|
||||||
if (tEncodeI32(&encoder, pReq->statusSeq) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->statusSeq) < 0) return -1;
|
||||||
if (tEncodeI64(&encoder, pReq->mload.syncTerm) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->mload.syncTerm) < 0) return -1;
|
||||||
if (tEncodeI64(&encoder, pReq->mload.roleTimeMs) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->mload.roleTimeMs) < 0) return -1;
|
||||||
|
if (tEncodeI8(&encoder, pReq->clusterCfg.ttlChangeOnWrite) < 0) return -1;
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -1192,6 +1193,12 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
|
||||||
if (tDecodeI64(&decoder, &pReq->mload.syncTerm) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->mload.syncTerm) < 0) return -1;
|
||||||
if (tDecodeI64(&decoder, &pReq->mload.roleTimeMs) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->mload.roleTimeMs) < 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pReq->clusterCfg.ttlChangeOnWrite = false;
|
||||||
|
if (!tDecodeIsEnd(&decoder)) {
|
||||||
|
if (tDecodeI8(&decoder, &pReq->clusterCfg.ttlChangeOnWrite) < 0) return -1;
|
||||||
|
}
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -90,6 +90,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;
|
||||||
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);
|
||||||
|
|
|
@ -133,6 +133,7 @@ typedef enum {
|
||||||
DND_REASON_TIME_ZONE_NOT_MATCH,
|
DND_REASON_TIME_ZONE_NOT_MATCH,
|
||||||
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_OTHERS
|
DND_REASON_OTHERS
|
||||||
} EDndReason;
|
} EDndReason;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ static const char *offlineReason[] = {
|
||||||
"timezone not match",
|
"timezone not match",
|
||||||
"locale not match",
|
"locale not match",
|
||||||
"charset not match",
|
"charset not match",
|
||||||
|
"ttl change on write not match"
|
||||||
"unknown",
|
"unknown",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -414,6 +415,12 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, SDnodeObj *pDnode, const S
|
||||||
return DND_REASON_CHARSET_NOT_MATCH;
|
return DND_REASON_CHARSET_NOT_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pCfg->ttlChangeOnWrite != tsTtlChangeOnWrite) {
|
||||||
|
mError("dnode:%d, ttlChangeOnWrite:%d inconsistent with cluster:%d", pDnode->id, pCfg->ttlChangeOnWrite,
|
||||||
|
tsTtlChangeOnWrite);
|
||||||
|
return DND_REASON_TTL_CHANGE_ON_WRITE_NOT_MATCH;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue