[SERVER-36047] (Sharded target collection) Enforce existence of unique index containing fields of $out uniqueKey Created: 10/Jul/18  Updated: 29/Oct/23  Resolved: 21/Sep/18

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 4.1.4

Type: Task Priority: Major - P3
Reporter: Kyle Suarez Assignee: Nicholas Zolnierz
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-35954 Build uniqueKey from the shard key if... Closed
depends on SERVER-36424 Make sure $out's uniqueKey is unique ... Closed
Related
related to SERVER-35896 Support "replaceDocuments" mode in $out Closed
related to SERVER-36318 Add ability to extract dotted path un... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2018-08-27, Query 2018-09-10, Query 2018-09-24, Query 2018-10-08
Participants:

 Description   

At aggregation planning time, we should acquire the appropriate locks and assert that there exists a unique index that contains all of the fields on the uniqueKey (where order of the fields does not matter).

If the uniqueKey is the document key, we must elide the check. The "document key" is

  • the _id for an unsharded collection
  • the _id and all the fields of the shard key for a sharded collection

If the output collection is sharded, the uniqueKey must contain all of the fields of the shard key, and there must exist a unique index containing exactly the remaining fields. For example, for a collection sharded on {x: 1} and a uniqueKey {x: 1, y: 1, z: 1}, we must enforce the existence of a unique index containing exactly the fields "x", "y" and "z" (in no particular order).

This work should already be done for unsharded collections in SERVER-36424, this ticket represents the work to make this happen when the target collection is sharded.



 Comments   
Comment by Githook User [ 21/Sep/18 ]

Author:

{'name': 'Nick Zolnierz', 'email': 'nicholas.zolnierz@mongodb.com', 'username': 'nzolnierzmdb'}

Message: SERVER-36047: Enforce existence of unique index containing fields of $out uniqueKey for sharded collections
Branch: master
https://github.com/mongodb/mongo/commit/3ef020ad55fa407241f503ff4c2a8af59ef181df

Comment by Kyle Suarez [ 09/Aug/18 ]

charlie.swanson interested in taking this on?

Generated at Thu Feb 08 04:41:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.