[SERVER-64196] Implement BalancerStatisticsRegistry and command to retrieve its state Created: 04/Mar/22  Updated: 29/Oct/23  Resolved: 05/Apr/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Pierlauro Sciarelli Assignee: Tommaso Tocci
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-64162 Initialize/destroy BalancerStatsRegis... Closed
is depended on by SERVER-64198 Observer updating per-collection orph... Closed
Problem/Incident
causes SERVER-65326 Coverity analysis defect 122032: Divi... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding EMEA 2022-04-04, Sharding EMEA 2022-04-18
Participants:

 Description   

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).



 Comments   
Comment by Githook User [ 05/Apr/22 ]

Author:

{'name': 'Tommaso Tocci', 'email': 'tommaso.tocci@mongodb.com', 'username': 'toto-dev'}

Message: SERVER-64196 Implement BalancerStatisticsRegistry and command to retrieve its state
Branch: master
https://github.com/mongodb/mongo/commit/865b891e92e201dc4a3e65e37524b13cfccb38a4

Generated at Thu Feb 08 05:59:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.