diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 8196d6fa30..72228be2eb 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -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) { diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 0cf03b7c84..7ebb1f540e 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -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); diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 944363431a..0bc7d666c0 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -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); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 627c4a45e2..ec1e5fed48 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -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; }