diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-04-11 10:40:13 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-04-14 14:13:53 -0400 |
commit | 83dce733e09188e2c6cefc63eb70abe5e94e61da (patch) | |
tree | c9e8eedb3356c273f5d9bda9dfb0078059afca0b /src/mongo/s/balance.h | |
parent | cb2f097f717298f70888f5283b94f9855558e561 (diff) | |
download | mongo-83dce733e09188e2c6cefc63eb70abe5e94e61da.tar.gz |
SERVER-23634 Move shard usage statistics gathering behind an interface
Currently the shard usage statistics gathering is done inline in the
balancer, together with some free functions in balancer_policy.cpp. This
change pulls out this common code and puts it behind an interface so we
can mock and unit-test it.
Diffstat (limited to 'src/mongo/s/balance.h')
-rw-r--r-- | src/mongo/s/balance.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/s/balance.h b/src/mongo/s/balance.h index 17b58384590..3b808f485d9 100644 --- a/src/mongo/s/balance.h +++ b/src/mongo/s/balance.h @@ -36,6 +36,7 @@ namespace mongo { +class ClusterStatistics; struct MigrateInfo; class MigrationSecondaryThrottleOptions; class OperationContext; @@ -62,6 +63,10 @@ public: */ static Balancer* get(OperationContext* operationContext); + ClusterStatistics* getClusterStatistics() const { + return _clusterStats.get(); + } + // BackgroundJob methods virtual void run(); @@ -83,7 +88,7 @@ private: /** * Marks this balancer as being live on the config server(s). */ - void _ping(OperationContext* txn, bool waiting = false); + void _ping(OperationContext* txn, bool waiting); /** * Returns true if all the servers listed in configdb as being shards are reachable and are @@ -120,6 +125,9 @@ private: // number of moved chunks in last round int _balancedLastTime; + + // Source for cluster statistics + std::unique_ptr<ClusterStatistics> _clusterStats; }; } // namespace mongo |