[SERVER-70445] Server crash when reading from sharded collections with user-created '<db>.system.buckets.<coll>' collection Created: 11/Oct/22  Updated: 29/Oct/23  Resolved: 11/Jan/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Bug Priority: Major - P3
Reporter: Jordi Serra Torrens Assignee: Rushan Chen
Resolution: Fixed Votes: 0
Labels: query-director-triage, sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-61589 Disallow users from creating collecti... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

sh.shardCollection('test.foo', {x:1})
db.system.buckets.foo.insert({a: 1})
db.foo.find()

Sprint: QE 2022-11-28, QE 2022-12-12, QE 2022-12-26, QE 2023-01-09, QE 2023-01-23, Sharding EMEA 2022-10-31
Participants:
Linked BF Score: 105

 Description   

Users should never create collections with the 'system.buckets' prefix. However, today nothing prevents it (SERVER-61589)

On a non time-series sharded collection <dbName>.<collName>, if the user manually creates the <db>system.buckets.<collName> collection, reads on the sharded collections will crash the server. This is because this logic will choose the bucket namespace to install on the OperationShardingState alongside the attached shardVersion. Then, when calling getOwnershipFilter, the namespace <db>.<collName> won't be found on the OperationShardingState and and invariant will be tripped.

One possible fix is to prevent users from creating the buckets collection (SERVER-61589). This tickets is to decide whether to go with that solution, or fix it in some different way.

Edit: This ticket is to fix the nss rewrite done on service_entry_point so that looks at the TimeseriesOptions to confirm whether it is really a timeseries collection.



 Comments   
Comment by Githook User [ 11/Jan/23 ]

Author:

{'name': 'Rushan Chen', 'email': 'rushan.chen@mongodb.com', 'username': 'ruchen'}

Message: SERVER-70445 check existence of TimeseriesOptions before using the time series bucket collection name space
Branch: master
https://github.com/mongodb/mongo/commit/37bbca32d5adc3654dff73b94816a7bd56cd9d42

Comment by Rushan Chen [ 09/Jan/23 ]

While this ticket solves (1), I agree we should also do (2) above. 

Generated at Thu Feb 08 06:16:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.