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

getShardDistribution() erroneously reports "Collection XYZ is not sharded"

    XMLWordPrintable

    Details

    • Operating System:
      ALL
    • Sprint:
      Sharding 2019-10-21, Sharding 2019-11-04, Sharding 2019-11-18
    • Case:

      Description

      If collStats exceeds the maxBSONSize of 16MB due to a lot of shard metadata, getShardDistribution() erroneously reports that the collection is not sharded. This is caused by the function not checking for an error in the collStats command:

      > db.COLL.getShardDistribution
      function () {
       
          var stats = this.stats();
       
          if (!stats.sharded) {
              print("Collection " + this + " is not sharded.");
              return;
          }
       
          ... logic to print shard stats ...
      

      The stats.sharded property doesn't exist if stats contains an error message, which is why getShardDistribution() reports a collection as unsharded if its shard metadata causes the collStats command to fail.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: