diff --git a/src/tsdb/inc/tsdbFile.h b/src/tsdb/inc/tsdbFile.h index 4ad1e5b3173a2fb4bea9135ea1766e36feb449e2..6b275b31e964f6fd7b3a1991fa961c43c5794967 100644 --- a/src/tsdb/inc/tsdbFile.h +++ b/src/tsdb/inc/tsdbFile.h @@ -257,11 +257,11 @@ static FORCE_INLINE int tsdbAppendDFile(SDFile* pDFile, void* buf, int64_t nbyte return -1; } - //bug fix. To avoid data corruption, close the data file in advance. - //ASSERT(pDFile->info.size == toffset); + //bug fix. To avoid data corruption, + //the end offset of current file should be checked with file size, + //if not equal, known as file corrupted and return error. if (pDFile->info.size != toffset) { - tsdbCloseDFile(pDFile); - terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TSDB_CODE_TDB_FILE_CORRUPTED; return -1; }