Currently it is possible for multiple threads to call reload and we use the $replData lastVisibleOpTime to disregard older data:
https://github.com/mongodb/mongo/blob/r3.2.0/src/mongo/s/client/shard_registry.cpp#L190-l195
The problem with this is that lastVisibleOpTime gives you the opTime that is guaranteed to include the data you just read. In other words, it is possible for the lastVisibleOpTime to be way newer than the data you read; which also means that it is possible for the returned shard list that was actually older than the currently stored one to have a newer lastVisibleOpTime and override the shard list. This will cause a momentary "shard not found" error until the next reload.
- is related to
-
SERVER-21911 ShardRegistry::reload can overwrite existing entry with an older one temporarily in SCCC
- Closed
-
SERVER-22795 lastVisibleOpTime for committed snapshot needs to be the actual snapshot used for the query
- Closed