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

Implement BalancerStatisticsRegistry and command to retrieve its state

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • Sharding EMEA 2022-04-04, Sharding EMEA 2022-04-18

      Implement a BalancerStatsRegistry component living on the Grid on shards and initialized as part of initializeGlobalShardingStateMongoD.

      The high level idea is for this registry to provide some method to retrieve the following stats for sharded collections:

      The registry will just serve as a proxy for storage stats (numRecords and averageObjSize) and they're not going to be recalculated or tracked in memory. The only information that it will need to track in memory is the mapping namespace -> number of orphans (for the purpose of this ticket, orphan counters can simply be initialized to 0).

      The registry will serve as mean to retrieve collection sizes calculated as follows for a given namespace:

      collSize = average docs size * (number of docs - number of orphaned docs)
      

      Purpose of this ticket is to implement the BalancerStatsRegistry and provide a _shardsvrRetrieveStatsForBalancing command to retrieve its state in order to lie the ground for testing before implementing further functionalities.

      The _shardsvrRetrieveStatsForBalancing command accepts as arguments an optional namespace.

      If no namespace is specified, the command returns the collSizeMB for every sharded collection, for example:

      [{ns: 'db.coll', collSizeMB: 50MB}, {ns: "db.abc", collSizeMB: 24567MB}]

      If a namespace is specified, it only returns stat for the requested namespace.

      (The output example above is just to give an idea, it's possible to implement a better format, e.g. simply "ns" keys and "collSizeMB" values).

            Assignee:
            tommaso.tocci@mongodb.com Tommaso Tocci
            Reporter:
            pierlauro.sciarelli@mongodb.com Pierlauro Sciarelli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: