-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
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:
- Count of documents (storage stat).
- Average document size (storage stat).
- Count of orphaned documents.
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).
- causes
-
SERVER-65326 Coverity analysis defect 122032: Division or modulo by zero
- Closed
- is depended on by
-
SERVER-64162 Initialize/destroy BalancerStatsRegistry upon upgrade/downgrade to 6.0
- Closed
-
SERVER-64198 Observer updating per-collection orphaned documents counters
- Closed