提交 6cbb1046 编写于 作者: A akankshamahajan 提交者: Facebook GitHub Bot

Fix seg fault in auto_readahead_size during IOError (#11761)

Summary:
Fix seg fault in auto_readahead_size
```
db_stress:
internal_repo_rocksdb/repo/table/block_based/partitioned_index_iterator.h:70: virtual rocksdb::IndexValue rocksdb::PartitionedIndexIterator::value() const: Assertion `Valid()' failed.
```

During seek, after calculating readahead_size, db_stress can inject IOError resulting in failure to index_iter_->Seek and making index_iter_ invalid.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11761

Test Plan: Reproducible locally and passed with this fix

Reviewed By: anand1976

Differential Revision: D48696248

Pulled By: akankshamahajan15

fbshipit-source-id: 2be43bf56ad0fc2f95f9093c19c9a1b15a716091
上级 d3420464
......@@ -79,13 +79,20 @@ void BlockBasedTableIterator::SeekImpl(const Slice* target,
}
}
if (read_options_.auto_readahead_size && read_options_.iterate_upper_bound) {
if (read_options_.auto_readahead_size && read_options_.iterate_upper_bound &&
is_first_pass) {
FindReadAheadSizeUpperBound();
if (target) {
index_iter_->Seek(*target);
} else {
index_iter_->SeekToFirst();
}
// Check for IO error.
if (!index_iter_->Valid()) {
ResetDataIter();
return;
}
}
IndexValue v = index_iter_->value();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册