Skip to content
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

update IterKey that can get user key and internal key explicitly #2084

Closed
wants to merge 4 commits into from

Conversation

lightmark
Copy link
Contributor

to void future bug that caused by the mix of userkey/internalkey

@facebook-github-bot
Copy link
Contributor

@lightmark updated the pull request - view changes

@facebook-github-bot
Copy link
Contributor

@lightmark has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you arc lint? a lot of the lines are >80 chars

@facebook-github-bot
Copy link
Contributor

@lightmark updated the pull request - view changes - changes since last import

@facebook-github-bot
Copy link
Contributor

@lightmark has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for making it clearer which type of key we're using. probably could be even stricter if we don't use the same variable to store both user and internal keys (maybe next tech debt week :)).

@@ -991,7 +999,7 @@ void DBIter::Seek(const Slice& target) {

{
PERF_TIMER_GUARD(seek_internal_seek_time);
iter_->Seek(saved_key_.GetKey());
iter_->Seek(saved_key_.GetInternalKey());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nooooo :(, any way to make saved_key_ consistently use internal or user? (in a separate diff)

db/dbformat.h Outdated
@@ -347,29 +358,25 @@ class IterKey {
memcpy(buf_ + shared_len, non_shared_data, non_shared_len);
key_ = buf_;
key_size_ = total_size;
is_user_key_ = is_user_key;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didn't understand why TrimAppend() should be able to change the key's type

} else {
cur_key_.Reserve(prefix_len_ + size);
cur_key_.SetInternalKey(Slice(saved_user_key_.data(), prefix_len_),
*parsed_key);
}
parsed_key->user_key = ExtractUserKey(cur_key_.GetKey());
parsed_key->user_key = ExtractUserKey(cur_key_.GetInternalKey());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just call getuserkey()

@facebook-github-bot
Copy link
Contributor

@lightmark updated the pull request - view changes - changes since last import

@facebook-github-bot
Copy link
Contributor

@lightmark has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants