[SERVER-32727] disallow unique indexes on capped collections Created: 16/Jan/18 Updated: 27/Oct/23 Resolved: 09/Nov/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Benety Goh | Assignee: | Backlog - Storage Execution Team |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | rbfz | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Storage Execution
|
||||||||
| Participants: | |||||||||
| Linked BF Score: | 7 | ||||||||
| Description |
|
It does not really make sense to create a capped collection with additional constraints such as having unique indexes. In a replica set, capped collections are trimmed on a per-insert basis on every node and this may cause issues enforcing the unique index constraints as inserts are replicated from the primary to secondary nodes. |
| Comments |
| Comment by Daniel Gottlieb (Inactive) [ 03/Feb/22 ] |
|
For posterity, now that capped collections explicitly replicate deletes, we believe unique indexes will work as intended for capped collections. |
| Comment by Ian Whalen (Inactive) [ 19/Jan/18 ] |
|
max.hirschhorn we're not going to be able to fix this issue in capped collections and the larger fix is a while off. How would you like to fix this failure in the fuzzer? |
| Comment by Benety Goh [ 18/Jan/18 ] |
|
cloneCollectionAsCapped and convertToCapped are not affected by this issue because we do not recreate the indexes in the original collection: https://docs.mongodb.com/manual/reference/command/convertToCapped/#dbcmd.convertToCapped (convertToCapped calls cloneCollectionAsCapped internally) |
| Comment by Benety Goh [ 18/Jan/18 ] |
|
Besides createIndexes, we should also reject cloneCollectionAsCapped and convertToCapped requests on collections that contain unique indexes. Not sure about upgrade scenarios. |