fix tsdb file truncate bug
This commit is contained in:
parent
23b69f62d3
commit
edd9399913
|
@ -202,7 +202,7 @@ int tsdbScanAndTryFixMFile(STsdbRepo *pRepo) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (pMFile->info.size > mfstat.st_size) {
|
||||
if (pMFile->info.size < mfstat.st_size) {
|
||||
if (tsdbOpenMFile(&mf, O_WRONLY) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ int tsdbScanAndTryFixMFile(STsdbRepo *pRepo) {
|
|||
tsdbCloseMFile(&mf);
|
||||
tsdbInfo("vgId:%d file %s is truncated from %" PRId64 " to %" PRId64, REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pMFile),
|
||||
mfstat.st_size, pMFile->info.size);
|
||||
} else if (pMFile->info.size < mfstat.st_size) {
|
||||
} else if (pMFile->info.size > mfstat.st_size) {
|
||||
tsdbError("vgId:%d meta file %s has wrong size %" PRId64 " expected %" PRId64 ", report to upper layer to fix it",
|
||||
REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pMFile), mfstat.st_size, pMFile->info.size);
|
||||
pRepo->state |= TSDB_STATE_BAD_META;
|
||||
|
@ -428,7 +428,7 @@ static int tsdbScanAndTryFixDFile(STsdbRepo *pRepo, SDFile *pDFile) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (pDFile->info.size > dfstat.st_size) {
|
||||
if (pDFile->info.size < dfstat.st_size) {
|
||||
if (tsdbOpenDFile(&df, O_WRONLY) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ static int tsdbScanAndTryFixDFile(STsdbRepo *pRepo, SDFile *pDFile) {
|
|||
tsdbCloseDFile(&df);
|
||||
tsdbInfo("vgId:%d file %s is truncated from %" PRId64 " to %" PRId64, REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile),
|
||||
dfstat.st_size, pDFile->info.size);
|
||||
} else if (pDFile->info.size < dfstat.st_size) {
|
||||
} else if (pDFile->info.size > dfstat.st_size) {
|
||||
tsdbError("vgId:%d data file %s has wrong size %" PRId64 " expected %" PRId64 ", report to upper layer to fix it",
|
||||
REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile), dfstat.st_size, pDFile->info.size);
|
||||
pRepo->state |= TSDB_STATE_BAD_DATA;
|
||||
|
|
Loading…
Reference in New Issue