diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2021-06-03 06:32:28 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-03 06:54:54 +0000 |
commit | dcd9f60e591acffeedabb5fa368f407a035473b2 (patch) | |
tree | 1b17c6b157ac8d951c987acc73548dedff096a37 /src/mongo/db/s/active_migrations_registry.h | |
parent | 4fac50c0a0c2b8f108cd32c90534aeedf2aa1e2e (diff) | |
download | mongo-dcd9f60e591acffeedabb5fa368f407a035473b2.tar.gz |
Revert "SERVER-56779 Allow multiple concurrent merges for the same collection across the cluster"
This reverts commit 13e28eb1e3a70211038e10afec3b6713fd63f4b8.
Diffstat (limited to 'src/mongo/db/s/active_migrations_registry.h')
-rw-r--r-- | src/mongo/db/s/active_migrations_registry.h | 73 |
1 files changed, 9 insertions, 64 deletions
diff --git a/src/mongo/db/s/active_migrations_registry.h b/src/mongo/db/s/active_migrations_registry.h index d3c4db28775..29b326cf4ef 100644 --- a/src/mongo/db/s/active_migrations_registry.h +++ b/src/mongo/db/s/active_migrations_registry.h @@ -30,6 +30,7 @@ #pragma once #include <boost/optional.hpp> +#include <memory> #include "mongo/db/s/migration_session_id.h" #include "mongo/platform/mutex.h" @@ -41,7 +42,8 @@ namespace mongo { class OperationContext; class ScopedDonateChunk; class ScopedReceiveChunk; -class ScopedSplitMergeChunk; +template <typename T> +class StatusWith; /** * Thread-safe object that keeps track of the active migrations running on a node and limits them @@ -68,9 +70,9 @@ public: void unlock(StringData reason); /** - * If there are no migrations or split/merges running on this shard, registers an active - * migration with the specified arguments. Returns a ScopedDonateChunk, which must be signaled - * by the caller before it goes out of scope. + * If there are no migrations running on this shard, registers an active migration with the + * specified arguments. Returns a ScopedDonateChunk, which must be signaled by the + * caller before it goes out of scope. * * If there is an active migration already running on this shard and it has the exact same * arguments, returns a ScopedDonateChunk. The ScopedDonateChunk can be used to join the @@ -82,10 +84,9 @@ public: const MoveChunkRequest& args); /** - * If there are no migrations or split/merges running on this shard, registers an active receive - * operation with the specified session id and returns a ScopedReceiveChunk. The - * ScopedReceiveChunk will unregister the migration when the ScopedReceiveChunk goes out of - * scope. + * If there are no migrations running on this shard, registers an active receive operation with + * the specified session id and returns a ScopedReceiveChunk. The ScopedReceiveChunk will + * unregister the migration when the ScopedReceiveChunk goes out of scope. * * Otherwise returns a ConflictingOperationInProgress error. */ @@ -95,14 +96,6 @@ public: const ShardId& fromShardId); /** - * If there are no migrations running on this shard, registers an active split or merge - * operation for the specified namespace and returns a scoped object which will in turn disallow - * other migrations or splits/merges for the same namespace (but not for other namespaces). - */ - StatusWith<ScopedSplitMergeChunk> registerSplitOrMergeChunk(const NamespaceString& nss, - const ChunkRange& chunkRange); - - /** * If a migration has been previously registered through a call to registerDonateChunk, returns * that namespace. Otherwise returns boost::none. */ @@ -119,7 +112,6 @@ public: private: friend class ScopedDonateChunk; friend class ScopedReceiveChunk; - friend class ScopedSplitMergeChunk; // Describes the state of a currently active moveChunk operation struct ActiveMoveChunkState { @@ -158,24 +150,6 @@ private: ShardId fromShardId; }; - // Describes the state of a currently active split or merge operation - struct ActiveSplitMergeChunkState { - ActiveSplitMergeChunkState(NamespaceString inNss, ChunkRange inRange) - : nss(std::move(inNss)), range(std::move(inRange)) {} - - /** - * Constructs an error status to return in the case of conflicting operations. - */ - Status constructErrorStatus() const; - - // Namespace for which a chunk is being split or merged - NamespaceString nss; - - // If split, bounds of the chunk being split; if merge, the end bounds of the range being - // merged - ChunkRange range; - }; - /** * Unregisters a previously registered namespace with an ongoing migration. Must only be called * if a previous call to registerDonateChunk has succeeded. @@ -188,12 +162,6 @@ private: */ void _clearReceiveChunk(); - /** - * Unregisters a previously registered split/merge chunk operation. Must only be called if a - * previous call to registerSplitOrMergeChunk has succeeded. - */ - void _clearSplitMergeChunk(const NamespaceString& nss); - // Protects the state below Mutex _mutex = MONGO_MAKE_LATCH("ActiveMigrationsRegistry::_mutex"); stdx::condition_variable _lockCond; @@ -205,10 +173,6 @@ private: // If there is an active chunk receive operation, this field contains the original session id boost::optional<ActiveReceiveChunkState> _activeReceiveChunkState; - - // If there is an active split or merge chunk operation for a particular namespace, this map - // will contain an entry - stdx::unordered_map<NamespaceString, ActiveSplitMergeChunkState> _activeSplitMergeChunkStates; }; class MigrationBlockingGuard { @@ -305,23 +269,4 @@ private: ActiveMigrationsRegistry* _registry; }; -/** - * Object of this class is returned from the registerSplitOrMergeChunk call of the active migrations - * registry. - */ -class ScopedSplitMergeChunk { -public: - ScopedSplitMergeChunk(ActiveMigrationsRegistry* registry, const NamespaceString& nss); - ~ScopedSplitMergeChunk(); - - ScopedSplitMergeChunk(ScopedSplitMergeChunk&&); - ScopedSplitMergeChunk& operator=(ScopedSplitMergeChunk&&); - -private: - // Registry from which to unregister the split/merge. Not owned. - ActiveMigrationsRegistry* _registry; - - NamespaceString _nss; -}; - } // namespace mongo |