refactor(query): disable file size check when reading data files.

This commit is contained in:
Haojun Liao 2023-02-02 17:49:07 +08:00
parent 40b7718078
commit 7168f90c51
1 changed files with 5 additions and 1 deletions

View File

@ -47,7 +47,9 @@ static int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsd
taosMemoryFree(pFD); taosMemoryFree(pFD);
goto _exit; goto _exit;
} }
if (flag == TD_FILE_READ) {
// not check file size when reading data files.
if (flag != TD_FILE_READ) {
if (taosStatFile(path, &pFD->szFile, NULL) < 0) { if (taosStatFile(path, &pFD->szFile, NULL) < 0) {
code = TAOS_SYSTEM_ERROR(errno); code = TAOS_SYSTEM_ERROR(errno);
taosMemoryFree(pFD->pBuf); taosMemoryFree(pFD->pBuf);
@ -55,9 +57,11 @@ static int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsd
taosMemoryFree(pFD); taosMemoryFree(pFD);
goto _exit; goto _exit;
} }
ASSERT(pFD->szFile % szPage == 0); ASSERT(pFD->szFile % szPage == 0);
pFD->szFile = pFD->szFile / szPage; pFD->szFile = pFD->szFile / szPage;
} }
*ppFD = pFD; *ppFD = pFD;
_exit: _exit: