fix:rollback size to old logic

This commit is contained in:
wangmm0220 2023-12-15 10:09:18 +08:00
parent 740228a653
commit 812f0f97a7
1 changed files with 2 additions and 1 deletions

View File

@ -47,6 +47,7 @@ int32_t tqOffsetRestoreFromFile(STqOffsetStore* pStore, const char* fname) {
} }
} }
size = htonl(size);
void* pMemBuf = taosMemoryCalloc(1, size); void* pMemBuf = taosMemoryCalloc(1, size);
if (pMemBuf == NULL) { if (pMemBuf == NULL) {
tqError("vgId:%d failed to restore offset from file, since out of memory, malloc size:%d", vgId, size); tqError("vgId:%d failed to restore offset from file, since out of memory, malloc size:%d", vgId, size);
@ -177,7 +178,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) {
void* buf = taosMemoryCalloc(1, totLen); void* buf = taosMemoryCalloc(1, totLen);
void* abuf = POINTER_SHIFT(buf, INT_BYTES); void* abuf = POINTER_SHIFT(buf, INT_BYTES);
*(int32_t*)buf = bodyLen; *(int32_t*)buf = htonl(bodyLen);
SEncoder encoder; SEncoder encoder;
tEncoderInit(&encoder, abuf, bodyLen); tEncoderInit(&encoder, abuf, bodyLen);
tEncodeSTqOffset(&encoder, pOffset); tEncodeSTqOffset(&encoder, pOffset);