The config.system.sessions collection has special logic to send the shardCollection command to the first shard rather than the dbPrimary since we do not want the collection to live on the config server (as we have an assumption that the config server does not contain chunks or data when it is not embedded).
However, there is a race condition with transitionToDedicated where the shardCollection command is sent to the config server (because the config server is also the first shard) but before the coordinator is instantiated the config server transitions to dedicated. In this case, the coordinator will still be executed on the config server after the transition completes and will end up creating the collection with a single chunk on the config server.
In this situation, the collection will never be balanced (since the config server is not considered for balancing) and if the user transitions back to embedded, we will drop the sessions collection locally on the config server resulting in broken metadata for the collection.
- is related to
-
SERVER-86949 Run the shardCollection coordinator on the config server
- In Code Review
-
SERVER-97336 Prevent config.system.sessions from being created as unsharded
- Closed