diff options
author | Tyler Seip <Tyler.Seip@mongodb.com> | 2021-03-10 10:56:44 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-22 19:20:07 +0000 |
commit | dbb6b0d496badf3e841ab41270e23cc0e4dc2ea4 (patch) | |
tree | ee07f7c243eb390c2a22ea360aa4ab760f4bd694 /src/mongo/db/service_context.h | |
parent | 52c650492d6ed4d5e9e197ab7fb82f9de225e807 (diff) | |
download | mongo-dbb6b0d496badf3e841ab41270e23cc0e4dc2ea4.tar.gz |
SERVER-53566: Protect ServiceContext from issuing duplicate operation IDs
Diffstat (limited to 'src/mongo/db/service_context.h')
-rw-r--r-- | src/mongo/db/service_context.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h index 1e4dffda45e..a518d03aaf1 100644 --- a/src/mongo/db/service_context.h +++ b/src/mongo/db/service_context.h @@ -36,6 +36,7 @@ #include <vector> #include "mongo/db/logical_session_id.h" +#include "mongo/db/operation_id.h" #include "mongo/db/storage/storage_engine.h" #include "mongo/platform/atomic_word.h" #include "mongo/platform/mutex.h" @@ -123,13 +124,6 @@ private: }; /** - * Every OperationContext is expected to have a unique OperationId within the domain of its - * ServiceContext. Generally speaking, OperationId is used for forming maps of OperationContexts and - * directing metaoperations like killop. - */ -using OperationId = uint32_t; - -/** * Users may provide an OperationKey when sending a command request as a stable token by which to * refer to an operation (and thus an OperationContext). An OperationContext is not required to have * an OperationKey. The presence of an OperationKey implies that the client is either closely @@ -692,6 +686,10 @@ private: std::vector<ClientObserverHolder> _clientObservers; ClientSet _clients; + /** + * Managing classes for our issued operation IDs. + */ + std::shared_ptr<UniqueOperationIdRegistry> _opIdRegistry; stdx::unordered_map<OperationId, Client*> _clientByOperationId; /** @@ -718,9 +716,6 @@ private: // protected by _mutex std::vector<KillOpListenerInterface*> _killOpListeners; - // Counter for assigning operation ids. - AtomicWord<OperationId> _nextOpId{1}; - // When the catalog is restarted, the generation goes up by one each time. AtomicWord<uint64_t> _catalogGeneration{0}; |