Remove unnecessary status check in TableCache::NewIterator
Summary: While investigating the usage of `new_table_iterator_nanos` perf counter, I saw some code was wrapper around with unnecessary status check ... so removed it. Closes https://github.com/facebook/rocksdb/pull/3120 Differential Revision: D6229181 Pulled By: sagar0 fbshipit-source-id: f8a44fe67f5a05df94553fdb233b21e54e88cc34
This commit is contained in:
parent
4c8f336401
commit
a6d8e30c05
@ -180,46 +180,44 @@ InternalIterator* TableCache::NewIterator(
|
|||||||
bool create_new_table_reader = false;
|
bool create_new_table_reader = false;
|
||||||
TableReader* table_reader = nullptr;
|
TableReader* table_reader = nullptr;
|
||||||
Cache::Handle* handle = nullptr;
|
Cache::Handle* handle = nullptr;
|
||||||
if (s.ok()) {
|
if (table_reader_ptr != nullptr) {
|
||||||
if (table_reader_ptr != nullptr) {
|
*table_reader_ptr = nullptr;
|
||||||
*table_reader_ptr = nullptr;
|
}
|
||||||
}
|
size_t readahead = 0;
|
||||||
size_t readahead = 0;
|
if (for_compaction) {
|
||||||
if (for_compaction) {
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
bool use_direct_reads_for_compaction = env_options.use_direct_reads;
|
bool use_direct_reads_for_compaction = env_options.use_direct_reads;
|
||||||
TEST_SYNC_POINT_CALLBACK("TableCache::NewIterator:for_compaction",
|
TEST_SYNC_POINT_CALLBACK("TableCache::NewIterator:for_compaction",
|
||||||
&use_direct_reads_for_compaction);
|
&use_direct_reads_for_compaction);
|
||||||
#endif // !NDEBUG
|
#endif // !NDEBUG
|
||||||
if (ioptions_.new_table_reader_for_compaction_inputs) {
|
if (ioptions_.new_table_reader_for_compaction_inputs) {
|
||||||
readahead = ioptions_.compaction_readahead_size;
|
readahead = ioptions_.compaction_readahead_size;
|
||||||
create_new_table_reader = true;
|
create_new_table_reader = true;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
readahead = options.readahead_size;
|
|
||||||
create_new_table_reader = readahead > 0;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
readahead = options.readahead_size;
|
||||||
|
create_new_table_reader = readahead > 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (create_new_table_reader) {
|
if (create_new_table_reader) {
|
||||||
unique_ptr<TableReader> table_reader_unique_ptr;
|
unique_ptr<TableReader> table_reader_unique_ptr;
|
||||||
s = GetTableReader(
|
s = GetTableReader(
|
||||||
env_options, icomparator, fd, true /* sequential_mode */, readahead,
|
env_options, icomparator, fd, true /* sequential_mode */, readahead,
|
||||||
!for_compaction /* record stats */, nullptr, &table_reader_unique_ptr,
|
!for_compaction /* record stats */, nullptr, &table_reader_unique_ptr,
|
||||||
false /* skip_filters */, level,
|
false /* skip_filters */, level,
|
||||||
true /* prefetch_index_and_filter_in_cache */, for_compaction);
|
true /* prefetch_index_and_filter_in_cache */, for_compaction);
|
||||||
|
if (s.ok()) {
|
||||||
|
table_reader = table_reader_unique_ptr.release();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
table_reader = fd.table_reader;
|
||||||
|
if (table_reader == nullptr) {
|
||||||
|
s = FindTable(env_options, icomparator, fd, &handle,
|
||||||
|
options.read_tier == kBlockCacheTier /* no_io */,
|
||||||
|
!for_compaction /* record read_stats */, file_read_hist,
|
||||||
|
skip_filters, level);
|
||||||
if (s.ok()) {
|
if (s.ok()) {
|
||||||
table_reader = table_reader_unique_ptr.release();
|
table_reader = GetTableReaderFromHandle(handle);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
table_reader = fd.table_reader;
|
|
||||||
if (table_reader == nullptr) {
|
|
||||||
s = FindTable(env_options, icomparator, fd, &handle,
|
|
||||||
options.read_tier == kBlockCacheTier /* no_io */,
|
|
||||||
!for_compaction /* record read_stats */, file_read_hist,
|
|
||||||
skip_filters, level);
|
|
||||||
if (s.ok()) {
|
|
||||||
table_reader = GetTableReaderFromHandle(handle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user