fix: sma file corrupt

This commit is contained in:
Hongze Cheng 2022-08-21 11:26:20 +08:00
parent 38b30d071e
commit 5324889c52
1 changed files with 11 additions and 1 deletions

View File

@ -694,8 +694,18 @@ int32_t tsdbReadBlockSma(SDataFReader *pReader, SBlock *pBlock, SArray *aColumnD
code = tRealloc(&pReader->aBuf[0], size);
if (code) goto _err;
// seek
int64_t n = taosLSeekFile(pReader->pSmaFD, pSmaInfo->offset, SEEK_SET);
if (n < 0) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;
} else if (n < pSmaInfo->offset) {
code = TSDB_CODE_FILE_CORRUPTED;
goto _err;
}
// read
int64_t n = taosReadFile(pReader->pSmaFD, pReader->aBuf[0], size);
n = taosReadFile(pReader->pSmaFD, pReader->aBuf[0], size);
if (n < 0) {
code = TAOS_SYSTEM_ERROR(errno);
goto _err;