diff --git a/db/table_cache.cc b/db/table_cache.cc index c86f60750..e548fc6c3 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -114,15 +114,18 @@ Status TableCache::GetTableReader( if (s.ok()) { s = ioptions_.fs->NewRandomAccessFile(fname, fopts, &file, nullptr); } - RecordTick(ioptions_.stats, NO_FILE_OPENS); - if (s.IsPathNotFound()) { + if (s.ok()) { + 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); } - RecordTick(ioptions_.stats, NO_FILE_OPENS); + if (s.ok()) { + RecordTick(ioptions_.stats, NO_FILE_OPENS); + } } if (s.ok()) {