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

Calling `shardCollection` after `enableSharding` may fail if executed against different mongos

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.2.16, 3.4.9
    • 3.4.10
    • Sharding
    • Fully Compatible
    • ALL
    • Sharding 2017-10-02

    Description

      The shardCollection command consults a property on the database called sharded. If sharding has not previously been enabled on a database though enableSharding, the shardCollection call will fail.

      If a mongos instance has cached a database entry, there is no mechanism to cause it to refresh it.

      Because of this, if multiple mongos instances have been operating on a given "unsharded" database, enabling sharding on that database will only be reflected on the mongos instance where enableSharding was called and all calls to shardCollection on these instances will continue failing, even though the database has been marked as sharded.

      Since shardCollection is not a frequent operation, it should be made to read the "sharded" property directly from the config server instead of the cache.

      Attachments

        Activity

          People

            kaloian.manassiev@mongodb.com Kaloian Manassiev
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: