mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-25 14:31:35 +00:00
Improve error message when an SST file in MANIFEST is not found (#11573)
Summary: I got the following error message when an SST file is recorded in MANIFEST but is missing from the db folder. It's confusing in two ways: 1. The part about file "./074837.ldb" which RocksDB will attempt to open only after ./074837.sst is not found. 2. The last part about "No such file or directory in file ./MANIFEST-074507" sounds like `074837.ldb` is not found in manifest. ``` ldb --hex --db=. get some_key Failed: Corruption: Corruption: IO error: No such file or directory: While open a file for random read: ./074837.ldb: No such file or directory in file ./MANIFEST-074507 ``` Improving the error message a little bit: Pull Request resolved: https://github.com/facebook/rocksdb/pull/11573 Test Plan: run the same command after this PR ``` Failed: Corruption: Corruption: IO error: No such file or directory: While open a file for random read: ./074837.sst: No such file or directory The file ./MANIFEST-074507 may be corrupted. ``` Reviewed By: ajkr Differential Revision: D47192056 Pulled By: cbi42 fbshipit-source-id: 06863f376cc4455803cffb2250c41399b4c39467
This commit is contained in:
parent
1a7c741977
commit
854eb76a8c
|
@ -111,13 +111,17 @@ Status TableCache::GetTableReader(
|
|||
RecordTick(ioptions_.stats, NO_FILE_OPENS);
|
||||
} else if (s.IsPathNotFound()) {
|
||||
fname = Rocks2LevelTableFileName(fname);
|
||||
s = PrepareIOFromReadOptions(ro, ioptions_.clock, fopts.io_options);
|
||||
if (s.ok()) {
|
||||
s = ioptions_.fs->NewRandomAccessFile(fname, file_options, &file,
|
||||
nullptr);
|
||||
// If this file is also not found, we want to use the error message
|
||||
// that contains the table file name which is less confusing.
|
||||
Status temp_s =
|
||||
PrepareIOFromReadOptions(ro, ioptions_.clock, fopts.io_options);
|
||||
if (temp_s.ok()) {
|
||||
temp_s = ioptions_.fs->NewRandomAccessFile(fname, file_options, &file,
|
||||
nullptr);
|
||||
}
|
||||
if (s.ok()) {
|
||||
if (temp_s.ok()) {
|
||||
RecordTick(ioptions_.stats, NO_FILE_OPENS);
|
||||
s = temp_s;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,8 @@ void VersionEditHandlerBase::Iterate(log::Reader& reader,
|
|||
message << ' ';
|
||||
}
|
||||
// append the filename to the corruption message
|
||||
message << "in file " << reader.file()->file_name();
|
||||
message << " The file " << reader.file()->file_name()
|
||||
<< " may be corrupted.";
|
||||
// overwrite the status with the extended status
|
||||
s = Status(s.code(), s.subcode(), s.severity(), message.str());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue