Log sst number in Corruption status (#7767)

Summary:
sst file number in corruption error would be very useful for debugging

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7767

Reviewed By: zhichao-cao

Differential Revision: D25485872

Pulled By: jay-zhuang

fbshipit-source-id: 67315b582cedeefbce6676015303ebe5bf6526a3
This commit is contained in:
Jay Zhuang 2020-12-14 14:06:04 -08:00 committed by Facebook GitHub Bot
parent 1afbd1948c
commit a0e4421e81

View File

@ -334,17 +334,23 @@ class VersionBuilder::Rep {
TEST_SYNC_POINT_CALLBACK("VersionBuilder::CheckConsistency1", &pair);
#endif
if (!level_nonzero_cmp_(f1, f2)) {
return Status::Corruption("L" + NumberToString(level) +
" files are not sorted properly");
return Status::Corruption(
"L" + NumberToString(level) +
" files are not sorted properly: files #" +
NumberToString(f1->fd.GetNumber()) + ", #" +
NumberToString(f2->fd.GetNumber()));
}
// Make sure there is no overlap in levels > 0
if (vstorage->InternalComparator()->Compare(f1->largest,
f2->smallest) >= 0) {
return Status::Corruption(
"L" + NumberToString(level) + " have overlapping ranges " +
(f1->largest).DebugString(true) + " vs. " +
(f2->smallest).DebugString(true));
"L" + NumberToString(level) +
" have overlapping ranges: file #" +
NumberToString(f1->fd.GetNumber()) +
" largest key: " + (f1->largest).DebugString(true) +
" vs. file #" + NumberToString(f2->fd.GetNumber()) +
" smallest key: " + (f2->smallest).DebugString(true));
}
}
}