-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Catalog and Routing
-
ALL
-
🟩 Routing and Topology
-
None
-
None
-
None
-
None
-
None
-
None
In a sharded cluster, when listDatabases is executed, the mongoS secuentially sends a listDatabases command to every shard of the cluster.
Currently there is no mechanism to prevent dropping existing databases or creating new ones in the middle of a listDatabases process.
Therefore, the databases view returned to the user may be inconsistent. For instance, we could return a pair of databases that have never co-existed.
You can find a reproducible in 11e4b7dd
The proposed solutions are the following:
1. Read a consistent view from the config server
- First fetch a consistent snapshot from config.collections and config.databases.
- Then, build the listDatabases response with that information.
- Finally, fetch the size of each database for each shard by running listDatabases across shards.
2. Another solution would be to execute listDatabases to all shards using a snapshot read at a specific cluster time. However, listDatabases doesn't support snapshot reads right not, so, unless we enable them somehow, this is not a real option.
- related to
-
SERVER-115710 Race condition between listDatabases and movePrimary
-
- In Code Review
-