Automatically select shard to move repository to based on existing weights
A user should be able to issue a repository move API request where, instead of providing the target shard, you tell GitLab to automatically select it using the randomized weighs. This way, the exact same algorithm that we use for picking the shard for a new repo could be used for migrating repositories off a hotspot node.
The current API requires the
The updated API would make
destination_storage_name optional. If it was not specified, as random node would be selected.
Since the hotspot nodes would have weight zero, the relocation would never move the nodes to another hotspot.
This would guarantee that whatever logic the application uses (and continues to evolve) for repository selection can be used automatically for migration.
Of course, we would still have the option to move repositories using a specific shard, if we wished.
This would greatly reduce the amount of duplicate logic.