Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1326

Changes to sh.status() for 6.0.3+ clusters

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.3.3
    • Affects Version/s: None
    • Component/s: sh
    • None
    • 5
    • Needed
    • Hide

      For MongoDB 6.0.3+, in Mongo Shell 2.3.3+ sh.status() will include a new `shardedDataDistribution` field.

      Format of it as is follows (equivalent to the result of running the aggregate function $shardedDataDistribution)

      export type ShardedDataDistribution = {    
        ns: string;
        shards: {
          shardName: string;
          numOrphanedDocs: number;
          numOwnedDocuments: number;
          orphanedSizeBytes: number;
          ownedSizeBytes: number;
        }[];
      }[]; 

      See also: https://github.com/mongodb-js/mongosh/pull/2214/files

      Show
      For MongoDB 6.0.3+, in Mongo Shell 2.3.3+ sh.status() will include a new `shardedDataDistribution` field. Format of it as is follows (equivalent to the result of running the aggregate function $shardedDataDistribution) export type ShardedDataDistribution = {       ns: string;   shards: {     shardName: string;     numOrphanedDocs: number;     numOwnedDocuments: number;     orphanedSizeBytes: number;     ownedSizeBytes: number;   }[]; }[]; See also: https://github.com/mongodb-js/mongosh/pull/2214/files

      Starting in 6.0.3, where a shared cluster would be balancing the shards using range migration based on the volume of data in the namespace, the current output of the sh.status() does not help to identify if the cluster is well balanced. 

      Considering the balancing of a sharded namespace would be sensitive to orphans and data volume, and in order to count with a mechanism that easily allows checking the current state of the cluster, it would be good if the sh.status() provides the following information per sharded namespaces:

      • Estimated number of orphan documents per shard
      • Data volume per shard

      Or something similar to the $shardedDataDistribution aggregation stage.

            Assignee:
            gagik.amaryan@mongodb.com Gagik Amaryan
            Reporter:
            tommaso.tocci@mongodb.com Tommaso Tocci
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: