Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-37572

Add support for sharded attribute to CollectionType

    • Sharding

      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"

            Assignee:
            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            Reporter:
            misha.tyulenev@mongodb.com Misha Tyulenev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: