feat: alter stt_trigger and minrows

This commit is contained in:
Hongze Cheng 2023-03-09 15:25:47 +08:00
parent b1d21472ed
commit 16262512b2
5 changed files with 28 additions and 1 deletions

View File

@ -1316,6 +1316,9 @@ typedef struct {
int8_t strict;
int8_t cacheLast;
int64_t reserved[8];
// 1.0 modification
int16_t sttTrigger;
int32_t minRows;
} SAlterVnodeConfigReq;
int32_t tSerializeSAlterVnodeConfigReq(void* buf, int32_t bufLen, SAlterVnodeConfigReq* pReq);

View File

@ -4172,6 +4172,11 @@ int32_t tSerializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeCon
for (int32_t i = 0; i < 8; ++i) {
if (tEncodeI64(&encoder, pReq->reserved[i]) < 0) return -1;
}
// 1.0 modification
if (tEncodeI16(&encoder, pReq->sttTrigger) < 0) return -1;
if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1;
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
@ -4201,6 +4206,15 @@ int32_t tDeserializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeC
if (tDecodeI64(&decoder, &pReq->reserved[i]) < 0) return -1;
}
// 1.0 modification
if (tDecodeIsEnd(&decoder)) {
pReq->sttTrigger = -1;
pReq->minRows = -1;
} else {
if (tDecodeI16(&decoder, &pReq->sttTrigger) < 0) return -1;
if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1;
}
tEndDecode(&decoder);
tDecoderClear(&decoder);
return 0;

View File

@ -543,7 +543,7 @@ void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer
typedef struct {
int32_t vgId;
char* qmsg; //SubPlanToString
char* qmsg; // SubPlanToString
SEpSet epSet;
} SMqVgEp;

View File

@ -319,6 +319,8 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV
alterReq.walLevel = pDb->cfg.walLevel;
alterReq.strict = pDb->cfg.strict;
alterReq.cacheLast = pDb->cfg.cacheLast;
alterReq.sttTrigger = pDb->cfg.sstTrigger;
alterReq.minRows = pDb->cfg.minRows;
mInfo("vgId:%d, build alter vnode config req", pVgroup->vgId);
int32_t contLen = tSerializeSAlterVnodeConfigReq(NULL, 0, &alterReq);

View File

@ -1541,6 +1541,14 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void
}
}
if (req.sttTrigger != -1 && req.sttTrigger != pVnode->config.sttTrigger) {
pVnode->config.sttTrigger = req.sttTrigger;
}
if (req.minRows != -1 && req.minRows != pVnode->config.tsdbCfg.minRows) {
pVnode->config.tsdbCfg.minRows = req.minRows;
}
if (walChanged) {
walAlter(pVnode->pWal, &pVnode->config.walCfg);
}