more code

This commit is contained in:
Hongze Cheng 2024-11-05 17:48:26 +08:00
parent a72c49495b
commit a16fcc5dea
4 changed files with 32 additions and 9 deletions

View File

@ -4546,8 +4546,8 @@ int32_t tSerializeSCompactVgroupsReq(void *buf, int32_t bufLen, SCompactVgroupsR
TSDB_CHECK_CODE(code, lino, _exit);
for (int32_t i = 0; i < taosArrayGetSize(pReq->vgroupIds); ++i) {
int32_t vgid = *(int32_t *)taosArrayGet(pReq->vgroupIds, i);
code = tEncodeI32(&encoder, vgid);
int64_t vgid = *(int64_t *)taosArrayGet(pReq->vgroupIds, i);
code = tEncodeI64v(&encoder, vgid);
TSDB_CHECK_CODE(code, lino, _exit);
}
@ -4588,15 +4588,15 @@ int32_t tDeserializeSCompactVgroupsReq(void *buf, int32_t bufLen, SCompactVgroup
code = tDecodeI32(&decoder, &vgidNum);
TSDB_CHECK_CODE(code, lino, _exit);
pReq->vgroupIds = taosArrayInit(vgidNum, sizeof(int32_t));
pReq->vgroupIds = taosArrayInit(vgidNum, sizeof(int64_t));
if (NULL == pReq->vgroupIds) {
TSDB_CHECK_CODE(code = terrno, lino, _exit);
}
for (int32_t i = 0; i < vgidNum; ++i) {
int32_t vgid;
int64_t vgid;
code = tDecodeI32(&decoder, &vgid);
code = tDecodeI64v(&decoder, &vgid);
TSDB_CHECK_CODE(code, lino, _exit);
if (taosArrayPush(pReq->vgroupIds, &vgid) == NULL) {

View File

@ -1976,7 +1976,7 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED
case DB_OPTION_S3_COMPACT:
pDbOptions->s3Compact = taosStr2Int8(((SToken*)pVal)->z, NULL, 10);
break;
case DB_OPTION_KEEP_TIME_OFFSET:
case DB_OPTION_KEEP_TIME_OFFSET:
pDbOptions->keepTimeOffset = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
break;
case DB_OPTION_ENCRYPT_ALGORITHM:
@ -2117,6 +2117,7 @@ _err:
SNode* createCompactVgroupsStmt(SAstCreateContext* pCxt, SNodeList* vgidList, SNode* pStart, SNode* pEnd) {
CHECK_PARSER_STATUS(pCxt);
CHECK_NAME(checkDbName(pCxt, NULL, true));
SCompactVgroupsStmt* pStmt = NULL;
pCxt->errCode = nodesMakeNode(QUERY_NODE_COMPACT_VGROUPS_STMT, (SNode**)&pStmt);
CHECK_MAKE_NODE(pStmt);

View File

@ -860,7 +860,6 @@ static int32_t collectMetaKeyFromCompactDatabase(SCollectMetaKeyCxt* pCxt, SComp
static int32_t collectMetaKeyFromCompactVgroups(SCollectMetaKeyCxt* pCxt, SCompactVgroupsStmt* pStmt) {
// TODO
ASSERT(0);
return 0;
// return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
}

View File

@ -10436,9 +10436,32 @@ static int32_t translateCompactDb(STranslateContext* pCxt, SCompactDatabaseStmt*
static int32_t translateVgroupList(STranslateContext* pCxt, SNodeList* vgroupList, SArray** ppVgroups) {
int32_t code = TSDB_CODE_SUCCESS;
// TODO
ASSERT(0);
int32_t numOfVgroups = LIST_LENGTH(vgroupList);
(*ppVgroups) = taosArrayInit(numOfVgroups, sizeof(int64_t));
if (NULL == *ppVgroups) {
return terrno;
}
SNode* pNode = NULL;
FOREACH(pNode, vgroupList) {
SValueNode* pVal = (SValueNode*)pNode;
if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) {
code = TSDB_CODE_VND_INVALID_VGROUP_ID;
break;
}
int64_t vgroupId = getBigintFromValueNode(pVal);
if (NULL == taosArrayPush(*ppVgroups, &vgroupId)) {
code = terrno;
break;
}
}
if (code) {
taosArrayDestroy(*ppVgroups);
*ppVgroups = NULL;
}
return code;
}