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

[reseek bugfix] add reseekdone flag

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