mirror of
https://github.com/facebook/rocksdb.git
synced 2025-05-14 00:43:07 +08:00
Fix assertion error with read_opts.iter_start_ts (#10279)
Summary: If the internal iterator is not valid, `SeekToLast` with iter_start_ts should have `valid_` is false without assertion failure. Test plan make check Pull Request resolved: https://github.com/facebook/rocksdb/pull/10279 Reviewed By: ltamasi Differential Revision: D37539393 Pulled By: riversand963 fbshipit-source-id: 8e94057838f8a05144fad5768f4d62f1893ec315
This commit is contained in:
parent
57a0e2f304
commit
b87c355772
@ -1612,7 +1612,7 @@ void DBIter::SeekToLast() {
|
||||
SeekForPrev(*iterate_upper_bound_);
|
||||
const bool is_ikey = (timestamp_size_ > 0 && timestamp_lb_ != nullptr);
|
||||
Slice k = Valid() ? key() : Slice();
|
||||
if (is_ikey) {
|
||||
if (is_ikey && Valid()) {
|
||||
k.remove_suffix(kNumInternalBytes + timestamp_size_);
|
||||
}
|
||||
while (Valid() && 0 == user_comparator_.CompareWithoutTimestamp(
|
||||
|
@ -1193,6 +1193,14 @@ TEST_F(DBBasicTestWithTimestamp, SimpleBackwardIterateLowerTsBound) {
|
||||
it->SeekToLast();
|
||||
CheckIterEntry(it.get(), "a", kTypeSingleDeletion, Slice(),
|
||||
Timestamp(1, 0));
|
||||
|
||||
key_ub_str = "a"; // exclusive
|
||||
key_ub = key_ub_str;
|
||||
read_opts.iterate_upper_bound = &key_ub;
|
||||
it.reset(db_->NewIterator(read_opts));
|
||||
it->SeekToLast();
|
||||
ASSERT_FALSE(it->Valid());
|
||||
ASSERT_OK(it->status());
|
||||
}
|
||||
|
||||
Close();
|
||||
|
Loading…
x
Reference in New Issue
Block a user