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

fix api v2 decode of region bucket's keys #757

Merged
merged 2 commits into from
Mar 31, 2023

Conversation

iosmanthus
Copy link
Member

This pull request decodes the region bucket key by mapping them into the keyspace range.
If the bucket key is in the keyspace, then decode it as usual, otherwise map it as nil.

Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Comment on lines +963 to +965
if bytes.Compare(key, c.endKey) >= 0 || bytes.Compare(key, c.prefix) < 0 {
return []byte{}, nil
}
Copy link
Contributor

@AmoebaProtozoa AmoebaProtozoa Mar 30, 2023

Choose a reason for hiding this comment

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

should we return the corresponding prefix or endkey of the codec instead of return empty slice?

what happen when nil slice is return as bucket boundary, would pd interpret them as region boundary?

Copy link
Member Author

Choose a reason for hiding this comment

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

This function aims for decoding the key, for example, if there is a region ranged in [x0001, x0003), and the keyspace 002 tries to decode the bucket key "x0001test", then the key for keyspace 002 doesn't exist, we might decode them as "".

Copy link
Contributor

Choose a reason for hiding this comment

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

got it

Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Copy link
Contributor

@AmoebaProtozoa AmoebaProtozoa left a comment

Choose a reason for hiding this comment

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

LGTM

@disksing disksing merged commit 6a92aee into tikv:master Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants