summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/sharding_state.h
diff options
context:
space:
mode:
authorJoanna Huang <joannahuang@Joannas-MacBook-Pro.local>2017-07-18 13:31:11 -0400
committerJoanna Huang <joannahuang@Joannas-MacBook-Pro.local>2017-07-27 11:00:00 -0400
commit029669a994f92a2f0fe57c5ed06edec871d372ab (patch)
treef769e8cf305faee1175e565f8d71a2706332904c /src/mongo/db/s/sharding_state.h
parent74c6b215bc40e1229368cf26434c512ec2e0d433 (diff)
downloadmongo-029669a994f92a2f0fe57c5ed06edec871d372ab.tar.gz
SERVER-30096 Add stepdown/stepup logic to ChunkSplitter
Diffstat (limited to 'src/mongo/db/s/sharding_state.h')
-rw-r--r--src/mongo/db/s/sharding_state.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/s/sharding_state.h b/src/mongo/db/s/sharding_state.h
index d5f53976b7f..51654ee0a9a 100644
--- a/src/mongo/db/s/sharding_state.h
+++ b/src/mongo/db/s/sharding_state.h
@@ -35,6 +35,7 @@
#include "mongo/bson/oid.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/s/active_migrations_registry.h"
+#include "mongo/db/s/chunk_splitter.h"
#include "mongo/db/s/collection_range_deleter.h"
#include "mongo/db/s/migration_destination_manager.h"
#include "mongo/executor/task_executor.h"
@@ -143,6 +144,18 @@ public:
CollectionShardingState* getNS(const std::string& ns, OperationContext* opCtx);
/**
+ * Should be invoked when the shard server primary enters the 'PRIMARY' state.
+ * Sets up the ChunkSplitter to begin accepting split requests.
+ */
+ void initiateChunkSplitter();
+
+ /**
+ * Should be invoked when this node which is currently serving as a 'PRIMARY' steps down.
+ * Sets the state of the ChunkSplitter so that it will no longer accept split requests.
+ */
+ void interruptChunkSplitter();
+
+ /**
* Iterates through all known sharded collections and marks them (in memory only) as not sharded
* so that no filtering will be happening for slaveOk queries.
*/
@@ -311,6 +324,9 @@ private:
// Tracks the active move chunk operations running on this shard
ActiveMigrationsRegistry _activeMigrationsRegistry;
+ // Handles asynchronous auto-splitting of chunks
+ std::unique_ptr<ChunkSplitter> _chunkSplitter;
+
// Protects state below
stdx::mutex _mutex;