-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: 6.0.17, 5.0.29, 8.0.0-rc18, 7.0.14
-
Component/s: Distributed Query Planning, Sharding
-
None
-
Query Optimization
-
Fully Compatible
-
ALL
-
v8.0, v7.0, v6.0, v5.0
-
-
QO 2024-09-16, QO 2024-09-30, QO 2024-10-14
-
(copied to CRM)
-
0
-
None
-
None
-
None
-
None
-
None
-
None
-
None
ISSUE DESCRIPTION AND IMPACT
Queries against a sharded collection with a non-simple collation and an equality predicate against all fields of the sharding key may return duplicate records. This can only happen on a sharded collection during chunk migration. Non-sharded collections and queries issued when no chunk migrations are in progress are not affected. The issue will go away once the chunk migration has fully completed (including deletion of the orphaned documents from the donor shard). Since the issue only occurs transiently during chunk migration, no explicit remediation steps are required.
DIAGNOSIS AND AFFECTED VERSIONS
MongoDB 6.0.0 - 6.0.27, 7.0.0 - 7.0.28, 8.0.0 - 8.0.12
MongoDB 7.0.29, 8.0.13, and all later versions contain fixes for these issues.
REMEDIATION AND WORKAROUNDS
Customers are recommended to upgrade to the latest version that contains the fix. For MongoDB Atlas Customers on 7.0 and 8.0, your Atlas clusters have already been automatically upgraded to a version containing the fix.
There is currently no known workaround without upgrading the cluster.
Original description
In the case where we have a collection with non-simple default collation, and the collection is sharded on a field where the backing index has a simple collation (what's important here is that its just a different collation from the default collection collation), we cannot do shard targeting for an equality query with a non-simple collation so we broadcast the query to all shards. However, we also do not do shard filtering in this case. So if a chunk migration happens right before the query and the source shard hasn't yet cleaned up orphans, we will return duplicate results. I've attached a more thorough repro in the "steps to reproduce" section.
This happens on master, 8.0, 7.0, 6.0, and 5.0 (i.e. the repro I attached succeeds on all these versions).
- is caused by
-
SERVER-39191 Performance regression for counts post-sharding
-
- Closed
-
- is related to
-
SERVER-105047 Query using $or and $ne on sharded collection can include orphan documents
-
- Closed
-
- related to
-
SERVER-104157 Correct shard key in sharded_find_with_collation.js
-
- Closed
-
-
SERVER-94611 Update SHARDING_FILTER logic to support non-simple collation sharding
-
- Open
-
-
SERVER-106839 Make master shard filtering with collation consistent with 8.0
-
- Open
-
-
SERVER-92488 Expand IDHACK eligibility to include {_id: {$eq: <val>}}
-
- Closed
-