Description
During addShard we find any databases that already exist on the shard being added and attempt to add them to the cluster. Before we do that, we check that no databases that exist on the shard already exist on the cluster. There is no locking during these checks, however, so it's possible that a database could be created after the check and assigned to a different shard. If that happens, when we upsert the database document for the database discovered on the shard, we might wind up changing the 'primary' shard for that database out from under it, leading to data loss.