diff --git a/db/table_cache.cc b/db/table_cache.cc index 5352309f4..ff7997566 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -95,11 +95,11 @@ Status TableCache::GetTableReader( unique_ptr file; Status s = ioptions_.env->NewRandomAccessFile(fname, &file, env_options); - if (readahead > 0) { - file = NewReadaheadRandomAccessFile(std::move(file), readahead); - } RecordTick(ioptions_.statistics, NO_FILE_OPENS); if (s.ok()) { + if (readahead > 0) { + file = NewReadaheadRandomAccessFile(std::move(file), readahead); + } if (!sequential_mode && ioptions_.advise_random_on_open) { file->Hint(RandomAccessFile::RANDOM); }