summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/balancer/balancer.h
diff options
context:
space:
mode:
authorKevin Pulo <kevin.pulo@mongodb.com>2018-03-16 13:31:09 +0000
committerKevin Pulo <kevin.pulo@mongodb.com>2018-03-16 13:32:10 +0000
commit9850f1f190f13fb5bfd229e35d55d8fee3adc58f (patch)
tree34bbe25a9117cf079758211b0d2f635f57daabc3 /src/mongo/db/s/balancer/balancer.h
parent8ab8025f23fb50d15336870a6cea4e4ca6f9673a (diff)
downloadmongo-9850f1f190f13fb5bfd229e35d55d8fee3adc58f.tar.gz
SERVER-16802 SERVER-28981 Balancer consider shards and collections in random order
Diffstat (limited to 'src/mongo/db/s/balancer/balancer.h')
-rw-r--r--src/mongo/db/s/balancer/balancer.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/db/s/balancer/balancer.h b/src/mongo/db/s/balancer/balancer.h
index 4288dfc018b..3afd190820a 100644
--- a/src/mongo/db/s/balancer/balancer.h
+++ b/src/mongo/db/s/balancer/balancer.h
@@ -30,6 +30,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/db/s/balancer/balancer_chunk_selection_policy.h"
+#include "mongo/db/s/balancer/balancer_random.h"
#include "mongo/db/s/balancer/migration_manager.h"
#include "mongo/stdx/condition_variable.h"
#include "mongo/stdx/mutex.h"
@@ -237,11 +238,15 @@ private:
// Number of moved chunks in last round
int _balancedLastTime;
- // Source for cluster statistics
+ // Source of randomness when metadata needs to be randomized.
+ BalancerRandomSource _random;
+
+ // Source for cluster statistics. Depends on the source of randomness above so it should be
+ // created after it and destroyed before it.
std::unique_ptr<ClusterStatistics> _clusterStats;
- // Balancer policy. Depends on the cluster statistics instance above so it should be created
- // after it and destroyed before it.
+ // Balancer policy. Depends on the cluster statistics instance and source of randomness above so
+ // it should be created after them and destroyed before them.
std::unique_ptr<BalancerChunkSelectionPolicy> _chunkSelectionPolicy;
// Migration manager used to schedule and manage migrations