-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix Seek with lower_bound #3199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It'd be good to make the behavior consistent in SeekForPrev if iterator upper bound is set.
Also note the travis failures are related.
db/db_iter.cc
Outdated
@@ -1134,6 +1134,13 @@ void DBIter::Seek(const Slice& target) { | |||
saved_key_.Clear(); | |||
saved_key_.SetInternalKey(target, sequence_); | |||
|
|||
if (iterate_upper_bound_ != nullptr && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean iterate_lower_bound_ != nullptr
?
@zhangjinpeng1987 has updated the pull request. View: changes, changes since last import |
|
From my reading |
@zhangjinpeng1987 has updated the pull request. View: changes, changes since last import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
db/db_iter.cc
Outdated
user_comparator_->Compare(saved_key_.GetUserKey(), | ||
*iterate_upper_bound_) >= 0) { | ||
saved_key_.Clear(); | ||
saved_key_.SetInternalKey(*iterate_upper_bound_, sequence_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry one more thing - should we make the seqnum zero here so the upper bound remains exclusive?
@zhangjinpeng1987 has updated the pull request. View: changes, changes since last import |
you got unlucky :P -- there's a function overload taking bool as argument so passing zero doesn't compile. Anyways we need to do three things:
|
also be sure to run |
@zhangjinpeng1987 has updated the pull request. View: changes, changes since last import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajkr is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
When Seek a key less than
lower_bound
, should returnlower_bound
.@ajkr PTAL