The balancer will handle starting up, shutting down, periodically checking for balancing work, and finding precise chunks to move around. These chunks will then be handed to the MigrationManager, which will: attempt to schedule the migrations; manage the distlocks; maintain information about the migrations in progress. The MigrationManager will call moveChunks in parallel by using the TaskExecutor to asynchronously schedule them. It will then wait synchronously for the moveChunk commands to return.
MigrationManager
- schedule the migrations
- take the distlocks, store them as shared_ptrs in some Migration object
- hold a set of Migration objects – make up an appropriate name – to maintain information about each active migration.
- collection NamespaceString
- distlock shared_ptr
- ChunkRange
- toShard
- fromShard
TODO in a later ticket: use the information in the Migration objects to determine migration conflicts so that conflicts aren't just found when the moveChunk command is rejected.
TODO in a later ticket: find a way to parallelize receiving moveChunk responses, so a slow migration won't hold up releasing the distlocks of faster migrations that were scheduled later.
- is related to
-
SERVER-22669 CSRS balancer supports parallel migrations
- Closed