Hello MongoDB Team,
We’re observing duplicate documents in the shards for one of our cluster.
This cluster has 2 shards, when queried from the router, shard1 and shard2 for the same _id - the same document is getting returned from both shards:
mongos> db.myColl.countDocuments({_id: _id})
1
mongos>
Shard0 Response:
shard0:PRIMARY> db.myColl.countDocuments({_id: _id})
1
shard0:PRIMARY>
Shard1 Response:
shard1:PRIMARY> db.myColl.countDocuments({_id: _id})
1
shard1:PRIMARY>
We performed the CleanupOrphaned multiple times on this cluster, but it did not cleanup the orphaned documents:
Shard0:
db.runCommand( {
cleanupOrphaned: "myDB.myColl"
} )
shard0:PRIMARY> db.runCommand( {
... cleanupOrphaned: "myDB.myColl"
... } )
2024-05-16T08:42:44.976+0000 I SHARDING [Collection-Range-Deleter] No documents remain to delete in myDB.myColl range [{ _id: MinKey }, { _id: -someid })
2024-05-16T08:42:44.977+0000 I SHARDING [Collection-Range-Deleter] Waiting for majority replication of local deletions in myDB.myColl range [{ _id: MinKey }, { _id: -someid })
2024-05-16T08:42:44.977+0000 I SHARDING [Collection-Range-Deleter] Finished deleting documents in myDB.myColl range [{ _id: MinKey }, { _id: -someid })
The cleanup ran successfully on both of the shards but did not perform orphaned documents cleanup successfully.
mongos> db.serverStatus().version
4.2.12
mongos>
Shard0:
Shard0:PRIMARY> db.serverStatus().version
4.2.12
Shard0:PRIMARY>
Shard1:
Shard1:PRIMARY> db.serverStatus().version
4.2.12
Shard1:PRIMARY>