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

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.2.16, 3.4.9
    • Fix Version/s: 3.4.10
    • Component/s: Sharding
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Sharding 2017-10-02
    • Case:

      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

            • Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: