-
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
storage: RelocateRange doesn't handle edge cases properly #29130
Comments
I'm trying to come up with scenarios where adding all the replicas at once and doing all the removals afterwards causes problems in order to justify the extra computation cost of doing them one-by-one. Because we can do it one by one, but it'll involve a bunch more computation to pick the order. It takes a bit of a stretch to come up with problem scenarios, though. I can't think of a particularly common configuration in which having potentially double the configured replication factor makes a range more susceptible to data unavailability or loss than either the start or end state of the
Given that scenario 2 is effectively equivalent to #12768 but for The basic implementation approach here will be to add one new replica, then use I care about this more than before now due to #28852. I could do the one-by-one work there, but RelocateRange is quite a natural API for what it wants to do, so it makes a good opportunity to clean this issue up along the way. I don't plan on guaranteeing proper handling of multiple stores per node, but I don't think it'd be too hard to add later. |
Wait, are you offering to take this off my plate as part of #28852? 😍
I do think it's slightly less bad than #12768—presumably the chance of a permanent data center failure is way lower than the chance of a permanent node failure. But definitely still unfortunate and worth protecting against.
If you do this—and it should work just fine for the merge queue, because mergeable ranges must be in the same zone—I think you'll need an escape hatch to continue supporting Everything else you mentioned sounds spot-on to my, admittedly less-expert, ears. |
So you think it's worth allowing manual placement to violate constraints? There may be the occasional situation where someone wants that, but most of the time I'd think that requiring constraints to be obeyed would be desirable for preventing mistakes. |
Hmm, maybe you're right. I was thinking tests might need total control over replica placement... but I can't actually think of a reason that any of those tests would need to violate constraints. |
Does a more gradual process of adding one replica then removing one until all the desired changes have been made, using the existing allocator code to do so in a reasonable order. Fixes cockroachdb#29130 Release note: None
And convert it to an Admin command, AdminRelocateRange, as was required to both let RelocateRange access the local store's resources while still making it callable from the sql package. It now does a more gradual process of adding one replica then removing one until all the desired changes have been made, using the existing allocator code to do so in a reasonable order. Fixes cockroachdb#29130 Release note (sql change): The EXPERIMENTAL_RELOCATE statement no longer temporarily increases the number of replicas in a range more than one above the range's replication factor, preventing rare edge cases of unavailability.
And convert it to an Admin command, AdminRelocateRange, as was required to both let RelocateRange access the local store's resources while still making it callable from the sql package. It now does a more gradual process of adding one replica then removing one until all the desired changes have been made, using the existing allocator code to do so in a reasonable order. Fixes cockroachdb#29130 Release note (sql change): The EXPERIMENTAL_RELOCATE statement no longer temporarily increases the number of replicas in a range more than one above the range's replication factor, preventing rare edge cases of unavailability.
And convert it to an Admin command, AdminRelocateRange, as was required to both let RelocateRange access the local store's resources while still making it callable from the sql package. It now does a more gradual process of adding one replica then removing one until all the desired changes have been made, using the existing allocator code to do so in a reasonable order. Fixes cockroachdb#29130 Release note (sql change): The EXPERIMENTAL_RELOCATE statement no longer temporarily increases the number of replicas in a range more than one above the range's replication factor, preventing rare edge cases of unavailability.
29684: storage: Avoid adding all replicas at once in RelocateRange r=a-robinson a=a-robinson Does a more gradual process of adding one replica then removing one until all the desired changes have been made, using the existing allocator code to do so in a reasonable order. Fixes #29130 Release note: None ------------------- This is still a work-in-progress in the sense that it isn't really usable from the SQL code yet, since I just implemented it as a method on `Store`. If the approach looks reasonable, though, it can be converted it into an Admin API method. Co-authored-by: Alex Robinson <[email protected]>
And convert it to an Admin command, AdminRelocateRange, as was required to both let RelocateRange access the local store's resources while still making it callable from the sql package. It now does a more gradual process of adding one replica then removing one until all the desired changes have been made, using the existing allocator code to do so in a reasonable order. Fixes cockroachdb#29130 Release note (sql change): The EXPERIMENTAL_RELOCATE statement no longer temporarily increases the number of replicas in a range more than one above the range's replication factor, preventing rare edge cases of unavailability. # # Commit message recommendations: # # --- # <pkg>: <short description> # # <long description> # # Release note (category): <release note description> # --- # # Wrap long lines! 72 columns is best. # # The release note must be present if your commit has # user-facing changes. Leave the default above if not. # # Categories for release notes: # - cli change # - sql change # - admin ui change # - general change (e.g., change of required Go version) # - build change (e.g., compatibility with older CPUs) # - enterprise change (e.g., change to backup/restore) # - backwards-incompatible change # - performance improvement # - bug fix
cockroach/pkg/storage/merge_queue.go
Lines 267 to 272 in 3c6c71d
cockroach/pkg/storage/replica_command.go
Lines 956 to 957 in 2f2467c
The text was updated successfully, but these errors were encountered: