From cc932b5ac9fd33d02d83b7e7248775e14f4e3bb6 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Tue, 21 Nov 2023 17:01:24 +0800 Subject: [PATCH] fix: change compact id to 32-bit int --- include/common/tmsg.h | 4 ++-- source/common/src/tmsg.c | 8 ++++---- source/libs/parser/src/parTranslater.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index db62bb8831..8a56c2fad4 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1383,7 +1383,7 @@ int32_t tDeserializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq void tFreeSCompactDbReq(SCompactDbReq *pReq); typedef struct { - int64_t compactId; + int32_t compactId; int8_t bAccepted; } SCompactDbRsp; @@ -1391,7 +1391,7 @@ int32_t tSerializeSCompactDbRsp(void* buf, int32_t bufLen, SCompactDbRsp* pRsp); int32_t tDeserializeSCompactDbRsp(void* buf, int32_t bufLen, SCompactDbRsp* pRsp); typedef struct { - int64_t compactId; + int32_t compactId; } SKillCompactReq; int32_t tSerializeSKillCompactReq(void* buf, int32_t bufLen, SKillCompactReq* pReq); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 8bc9889d35..61cb294026 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -3444,7 +3444,7 @@ int32_t tSerializeSCompactDbRsp(void *buf, int32_t bufLen, SCompactDbRsp *pRsp) tEncoderInit(&encoder, buf, bufLen); if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->compactId) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->compactId) < 0) return -1; if (tEncodeI8(&encoder, pRsp->bAccepted) < 0) return -1; tEndEncode(&encoder); @@ -3458,7 +3458,7 @@ int32_t tDeserializeSCompactDbRsp(void *buf, int32_t bufLen, SCompactDbRsp *pRsp tDecoderInit(&decoder, buf, bufLen); if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->compactId) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->compactId) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->bAccepted) < 0) return -1; tEndDecode(&decoder); @@ -3471,7 +3471,7 @@ int32_t tSerializeSKillCompactReq(void *buf, int32_t bufLen, SKillCompactReq *pR tEncoderInit(&encoder, buf, bufLen); if (tStartEncode(&encoder) < 0) return -1; - if (tEncodeI64(&encoder, pRsp->compactId) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->compactId) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -3484,7 +3484,7 @@ int32_t tDeserializeSKillCompactReq(void *buf, int32_t bufLen, SKillCompactReq * tDecoderInit(&decoder, buf, bufLen); if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->compactId) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->compactId) < 0) return -1; tEndDecode(&decoder); tDecoderClear(&decoder); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 126974bb40..e095e7babc 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -8743,8 +8743,8 @@ static int32_t extractCompactDbResultSchema(int32_t* numOfCols, SSchema** pSchem (*pSchema)[0].bytes = COMPACT_DB_RESULT_FIELD1_LEN; strcpy((*pSchema)[0].name, "name"); - (*pSchema)[1].type = TSDB_DATA_TYPE_BIGINT; - (*pSchema)[1].bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; + (*pSchema)[1].type = TSDB_DATA_TYPE_INT; + (*pSchema)[1].bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes; strcpy((*pSchema)[1].name, "id"); (*pSchema)[2].type = TSDB_DATA_TYPE_BINARY;