[SERVER-37572] Add support for sharded attribute to CollectionType Created: 11/Oct/18  Updated: 27/Oct/23  Resolved: 02/Nov/22

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Misha Tyulenev Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Gone away Votes: 0
Labels: MaxH, pm-1051-legacy-tickets
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding
Participants:

 Description   

Currently, if the collection is sharded it has a document in the config.collections collection. Unsharded collections do not have document in this collection. This project makes all collections have a corresponding document in the config.collections collection. The sharding code needs to distinguish sharded and unsharded collections. This will be done by adding a sharded attribute to the CollectionType class which describes the config server's config.collections document's schema.

Implementation

  1. Add boost::optional<bool> _sharded private member to the CollectionType class
  2. Add bool getSharded() const that will return implicit true as this is the current behavior: only sharded collections are in the config.collections"
  3. Add void setSharded(bool) setter
  4. in type_collection.cpp Define the name of the _sharded attribute for serialization. Will use partitioned to match existing attribute for databases
  5. implement CollectionType::toBSON support for _sharded attribute
  6. implement CollectionType::fromBSON support for _sharded attribute
  7. implement CollectionType::hasSameOptions support for _sharded attribute

Test

  1. Unit test to implement toBSON and fromBSON roundtrip
  2. Unit test for hasSameOptions
  3. Unit test for setSharded followed by getSharded
  4. Unit test that the unset value of getSharded defaults to "true"


 Comments   
Comment by Max Hirschhorn [ 02/Nov/22 ]

This ticket was originally part of PM-1051 but is no longer necessary.

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