diff options
author | sdong <siying.d@fb.com> | 2020-07-29 09:43:56 -0700 |
---|---|---|
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | 2020-07-29 09:45:21 -0700 |
commit | 692f6a3138720ce70f2ade0247be20fd04b4c5b1 (patch) | |
tree | f199eabf5a24bdd9b795e3edb03fa5fab0248ed7 /table | |
parent | d9d190742c0a8a3d5ff0b0867383bd38c1d0f5f0 (diff) |
Implement NextAndGetResult() in memtable and level iterator (#7179)
Summary:
NextAndGetResult() is not implemented in memtable and is very simply implemented in level iterator. The result is that for a normal leveled iterator, performance regression will be observed for calling PrepareValue() for most iterator Next(). Mitigate the problem by implementing the function for both iterators. In level iterator, the implementation cannot be perfect as when calling file iterator's SeekToFirst() we don't have information about whether the value is prepared. Fortunately, the first key should not cause a big portion of the CPu.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/7179
Test Plan: Run normal crash test for a while.
Reviewed By: anand1976
Differential Revision: D22783840
fbshipit-source-id: c19f45cdf21b756190adef97a3b66ccde3936e05
Diffstat (limited to 'table')
-rw-r--r-- | table/iterator_wrapper.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/table/iterator_wrapper.h b/table/iterator_wrapper.h index b4b051ff6..010a23abf 100644 --- a/table/iterator_wrapper.h +++ b/table/iterator_wrapper.h @@ -89,6 +89,13 @@ class IteratorWrapperBase { valid_ = iter_->NextAndGetResult(&result_); assert(!valid_ || iter_->status().ok()); } + bool NextAndGetResult(IterateResult* result) { + assert(iter_); + valid_ = iter_->NextAndGetResult(&result_); + *result = result_; + assert(!valid_ || iter_->status().ok()); + return valid_; + } void Prev() { assert(iter_); iter_->Prev(); |