update case

This commit is contained in:
Yihao Deng 2024-06-19 12:35:38 +00:00
parent e4916d13a5
commit 01ee8b36a4
3 changed files with 19 additions and 4 deletions

View File

@ -1766,7 +1766,7 @@ static int32_t mndUpdateSuperTableColumnCompress(SMnode *pMnode, const SStbObj *
uint32_t dst = 0; uint32_t dst = 0;
updated = tUpdateCompress(pCmpr->alg, p->bytes, TSDB_COLVAL_COMPRESS_DISABLED, TSDB_COLVAL_LEVEL_DISABLED, updated = tUpdateCompress(pCmpr->alg, p->bytes, TSDB_COLVAL_COMPRESS_DISABLED, TSDB_COLVAL_LEVEL_DISABLED,
TSDB_COLVAL_LEVEL_MEDIUM, &dst); TSDB_COLVAL_LEVEL_MEDIUM, &dst);
if (updated) pCmpr->alg = dst; if (updated > 0) pCmpr->alg = dst;
break; break;
} }
} }
@ -1774,7 +1774,11 @@ static int32_t mndUpdateSuperTableColumnCompress(SMnode *pMnode, const SStbObj *
if (updated == 0) { if (updated == 0) {
terrno = TSDB_CODE_MND_COLUMN_COMPRESS_ALREADY_EXIST; terrno = TSDB_CODE_MND_COLUMN_COMPRESS_ALREADY_EXIST;
return -1; return -1;
} else if (update == -1) {
terrno = TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR;
return -1;
} }
pNew->colVer++; pNew->colVer++;
return 0; return 0;

View File

@ -2240,7 +2240,7 @@ int32_t metaUpdateTableColCompress(SMeta *pMeta, int64_t version, SVAlterTbReq *
uint32_t dst = 0; uint32_t dst = 0;
updated = tUpdateCompress(p->alg, pReq->compress, TSDB_COLVAL_COMPRESS_DISABLED, TSDB_COLVAL_LEVEL_DISABLED, updated = tUpdateCompress(p->alg, pReq->compress, TSDB_COLVAL_COMPRESS_DISABLED, TSDB_COLVAL_LEVEL_DISABLED,
TSDB_COLVAL_LEVEL_MEDIUM, &dst); TSDB_COLVAL_LEVEL_MEDIUM, &dst);
if (updated) { if (updated > 0) {
p->alg = dst; p->alg = dst;
} }
} }
@ -2250,6 +2250,11 @@ int32_t metaUpdateTableColCompress(SMeta *pMeta, int64_t version, SVAlterTbReq *
tDecoderClear(&dc); tDecoderClear(&dc);
terrno = TSDB_CODE_VND_COLUMN_COMPRESS_ALREADY_EXIST; terrno = TSDB_CODE_VND_COLUMN_COMPRESS_ALREADY_EXIST;
goto _err; goto _err;
} else if (update < 0) {
tdbFree(pVal);
tDecoderClear(&dc);
terrno = TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR;
goto _err;
} }
tbEntry.version = version; tbEntry.version = version;

View File

@ -2953,8 +2953,14 @@ int8_t tUpdateCompress(uint32_t oldCmpr, uint32_t newCmpr, uint8_t l2Disabled, u
} }
if (nlvl != 0 && olvl != nlvl) { if (nlvl != 0 && olvl != nlvl) {
SET_COMPRESS(ol1, ol2, nlvl, *dst); if (update == 0) {
update = 1; if (ol2 == L2_DISABLED) {
update = -1;
}
} else {
SET_COMPRESS(ol1, ol2, nlvl, *dst);
update = 1;
}
} }
return update; return update;