-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
backupccl: stop splitting at invalid split keys #67497
Conversation
Working on the tests. I believe that this needs to go back to 20.1. |
Glad the fix was so small. Are there tests cases we can add that are more general that prevent us from making this mistake in the future? Why does the AdminSplit command permit invalid SQL split keys at all? |
I think there's defense that we can do here in layers. The first is a regression case that creates a backup with entries split along these boundaries. I'm still thinking of more general test cases we can add. We would benefit with more backup/restore testing with column families that operate on larger-data sizes (so that there are several entries to work with). I think a combination of updating the default bank payload that we use for the tests to incorporate column families and also reducing the size of the entries produced by backup (metamorphic constant?) could help activate paths that could have caught something like this.
I looked into ensuring that AdminSplit validates invalid split keys by using EnsureSafeSplitKey, but EnsureSafeSplitKey already knows quite a bit about the SQL layer which feels very leaky for the KV layer to know so much about decoding SQL rows... That being said, it's already used by |
1264d65
to
5be34fa
Compare
Restore could perform invalid splits during the split and scatter phase. This commit ensures that splits are always performed at safe keys during restore. Release note (bug fix): Fix a bug where restores of data with multiple column families could be split illegally (within a single SQL row). This could result in temporary data unavailability until the ranges on either side of the invalid split are merged.
5be34fa
to
5bea8fe
Compare
@adityamaru This change is pretty much the same that David stamped above with an added test that I wanted to get eyes on. It also ignores any errors from EnsureSafeSplitKey since not all keys are "table keys" (e.g. I think a change like this is safer to backport, but a follow up will be to try and get this check into AdminSplit. |
TFTR |
Build failed: |
bors r+ |
Build failed (retrying...): |
Build succeeded: |
blathers backport 21.1 |
Restore could perform invalid splits during the split and scatter phase.
This commit ensures that splits are always performed at safe keys.
Fixes #67488.
Release note (bug fix): Fix a bug where restores of data with multiple
column families could be split illegally (within a single SQL row). This
could result in temporary data unavailability until the ranges on either
side of the invalid split are merged.