From 98cd494f23d89389542838426d4b016b07e6406c Mon Sep 17 00:00:00 2001 From: root <314218900@qq.com> Date: Sat, 11 Jun 2022 16:28:11 +0800 Subject: [PATCH] fix:Failed to start TDengine server service.(vnode tsdb data file has wrong size , report to upper layer to fix it) #13529 --- src/tsdb/inc/tsdbFile.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tsdb/inc/tsdbFile.h b/src/tsdb/inc/tsdbFile.h index 75e9563151..4ad1e5b317 100644 --- a/src/tsdb/inc/tsdbFile.h +++ b/src/tsdb/inc/tsdbFile.h @@ -257,7 +257,13 @@ static FORCE_INLINE int tsdbAppendDFile(SDFile* pDFile, void* buf, int64_t nbyte return -1; } - ASSERT(pDFile->info.size == toffset); + //bug fix. To avoid data corruption, close the data file in advance. + //ASSERT(pDFile->info.size == toffset); + if (pDFile->info.size != toffset) { + tsdbCloseDFile(pDFile); + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } if (offset) { *offset = toffset; -- GitLab