We have a production cluster (2.4.10) composed of 3 shards. Each shard is a replica set with 2 MongoD and 1 Arbiter. There are also 2 MongoS that provide access to the cluster.
A few weeks back we had to rebuild one of our databases to support an application version upgrade.
The procedure was to drop the database and let the application recreate and repopulate a database with the same name.
Afterwards we noticed inconsistencies in the results provided by the application, digging deeper we realized that the database which is not sharded was showing in 2 replica-sets:
mongo-rs-1-1:PRIMARY> show dbs (...) VODRepository_UNIFIED 0.453125GB (...) mongo-rs-1-1:PRIMARY> mongo-rs-1-3:PRIMARY> show dbs (...) VODRepository_UNIFIED 0.453125GB (...) mongo-rs-1-3:PRIMARY>
Although both mongo-s instances showed the database in the same shard:
{ "_id" : "VODRepository_UNIFIED", "partitioned" : false, "primary" : "mongo-rs-1-3" }
Performing an explain on each node yields different results:
Mongo-s-1-1:
mongos> db.TitleAsset.find({ "MovieVideoStreams.AdiAssetId" : "CIMV624197D9C61F4806" }).limit(50).explain(); { "cursor" : "BasicCursor", "isMultiKey" : false, "n" : 1, "nscannedObjects" : 12455, "nscanned" : 12455, "nscannedObjectsAllPlans" : 12455, "nscannedAllPlans" : 12455, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 44, "indexBounds" : { }, "server" : "SVLMNIPDB16.mng.hdi.tvcabo:27018", "millis" : 44 } mongos>
Mongo-s-1-2:
mongos> db.TitleAsset.find({ "MovieVideoStreams.AdiAssetId" : "CIMV624197D9C61F4806" }).limit(50).explain(); { "cursor" : "BasicCursor", "isMultiKey" : false, "n" : 1, "nscannedObjects" : 12452, "nscanned" : 12452, "nscannedObjectsAllPlans" : 12452, "nscannedAllPlans" : 12452, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 44, "indexBounds" : { }, "server" : "SVLMNIPDB12.mng.hdi.tvcabo:27018", "millis" : 44 } mongos>
- duplicates
-
SERVER-17397 Dropping a Database or Collection in a Sharded Cluster may not fully succeed
- Closed