提交 2fa9bf2b 编写于 作者: L Layamon 提交者: ZhaoMing

[reseek bugfix] add reseekdone flag

上级 ba4aaa07
......@@ -429,7 +429,7 @@ bool DBIter::FindNextUserEntryInternal(bool skipping, bool prefix_check) {
// greater than that,
// - none of the above : saved_key_ can contain anything, it doesn't matter.
uint64_t num_skipped = 0;
bool reseek_done = false;
do {
if (!ParseKey(&ikey_)) {
return false;
......@@ -457,6 +457,7 @@ bool DBIter::FindNextUserEntryInternal(bool skipping, bool prefix_check) {
PERF_COUNTER_ADD(internal_key_skipped_count, 1);
} else {
num_skipped = 0;
reseek_done = false;
switch (ikey_.type) {
case kTypeDeletion:
case kTypeSingleDeletion:
......@@ -500,6 +501,7 @@ bool DBIter::FindNextUserEntryInternal(bool skipping, bool prefix_check) {
// they are hidden by this deletion.
skipping = true;
num_skipped = 0;
reseek_done = false;
PERF_COUNTER_ADD(internal_delete_skipped_count, 1);
} else {
value_ = GetValue(ikey_, kTypeValueIndex);
......@@ -517,6 +519,7 @@ bool DBIter::FindNextUserEntryInternal(bool skipping, bool prefix_check) {
// they are hidden by this deletion.
skipping = true;
num_skipped = 0;
reseek_done = false;
PERF_COUNTER_ADD(internal_delete_skipped_count, 1);
} else {
// By now, we are sure the current ikey is going to yield a
......@@ -545,13 +548,15 @@ bool DBIter::FindNextUserEntryInternal(bool skipping, bool prefix_check) {
saved_key_.SetUserKey(ikey_.user_key);
skipping = false;
num_skipped = 0;
reseek_done = false;
}
}
// If we have sequentially iterated via numerous equal keys, then it's
// better to seek so that we can avoid too many key comparisons.
if (num_skipped > max_skip_ && CanReseekToSkip()) {
if (num_skipped > max_skip_ && !reseek_done) {
num_skipped = 0;
reseek_done = true;
std::string last_key;
if (skipping) {
// We're looking for the next user-key but all we see are the same
......
......@@ -102,7 +102,6 @@ Status WritePreparedTxn::PrepareInternal() {
assert(!s.ok() || seq_used != kMaxSequenceNumber);
auto prepare_seq = seq_used;
SetId(prepare_seq);
TEST_SYNC_POINT_CALLBACK("WritePreparedTxn::PrepareInternal::End", nullptr);
return s;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册