diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-03-05 14:59:08 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-03-05 18:15:00 -0500 |
commit | c207a0ced18bba58a8ad1b08df85b1e0a0b136f9 (patch) | |
tree | 74f0715f2143f115e45bdc3f226be4f7dd249f46 /src/mongo/db/s/chunk_splitter.h | |
parent | c7524de57dc3a9d829d8bce43e219c9e011094c5 (diff) | |
download | mongo-c207a0ced18bba58a8ad1b08df85b1e0a0b136f9.tar.gz |
SERVER-29908 Move ChunkSplitter to the `sharding_runtime_d` library
Diffstat (limited to 'src/mongo/db/s/chunk_splitter.h')
-rw-r--r-- | src/mongo/db/s/chunk_splitter.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/s/chunk_splitter.h b/src/mongo/db/s/chunk_splitter.h index 1d8a8fcdf06..91de6c7fe10 100644 --- a/src/mongo/db/s/chunk_splitter.h +++ b/src/mongo/db/s/chunk_splitter.h @@ -33,6 +33,8 @@ namespace mongo { class NamespaceString; +class OperationContext; +class ServiceContext; /** * Handles asynchronous auto-splitting of chunks. @@ -45,6 +47,12 @@ public: ~ChunkSplitter(); /** + * Obtains the service-wide chunk splitter instance. + */ + static ChunkSplitter& get(OperationContext* opCtx); + static ChunkSplitter& get(ServiceContext* serviceContext); + + /** * Sets the mode of the ChunkSplitter to either primary or secondary. * The ChunkSplitter is only active when primary. */ @@ -54,7 +62,7 @@ public: * Invoked when the shard server primary enters the 'PRIMARY' state to set up the ChunkSplitter * to begin accepting split requests. */ - void initiateChunkSplitter(); + void onStepUp(); /** * Invoked when this node which is currently serving as a 'PRIMARY' steps down. @@ -62,7 +70,7 @@ public: * This method might be called multiple times in succession, which is what happens as a result * of incomplete transition to primary so it is resilient to that. */ - void interruptChunkSplitter(); + void onStepDown(); /** * Schedules an autosplit task. This function throws on scheduling failure. @@ -90,7 +98,7 @@ private: stdx::mutex _mutex; // The ChunkSplitter is only active on a primary node. - bool _isPrimary; + bool _isPrimary{false}; // Thread pool for parallelizing splits. ThreadPool _threadPool; |