-
Notifications
You must be signed in to change notification settings - Fork 472
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
Make BITPOS in Bitmap handling stop_given
#2085
Conversation
} | ||
bitmap_->BitPos(key_, false, 0, 0, /*stop_given=*/true, &pos); | ||
EXPECT_EQ(-1, pos); | ||
bitmap_->BitPos(key_, false, 0, 1, /*stop_given=*/false, &pos); |
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.
If test:
bitmap_->BitPos(key_, false, 0, 1, /*stop_given=*/false, &pos);
The result is undefined, sigh...
@@ -285,6 +285,10 @@ rocksdb::Status Bitmap::BitPos(const Slice &user_key, bool bit, int64_t start, i | |||
std::tie(start, stop) = BitmapString::NormalizeRange(start, stop, static_cast<int64_t>(metadata.size)); | |||
auto u_start = static_cast<uint32_t>(start); | |||
auto u_stop = static_cast<uint32_t>(stop); | |||
if (u_start > u_stop) { |
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.
This unifying the responds of BitmapString
} | ||
// There're two cases that `pin_value.size() < kBitmapSegmentBytes`: | ||
// 1. If it's the last segment, we've done searching in the above loop. | ||
// 2. If it's not the last segment, we can check if the segment is all 0. |
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.
The logic here is a bit hacking:
- if
bit
, we don't search the value greater than searching area - if
i == stop_index
, making the logic outside the loop to decide the response - Otherwise, searching setting the
pos
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.
LGTM
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 1 New issue |
See #2084