-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migration,keys: fix incorrect range descriptor iteration
The long-running migrations infrastructure exposes an `IterateRangeDescriptors` interface to paginate through all the ranges in the system. It was previously doing this (erroneously) by scanning through the meta2 range. It was thus possible to entirely miss descriptors for the meta ranges themselves. This could only happen for large enough clusters with splits in the meta range. This issue was caught during the careful review of #66445. We remedy the situation by scanning over the entire `[MetaMin, MetaMax)` span instead. One thing to take care of is the possibility of finding the same range descriptor in both the `meta1` and `meta2` range. This is possible when the first range in the system includes part of the user keyspace (typically `[/Min, /System/NodeLiveness)`). We de-dup these descriptors away by maintaining an in-memory map of the range IDs seen in meta1. --- What does this mean for existing long running migrations? There was only one that made use of this descriptor iteration API: the truncated state migration. Fortunately that migration was a below-raft one, so as part of it we purged all extant ranges that hadn't seen the corresponding `Migrate` command (see `postTruncatedStateMigration` and `PurgeOutdatedReplicas`; the purge attempt reaches out to every store and ensures every replica has been migrated, and if not, has been GC-ed). If we had found unmigrated ranges (possible for the meta ranges as described above), the migration would be blocked. We haven't seen this happen with users running 21.1, which makes sense since this bug is only possible in clusters with enough ranges to necessitate a split in the meta range (very unlikely with our large default range size of 512 MB). Still, we'll backport this PR to 21.1. Should users run into this stalled migration, we'll recommend upgrading to whatever patch release this will be part of. Release note: None Release justification: bug fixes and low-risk updates to new functionality
- Loading branch information
1 parent
64e834c
commit 8885e3c
Showing
4 changed files
with
89 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters