diff --git a/db/table_cache.cc b/db/table_cache.cc index 0bbec70e1d..00224fd818 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -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; } } diff --git a/db/version_edit_handler.cc b/db/version_edit_handler.cc index 965213b586..732723996a 100644 --- a/db/version_edit_handler.cc +++ b/db/version_edit_handler.cc @@ -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()); }