diff options
| author | Benety Goh <benety@mongodb.com> | 2021-09-30 06:06:45 -0400 |
|---|---|---|
| committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-09-30 10:31:04 +0000 |
| commit | 2eefd197e50c5d90b3ec0e0ad9ac15a8b14e3331 (patch) | |
| tree | 7a613cbce58ed53af87256733bbebb115159f6e5 /src | |
| parent | 5291cb9e3cf942de61ac8008d484dbe39273dec9 (diff) | |
| download | mongo-2eefd197e50c5d90b3ec0e0ad9ac15a8b14e3331.tar.gz | |
SERVER-59618 require Locker instance when creating OperationContext
Diffstat (limited to 'src')
| -rw-r--r-- | src/mongo/db/SConscript | 3 | ||||
| -rw-r--r-- | src/mongo/db/service_context.cpp | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index 9dc86244a59..5d98785ebde 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -484,6 +484,9 @@ env.Library( '$BUILD_DIR/mongo/util/periodic_runner', 'write_concern_options', ], + LIBDEPS_PRIVATE=[ + '$BUILD_DIR/mongo/util/processinfo', + ], ) env.Library( diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp index 551bc7cdf34..ffd81da4346 100644 --- a/src/mongo/db/service_context.cpp +++ b/src/mongo/db/service_context.cpp @@ -39,7 +39,6 @@ #include "mongo/base/init.h" #include "mongo/bson/bsonobj.h" #include "mongo/db/client.h" -#include "mongo/db/concurrency/locker_noop.h" #include "mongo/db/default_baton.h" #include "mongo/db/op_observer.h" #include "mongo/db/operation_context.h" @@ -49,6 +48,7 @@ #include "mongo/transport/session.h" #include "mongo/transport/transport_layer.h" #include "mongo/util/assert_util.h" +#include "mongo/util/processinfo.h" #include "mongo/util/str.h" #include "mongo/util/system_clock_source.h" #include "mongo/util/system_tick_source.h" @@ -251,9 +251,8 @@ ServiceContext::UniqueOperationContext ServiceContext::makeOperationContext(Clie onCreate(opCtx.get(), _clientObservers); ScopeGuard onCreateGuard([&] { onDestroy(opCtx.get(), _clientObservers); }); - if (!opCtx->lockState()) { - opCtx->setLockState(std::make_unique<LockerNoop>()); - } + invariant(opCtx->lockState(), ProcessInfo().getProcessName()); + if (!opCtx->recoveryUnit()) { opCtx->setRecoveryUnit(std::make_unique<RecoveryUnitNoop>(), WriteUnitOfWork::RecoveryUnitState::kNotInUnitOfWork); |
