summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2023-05-17 20:08:16 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-17 22:37:54 +0000
commitde55cd2ac227dcc8cae2fd021abc291e86b2abb2 (patch)
treedadd422bba22ca11a54256e651024d3c9512f61f
parent02bf3f55f88874bf397b42758c9cd36093633f9e (diff)
downloadmongo-de55cd2ac227dcc8cae2fd021abc291e86b2abb2.tar.gz
SERVER-77224 Rename lock_state.h/.cpp to locker_impl.h/.cpp to match the class name
-rw-r--r--buildscripts/gdb/mongo.py2
-rw-r--r--buildscripts/gdb/mongo_lock.py2
-rw-r--r--src/mongo/crypto/SConscript1
-rw-r--r--src/mongo/db/SConscript2
-rw-r--r--src/mongo/db/auth/SConscript1
-rw-r--r--src/mongo/db/catalog/capped_collection_test.cpp4
-rw-r--r--src/mongo/db/catalog/collection_catalog_bm.cpp2
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp4
-rw-r--r--src/mongo/db/catalog_raii_test.cpp2
-rw-r--r--src/mongo/db/commands/SConscript1
-rw-r--r--src/mongo/db/commands/current_op.cpp3
-rw-r--r--src/mongo/db/commands/lock_info.cpp6
-rw-r--r--src/mongo/db/concurrency/SConscript25
-rw-r--r--src/mongo/db/concurrency/d_concurrency.cpp23
-rw-r--r--src/mongo/db/concurrency/d_concurrency.h21
-rw-r--r--src/mongo/db/concurrency/lock_manager.h2
-rw-r--r--src/mongo/db/concurrency/lock_manager_defs.cpp2
-rw-r--r--src/mongo/db/concurrency/lock_manager_test_help.h2
-rw-r--r--src/mongo/db/concurrency/locker.cpp38
-rw-r--r--src/mongo/db/concurrency/locker.h4
-rw-r--r--src/mongo/db/concurrency/locker_impl.cpp (renamed from src/mongo/db/concurrency/lock_state.cpp)18
-rw-r--r--src/mongo/db/concurrency/locker_impl.h (renamed from src/mongo/db/concurrency/lock_state.h)10
-rw-r--r--src/mongo/db/concurrency/locker_impl_test.cpp (renamed from src/mongo/db/concurrency/lock_state_test.cpp)0
-rw-r--r--src/mongo/db/curop.h2
-rw-r--r--src/mongo/db/db_raii_multi_collection_test.cpp2
-rw-r--r--src/mongo/db/db_raii_test.cpp2
-rw-r--r--src/mongo/db/exec/sbe/abt/sbe_abt_diff_test.cpp2
-rw-r--r--src/mongo/db/index/SConscript2
-rw-r--r--src/mongo/db/introspect.cpp2
-rw-r--r--src/mongo/db/mongod_main.cpp2
-rw-r--r--src/mongo/db/operation_context.h6
-rw-r--r--src/mongo/db/pipeline/process_interface/shardsvr_process_interface_test.cpp2
-rw-r--r--src/mongo/db/process_health/SConscript1
-rw-r--r--src/mongo/db/query/SConscript14
-rw-r--r--src/mongo/db/query/ce/maxdiff_histogram_test.cpp2
-rw-r--r--src/mongo/db/query/optimizer/SConscript1
-rw-r--r--src/mongo/db/repl/apply_ops.cpp1
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp5
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_test.cpp6
-rw-r--r--src/mongo/db/service_entry_point_mongod.cpp6
-rw-r--r--src/mongo/db/shard_role.cpp5
-rw-r--r--src/mongo/db/shard_role.h6
-rw-r--r--src/mongo/db/storage/SConscript2
-rw-r--r--src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp5
-rw-r--r--src/mongo/db/storage/storage_engine_init.cpp8
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp9
-rw-r--r--src/mongo/db/transaction/transaction_participant.cpp3
-rw-r--r--src/mongo/db/transaction/transaction_participant_test.cpp1
-rw-r--r--src/mongo/embedded/embedded.cpp5
-rw-r--r--src/mongo/executor/SConscript1
-rw-r--r--src/mongo/s/SConscript1
-rw-r--r--src/mongo/shell/SConscript1
-rw-r--r--src/mongo/tools/mongobridge_tool/SConscript13
-rw-r--r--src/mongo/transport/SConscript2
-rw-r--r--src/mongo/unittest/SConscript3
-rw-r--r--src/mongo/util/concurrency/SConscript14
-rw-r--r--src/mongo/util/concurrency/priority_ticketholder.cpp5
-rw-r--r--src/mongo/util/concurrency/priority_ticketholder_test.cpp1
-rw-r--r--src/mongo/util/concurrency/semaphore_ticketholder.cpp7
-rw-r--r--src/mongo/util/concurrency/ticketholder.cpp7
60 files changed, 150 insertions, 182 deletions
diff --git a/buildscripts/gdb/mongo.py b/buildscripts/gdb/mongo.py
index c7ea555513e..8f20f1caa85 100644
--- a/buildscripts/gdb/mongo.py
+++ b/buildscripts/gdb/mongo.py
@@ -584,8 +584,6 @@ class MongoDBDumpLocks(gdb.Command):
try:
# Call into mongod, and dump the state of lock manager
# Note that output will go to mongod's standard output, not the debugger output window
- # Do not call mongo::getGlobalLockManager() due to the compiler optimizing this function in a very weird way
- # See SERVER-72816 for more context
gdb.execute(
"call mongo::LockManager::get((mongo::ServiceContext*) mongo::getGlobalServiceContext())->dump()",
from_tty=False, to_string=False)
diff --git a/buildscripts/gdb/mongo_lock.py b/buildscripts/gdb/mongo_lock.py
index d05acaf6779..a7f7e271926 100644
--- a/buildscripts/gdb/mongo_lock.py
+++ b/buildscripts/gdb/mongo_lock.py
@@ -325,8 +325,6 @@ def find_lock_manager_holders(graph, thread_dict, show):
locker_ptr_type = gdb.lookup_type("mongo::LockerImpl").pointer()
- # Do not call mongo::getGlobalLockManager() due to the compiler optimizing this function in a very weird way
- # See SERVER-72816 for more context
lock_head = gdb.parse_and_eval(
"mongo::LockManager::get((mongo::ServiceContext*) mongo::getGlobalServiceContext())->_getBucket(resId)->findOrInsert(resId)"
)
diff --git a/src/mongo/crypto/SConscript b/src/mongo/crypto/SConscript
index 67aadbffd76..3271c7b0b73 100644
--- a/src/mongo/crypto/SConscript
+++ b/src/mongo/crypto/SConscript
@@ -156,6 +156,7 @@ env.CppUnitTest(
LIBDEPS=[
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/base/secure_allocator',
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/shell/kms_idl',
'$BUILD_DIR/mongo/util/net/http_client_impl',
'$BUILD_DIR/mongo/util/net/openssl_init' if ssl_provider == 'openssl' else [],
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index d0e8b323673..eaafde9af99 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -767,7 +767,7 @@ env.Library(
)
env.Library(
- target="metadata_consistency_types_idl",
+ target='metadata_consistency_types_idl',
source=[
'metadata_consistency_types.idl',
],
diff --git a/src/mongo/db/auth/SConscript b/src/mongo/db/auth/SConscript
index 59b102026fd..ee465b1e438 100644
--- a/src/mongo/db/auth/SConscript
+++ b/src/mongo/db/auth/SConscript
@@ -489,6 +489,7 @@ env.Library(
'authz_session_external_state_mock.cpp',
],
LIBDEPS=[
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/query_expressions',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/db/update/update_driver',
diff --git a/src/mongo/db/catalog/capped_collection_test.cpp b/src/mongo/db/catalog/capped_collection_test.cpp
index b95317f207d..3d23339c768 100644
--- a/src/mongo/db/catalog/capped_collection_test.cpp
+++ b/src/mongo/db/catalog/capped_collection_test.cpp
@@ -27,13 +27,11 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
#include "mongo/db/catalog/capped_visibility.h"
#include "mongo/db/catalog/catalog_test_fixture.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/collection_write_path.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/record_id_helpers.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
diff --git a/src/mongo/db/catalog/collection_catalog_bm.cpp b/src/mongo/db/catalog/collection_catalog_bm.cpp
index 57898636095..0fd4bf9d9bc 100644
--- a/src/mongo/db/catalog/collection_catalog_bm.cpp
+++ b/src/mongo/db/catalog/collection_catalog_bm.cpp
@@ -32,7 +32,7 @@
#include "mongo/db/catalog/collection_catalog.h"
#include "mongo/db/catalog/collection_mock.h"
#include "mongo/db/concurrency/d_concurrency.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/service_context.h"
#include "mongo/util/uuid.h"
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index c0f0f633423..8c171c2532f 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -42,7 +42,6 @@
#include "mongo/db/catalog/unique_collection_name.h"
#include "mongo/db/client.h"
#include "mongo/db/concurrency/exception_util.h"
-#include "mongo/db/concurrency/lock_state.h"
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/index/index_descriptor.h"
@@ -54,10 +53,9 @@
#include "mongo/db/ops/insert.h"
#include "mongo/db/query/query_knobs_gen.h"
#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/s/database_sharding_state.h"
-#include "mongo/db/s/operation_sharding_state.h"
#include "mongo/db/server_options.h"
#include "mongo/db/service_context.h"
+#include "mongo/db/shard_role.h"
#include "mongo/db/storage/storage_parameters_gen.h"
#include "mongo/logv2/log.h"
#include "mongo/util/fail_point.h"
diff --git a/src/mongo/db/catalog_raii_test.cpp b/src/mongo/db/catalog_raii_test.cpp
index f035cc6bd2e..158b8111163 100644
--- a/src/mongo/db/catalog_raii_test.cpp
+++ b/src/mongo/db/catalog_raii_test.cpp
@@ -30,7 +30,7 @@
#include "mongo/db/catalog/database_holder_mock.h"
#include "mongo/db/catalog_raii.h"
#include "mongo/db/client.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/service_context_test_fixture.h"
#include "mongo/db/storage/recovery_unit_noop.h"
#include "mongo/logv2/log.h"
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index a1b52019334..26ed44f60af 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -199,6 +199,7 @@ env.Library(
'$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/query/op_metrics',
'$BUILD_DIR/mongo/db/storage/backup_cursor_hooks',
+ '$BUILD_DIR/mongo/util/background_job',
'fsync_locked',
],
)
diff --git a/src/mongo/db/commands/current_op.cpp b/src/mongo/db/commands/current_op.cpp
index dd888b36db8..913265cba27 100644
--- a/src/mongo/db/commands/current_op.cpp
+++ b/src/mongo/db/commands/current_op.cpp
@@ -27,8 +27,6 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
#include "mongo/db/commands/current_op_common.h"
#include "mongo/db/auth/action_type.h"
@@ -39,7 +37,6 @@
#include "mongo/db/exec/document_value/document.h"
#include "mongo/db/pipeline/aggregate_command_gen.h"
#include "mongo/db/pipeline/aggregation_request_helper.h"
-#include "mongo/db/stats/fill_locker_info.h"
namespace mongo {
diff --git a/src/mongo/db/commands/lock_info.cpp b/src/mongo/db/commands/lock_info.cpp
index d7e77df6453..2f75ed1be36 100644
--- a/src/mongo/db/commands/lock_info.cpp
+++ b/src/mongo/db/commands/lock_info.cpp
@@ -27,16 +27,10 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include <map>
-
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
-#include "mongo/db/concurrency/lock_manager_defs.h"
-#include "mongo/db/concurrency/lock_state.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/service_context.h"
diff --git a/src/mongo/db/concurrency/SConscript b/src/mongo/db/concurrency/SConscript
index efd2d335cf2..872b28b8047 100644
--- a/src/mongo/db/concurrency/SConscript
+++ b/src/mongo/db/concurrency/SConscript
@@ -37,39 +37,29 @@ env.Library(
)
env.Library(
- target='lock_manager_defs',
- source=[
- 'lock_manager_defs.cpp',
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
- '$BUILD_DIR/mongo/util/namespace_string_database_name_util',
- ],
-)
-
-env.Library(
target='lock_manager',
source=[
'd_concurrency.cpp',
'lock_manager.cpp',
- 'lock_state.cpp',
+ 'lock_manager_defs.cpp',
'lock_stats.cpp',
+ 'locker.cpp',
+ 'locker_impl.cpp',
'replication_state_transition_lock_guard.cpp',
'resource_catalog.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/db/storage/concurrency_adjustment_parameters',
'$BUILD_DIR/mongo/db/storage/storage_engine_parameters',
- '$BUILD_DIR/mongo/util/background_job',
'$BUILD_DIR/mongo/util/concurrency/spin_lock',
'$BUILD_DIR/mongo/util/concurrency/ticketholder',
- '$BUILD_DIR/third_party/shim_boost',
- 'lock_manager_defs',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/concurrency/flow_control_ticketholder',
'$BUILD_DIR/mongo/db/server_base',
+ '$BUILD_DIR/mongo/db/service_context',
+ '$BUILD_DIR/mongo/util/background_job',
+ '$BUILD_DIR/mongo/util/namespace_string_database_name_util',
],
)
@@ -89,6 +79,7 @@ env.Benchmark(
'd_concurrency_bm.cpp',
],
LIBDEPS=[
+ '$BUILD_DIR/mongo/db/service_context',
'lock_manager',
],
)
@@ -99,8 +90,8 @@ env.CppUnitTest(
'd_concurrency_test.cpp',
'fast_map_noalloc_test.cpp',
'lock_manager_test.cpp',
- 'lock_state_test.cpp',
'lock_stats_test.cpp',
+ 'locker_impl_test.cpp',
'resource_catalog_test.cpp',
],
LIBDEPS=[
diff --git a/src/mongo/db/concurrency/d_concurrency.cpp b/src/mongo/db/concurrency/d_concurrency.cpp
index fe7daed7201..9fe447c15f0 100644
--- a/src/mongo/db/concurrency/d_concurrency.cpp
+++ b/src/mongo/db/concurrency/d_concurrency.cpp
@@ -29,11 +29,9 @@
#include "mongo/db/concurrency/d_concurrency.h"
-#include <memory>
#include <string>
#include <vector>
-#include "mongo/db/concurrency/flow_control_ticketholder.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/service_context.h"
#include "mongo/logv2/log.h"
@@ -178,6 +176,27 @@ Lock::GlobalLock::GlobalLock(GlobalLock&& otherLock)
otherLock._result = LOCK_INVALID;
}
+Lock::GlobalLock::~GlobalLock() {
+ // Preserve the original lock result which will be overridden by unlock().
+ auto lockResult = _result;
+ auto* locker = _opCtx->lockState();
+
+ if (isLocked()) {
+ // Abandon our snapshot if destruction of the GlobalLock object results in actually
+ // unlocking the global lock. Recursive locking and the two-phase locking protocol may
+ // prevent lock release.
+ const bool willReleaseLock = _isOutermostLock && !locker->inAWriteUnitOfWork();
+ if (willReleaseLock) {
+ _opCtx->recoveryUnit()->abandonSnapshot();
+ }
+ _unlock();
+ }
+
+ if (!_skipRSTLLock && (lockResult == LOCK_OK || lockResult == LOCK_WAITING)) {
+ locker->unlock(resourceIdReplicationStateTransitionLock);
+ }
+}
+
void Lock::GlobalLock::_unlock() {
_opCtx->lockState()->unlockGlobal();
_result = LOCK_INVALID;
diff --git a/src/mongo/db/concurrency/d_concurrency.h b/src/mongo/db/concurrency/d_concurrency.h
index aacd3b6d724..9cf4aef7c7e 100644
--- a/src/mongo/db/concurrency/d_concurrency.h
+++ b/src/mongo/db/concurrency/d_concurrency.h
@@ -29,8 +29,6 @@
#pragma once
-#include <climits> // For UINT_MAX
-
#include "mongo/db/concurrency/locker.h"
#include "mongo/db/operation_context.h"
#include "mongo/util/timer.h"
@@ -246,24 +244,7 @@ public:
GlobalLock(GlobalLock&&);
- ~GlobalLock() {
- // Preserve the original lock result which will be overridden by unlock().
- auto lockResult = _result;
- if (isLocked()) {
- // Abandon our snapshot if destruction of the GlobalLock object results in actually
- // unlocking the global lock. Recursive locking and the two-phase locking protocol
- // may prevent lock release.
- const bool willReleaseLock = _isOutermostLock &&
- !(_opCtx->lockState() && _opCtx->lockState()->inAWriteUnitOfWork());
- if (willReleaseLock) {
- _opCtx->recoveryUnit()->abandonSnapshot();
- }
- _unlock();
- }
- if (!_skipRSTLLock && (lockResult == LOCK_OK || lockResult == LOCK_WAITING)) {
- _opCtx->lockState()->unlock(resourceIdReplicationStateTransitionLock);
- }
- }
+ ~GlobalLock();
bool isLocked() const {
return _result == LOCK_OK;
diff --git a/src/mongo/db/concurrency/lock_manager.h b/src/mongo/db/concurrency/lock_manager.h
index 4b82349432c..18a20900332 100644
--- a/src/mongo/db/concurrency/lock_manager.h
+++ b/src/mongo/db/concurrency/lock_manager.h
@@ -63,8 +63,6 @@ public:
* Retrieves the lock manager instance attached to this ServiceContext.
* The lock manager is now a decoration on the service context and this is the accessor that
* most callers should prefer outside of startup, lock internals, and debugger scripts.
- * Using the ServiceContext and OperationContext versions where possible is preferable to
- * getGlobalLockManager().
*/
static LockManager* get(ServiceContext* service);
static LockManager* get(ServiceContext& service);
diff --git a/src/mongo/db/concurrency/lock_manager_defs.cpp b/src/mongo/db/concurrency/lock_manager_defs.cpp
index 38f3976c0ea..655340a355d 100644
--- a/src/mongo/db/concurrency/lock_manager_defs.cpp
+++ b/src/mongo/db/concurrency/lock_manager_defs.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#include "lock_manager_defs.h"
+#include "mongo/db/concurrency/lock_manager_defs.h"
namespace mongo {
diff --git a/src/mongo/db/concurrency/lock_manager_test_help.h b/src/mongo/db/concurrency/lock_manager_test_help.h
index 5eba9d33dbd..c7b9212dc03 100644
--- a/src/mongo/db/concurrency/lock_manager_test_help.h
+++ b/src/mongo/db/concurrency/lock_manager_test_help.h
@@ -30,7 +30,7 @@
#pragma once
#include "mongo/db/concurrency/lock_manager.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
namespace mongo {
diff --git a/src/mongo/db/concurrency/locker.cpp b/src/mongo/db/concurrency/locker.cpp
new file mode 100644
index 00000000000..296ed9f9e63
--- /dev/null
+++ b/src/mongo/db/concurrency/locker.cpp
@@ -0,0 +1,38 @@
+/**
+ * Copyright (C) 2023-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/db/concurrency/locker.h"
+
+namespace mongo {
+
+Locker::Locker() = default;
+
+Locker::~Locker() = default;
+
+} // namespace mongo
diff --git a/src/mongo/db/concurrency/locker.h b/src/mongo/db/concurrency/locker.h
index 59a4c92d9c5..26f12adbd0b 100644
--- a/src/mongo/db/concurrency/locker.h
+++ b/src/mongo/db/concurrency/locker.h
@@ -57,7 +57,7 @@ class Locker {
public:
using LockTimeoutCallback = std::function<void()>;
- virtual ~Locker() {}
+ virtual ~Locker();
/**
* Returns true if this is an instance of LockerNoop. Because LockerNoop doesn't implement many
@@ -570,7 +570,7 @@ public:
}
protected:
- Locker() {}
+ Locker();
/**
* The number of callers that are guarding from lock interruptions.
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/locker_impl.cpp
index e53a2e955b7..a45cb05679d 100644
--- a/src/mongo/db/concurrency/lock_state.cpp
+++ b/src/mongo/db/concurrency/locker_impl.cpp
@@ -27,16 +27,12 @@
* it in the license file.
*/
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include <vector>
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/bson/json.h"
-#include "mongo/db/concurrency/flow_control_ticketholder.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/flow_control.h"
@@ -141,6 +137,12 @@ PartitionedInstanceWideLockStats globalStats;
} // namespace
+LockManager* getGlobalLockManager() {
+ auto serviceContext = getGlobalServiceContext();
+ invariant(serviceContext);
+ return LockManager::get(serviceContext);
+}
+
bool LockerImpl::_shouldDelayUnlock(ResourceId resId, LockMode mode) const {
switch (resId.getType()) {
case RESOURCE_MUTEX:
@@ -1228,12 +1230,6 @@ public:
// Standalone functions
//
-LockManager* getGlobalLockManager() {
- auto serviceContext = getGlobalServiceContext();
- invariant(serviceContext);
- return LockManager::get(serviceContext);
-}
-
void reportGlobalLockingStats(SingleThreadedLockStats* outStats) {
globalStats.report(outStats);
}
diff --git a/src/mongo/db/concurrency/lock_state.h b/src/mongo/db/concurrency/locker_impl.h
index 0d19a10cac8..2f83580de83 100644
--- a/src/mongo/db/concurrency/lock_state.h
+++ b/src/mongo/db/concurrency/locker_impl.h
@@ -436,14 +436,4 @@ public:
}
};
-/**
- * Retrieves the global lock manager instance.
- * Legacy global lock manager accessor for internal lock implementation * and debugger scripts
- * such as gdb/mongo_lock.py.
- * The lock manager is now a decoration on the service context and this accessor is retained for
- * startup, lock internals, and debugger scripts.
- * Using LockManager::get(ServiceContext*) where possible is preferable.
- */
-LockManager* getGlobalLockManager();
-
} // namespace mongo
diff --git a/src/mongo/db/concurrency/lock_state_test.cpp b/src/mongo/db/concurrency/locker_impl_test.cpp
index 6e67f7c31ea..6e67f7c31ea 100644
--- a/src/mongo/db/concurrency/lock_state_test.cpp
+++ b/src/mongo/db/concurrency/locker_impl_test.cpp
diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h
index 9f5c32b10d1..c19586d5833 100644
--- a/src/mongo/db/curop.h
+++ b/src/mongo/db/curop.h
@@ -30,8 +30,6 @@
#pragma once
-#include <memory>
-
#include "mongo/config.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/auth/user_acquisition_stats.h"
diff --git a/src/mongo/db/db_raii_multi_collection_test.cpp b/src/mongo/db/db_raii_multi_collection_test.cpp
index da00f5b9fa5..439697d2128 100644
--- a/src/mongo/db/db_raii_multi_collection_test.cpp
+++ b/src/mongo/db/db_raii_multi_collection_test.cpp
@@ -29,7 +29,7 @@
#include "mongo/db/catalog/catalog_test_fixture.h"
#include "mongo/db/client.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/db_raii.h"
#include "mongo/logv2/log.h"
#include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/db_raii_test.cpp b/src/mongo/db/db_raii_test.cpp
index d2eba6919cc..64f421c988e 100644
--- a/src/mongo/db/db_raii_test.cpp
+++ b/src/mongo/db/db_raii_test.cpp
@@ -31,7 +31,7 @@
#include "mongo/db/catalog/catalog_test_fixture.h"
#include "mongo/db/client.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/query/find_common.h"
#include "mongo/db/query/get_executor.h"
diff --git a/src/mongo/db/exec/sbe/abt/sbe_abt_diff_test.cpp b/src/mongo/db/exec/sbe/abt/sbe_abt_diff_test.cpp
index d71b3d040d6..7557690d993 100644
--- a/src/mongo/db/exec/sbe/abt/sbe_abt_diff_test.cpp
+++ b/src/mongo/db/exec/sbe/abt/sbe_abt_diff_test.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/exec/sbe/abt/sbe_abt_test_util.h"
#include "mongo/unittest/temp_dir.h"
diff --git a/src/mongo/db/index/SConscript b/src/mongo/db/index/SConscript
index 6a386ae1ada..c26571bde0f 100644
--- a/src/mongo/db/index/SConscript
+++ b/src/mongo/db/index/SConscript
@@ -70,13 +70,11 @@ iamEnv.Library(
'$BUILD_DIR/mongo/db/multi_key_path_tracker',
'$BUILD_DIR/mongo/db/pipeline/document_path_support',
'$BUILD_DIR/mongo/db/query/collation/collator_factory_interface',
- '$BUILD_DIR/mongo/db/query/collation/collator_interface',
'$BUILD_DIR/mongo/db/query/op_metrics',
'$BUILD_DIR/mongo/db/query/projection_ast',
'$BUILD_DIR/mongo/db/query/sort_pattern',
'$BUILD_DIR/mongo/db/query_expressions',
'$BUILD_DIR/mongo/db/record_id_helpers',
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
'$BUILD_DIR/mongo/db/resumable_index_builds_idl',
'$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/service_context',
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp
index aa52b86af04..e757543277e 100644
--- a/src/mongo/db/introspect.cpp
+++ b/src/mongo/db/introspect.cpp
@@ -35,7 +35,7 @@
#include "mongo/db/catalog/collection_write_path.h"
#include "mongo/db/client.h"
#include "mongo/db/concurrency/exception_util.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/jsobj.h"
diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp
index 8a8e057a8b4..4fdd1c6f456 100644
--- a/src/mongo/db/mongod_main.cpp
+++ b/src/mongo/db/mongod_main.cpp
@@ -72,7 +72,7 @@
#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/concurrency/flow_control_ticketholder.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/concurrency/replication_state_transition_lock_guard.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h
index 0027cb683b1..32898918484 100644
--- a/src/mongo/db/operation_context.h
+++ b/src/mongo/db/operation_context.h
@@ -29,10 +29,7 @@
#pragma once
-#include "mongo/util/assert_util.h"
#include <boost/optional.hpp>
-#include <cstddef>
-#include <memory>
#include "mongo/base/status.h"
#include "mongo/db/client.h"
@@ -49,6 +46,7 @@
#include "mongo/platform/mutex.h"
#include "mongo/stdx/condition_variable.h"
#include "mongo/transport/session.h"
+#include "mongo/util/assert_util.h"
#include "mongo/util/cancellation.h"
#include "mongo/util/concurrency/with_lock.h"
#include "mongo/util/decorable.h"
@@ -61,9 +59,7 @@
namespace mongo {
class CurOp;
-class ProgressMeter;
class ServiceContext;
-class StringData;
namespace repl {
class UnreplicatedWritesBlock;
diff --git a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface_test.cpp b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface_test.cpp
index 3a457d8112d..417739a8c34 100644
--- a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface_test.cpp
+++ b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface_test.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/pipeline/document_source_out.h"
#include "mongo/db/pipeline/document_source_queue.h"
#include "mongo/db/pipeline/process_interface/shardsvr_process_interface.h"
diff --git a/src/mongo/db/process_health/SConscript b/src/mongo/db/process_health/SConscript
index d30b66e619b..036c0a49fcb 100644
--- a/src/mongo/db/process_health/SConscript
+++ b/src/mongo/db/process_health/SConscript
@@ -65,6 +65,7 @@ env.CppUnitTest(
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/executor/network_interface_mock',
'$BUILD_DIR/mongo/executor/task_executor_test_fixture',
'$BUILD_DIR/mongo/executor/thread_pool_task_executor_test_fixture',
diff --git a/src/mongo/db/query/SConscript b/src/mongo/db/query/SConscript
index 7f9e1c69a00..d552d581044 100644
--- a/src/mongo/db/query/SConscript
+++ b/src/mongo/db/query/SConscript
@@ -275,16 +275,18 @@ env.Library(
)
env.Library(
- target="query_test_service_context",
+ target='query_test_service_context',
source=[
- "query_test_service_context.cpp",
+ 'query_test_service_context.cpp',
],
LIBDEPS=[
- "$BUILD_DIR/mongo/db/service_context",
- "$BUILD_DIR/mongo/db/session/logical_session_id",
- "collation/collator_factory_mock",
+ '$BUILD_DIR/mongo/db/service_context',
+ '$BUILD_DIR/mongo/db/session/logical_session_id',
+ 'collation/collator_factory_mock',
+ ],
+ LIBDEPS_PRIVATE=[
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
],
- LIBDEPS_PRIVATE=[],
)
env.Library(
diff --git a/src/mongo/db/query/ce/maxdiff_histogram_test.cpp b/src/mongo/db/query/ce/maxdiff_histogram_test.cpp
index 7225c1a8774..10e528cd6e4 100644
--- a/src/mongo/db/query/ce/maxdiff_histogram_test.cpp
+++ b/src/mongo/db/query/ce/maxdiff_histogram_test.cpp
@@ -27,7 +27,7 @@
* it in the license file.
*/
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/exec/sbe/abt/sbe_abt_test_util.h"
#include "mongo/db/exec/sbe/values/value.h"
#include "mongo/db/query/ce/histogram_predicate_estimation.h"
diff --git a/src/mongo/db/query/optimizer/SConscript b/src/mongo/db/query/optimizer/SConscript
index 2abdccf1f04..80f144ee898 100644
--- a/src/mongo/db/query/optimizer/SConscript
+++ b/src/mongo/db/query/optimizer/SConscript
@@ -150,6 +150,7 @@ env.CppUnitTest(
"interval_simplify_test.cpp",
],
LIBDEPS=[
+ "$BUILD_DIR/mongo/db/concurrency/lock_manager",
"$BUILD_DIR/mongo/db/service_context_test_fixture",
"optimizer",
"unit_test_pipeline_utils",
diff --git a/src/mongo/db/repl/apply_ops.cpp b/src/mongo/db/repl/apply_ops.cpp
index 374ebb27ae9..1fdf6450262 100644
--- a/src/mongo/db/repl/apply_ops.cpp
+++ b/src/mongo/db/repl/apply_ops.cpp
@@ -35,7 +35,6 @@
#include "mongo/db/catalog/document_validation.h"
#include "mongo/db/client.h"
#include "mongo/db/concurrency/exception_util.h"
-#include "mongo/db/concurrency/lock_state.h"
#include "mongo/db/curop.h"
#include "mongo/db/database_name.h"
#include "mongo/db/db_raii.h"
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index c402aca5bdd..dece58c6c7c 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -52,7 +52,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/commands/feature_compatibility_version.h"
#include "mongo/db/concurrency/d_concurrency.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/lock_manager.h"
#include "mongo/db/concurrency/replication_state_transition_lock_guard.h"
#include "mongo/db/curop.h"
#include "mongo/db/curop_failpoint_helpers.h"
@@ -91,6 +91,7 @@
#include "mongo/db/serverless/serverless_operation_lock_registry.h"
#include "mongo/db/session/kill_sessions_local.h"
#include "mongo/db/session/session_catalog.h"
+#include "mongo/db/shard_role.h"
#include "mongo/db/shutdown_in_progress_quiesce_info.h"
#include "mongo/db/storage/control/journal_flusher.h"
#include "mongo/db/storage/storage_options.h"
@@ -2632,7 +2633,7 @@ ReplicationCoordinatorImpl::AutoGetRstlForStepUpStepDown::AutoGetRstlForStepUpSt
}
// Dump all locks to identify which thread(s) are holding RSTL.
- getGlobalLockManager()->dump();
+ LockManager::get(opCtx)->dump();
auto lockerInfo = opCtx->lockState()->getLockerInfo(CurOp::get(opCtx)->getLockStatsBase());
BSONObjBuilder lockRep;
diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
index ae89606f267..adfa65af6f7 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
@@ -27,9 +27,6 @@
* it in the license file.
*/
-
-#include "mongo/platform/basic.h"
-
#include <functional>
#include <iostream>
#include <memory>
@@ -38,7 +35,7 @@
#include "mongo/bson/util/bson_extract.h"
#include "mongo/db/catalog/commit_quorum_options.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/concurrency/replication_state_transition_lock_guard.h"
#include "mongo/db/read_write_concern_defaults.h"
#include "mongo/db/repl/bson_extract_optime.h"
@@ -83,7 +80,6 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kTest
-
namespace mongo {
namespace repl {
namespace {
diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp
index a09e32be199..ecf95334f83 100644
--- a/src/mongo/db/service_entry_point_mongod.cpp
+++ b/src/mongo/db/service_entry_point_mongod.cpp
@@ -27,13 +27,10 @@
* it in the license file.
*/
-
-#include "mongo/platform/basic.h"
-
#include "mongo/db/service_entry_point_mongod.h"
#include "mongo/db/commands/fsync_locked.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/curop.h"
#include "mongo/db/read_concern.h"
#include "mongo/db/repl/repl_client_info.h"
@@ -53,7 +50,6 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
-
namespace mongo {
class ServiceEntryPointMongod::Hooks final : public ServiceEntryPointCommon::Hooks {
diff --git a/src/mongo/db/shard_role.cpp b/src/mongo/db/shard_role.cpp
index 4e5707931e3..5a65652ee8a 100644
--- a/src/mongo/db/shard_role.cpp
+++ b/src/mongo/db/shard_role.cpp
@@ -40,13 +40,8 @@
#include "mongo/db/concurrency/exception_util.h"
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/namespace_string.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/s/collection_sharding_runtime.h"
-#include "mongo/db/s/collection_sharding_state.h"
-#include "mongo/db/s/database_sharding_state.h"
-#include "mongo/db/s/operation_sharding_state.h"
-#include "mongo/db/s/scoped_collection_metadata.h"
#include "mongo/db/storage/capped_snapshots.h"
#include "mongo/logv2/log.h"
#include "mongo/util/decorable.h"
diff --git a/src/mongo/db/shard_role.h b/src/mongo/db/shard_role.h
index 2d778d3049c..e8a8b298e84 100644
--- a/src/mongo/db/shard_role.h
+++ b/src/mongo/db/shard_role.h
@@ -30,10 +30,10 @@
#pragma once
#include "mongo/db/catalog/collection_catalog.h"
-#include "mongo/db/repl/read_concern_args.h"
-#include "mongo/db/s/scoped_collection_metadata.h"
+#include "mongo/db/s/collection_sharding_state.h"
+#include "mongo/db/s/database_sharding_state.h"
+#include "mongo/db/s/operation_sharding_state.h"
#include "mongo/db/transaction_resources.h"
-#include "mongo/s/database_version.h"
namespace mongo {
diff --git a/src/mongo/db/storage/SConscript b/src/mongo/db/storage/SConscript
index 8f7b2f1e731..eb04f974fb5 100644
--- a/src/mongo/db/storage/SConscript
+++ b/src/mongo/db/storage/SConscript
@@ -32,7 +32,7 @@ env.Library(
'snapshot_helper.cpp',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/db/concurrency/lock_manager_defs',
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/repl/read_concern_args',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
'$BUILD_DIR/mongo/db/server_base',
diff --git a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp
index 9b36ac2afd9..f0cbd2a0795 100644
--- a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp
+++ b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp
@@ -27,11 +27,6 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include <memory>
-
-#include "mongo/db/concurrency/lock_state.h"
#include "mongo/db/service_context_test_fixture.h"
#include "mongo/db/storage/ident.h"
#include "mongo/db/storage/kv/kv_drop_pending_ident_reaper.h"
diff --git a/src/mongo/db/storage/storage_engine_init.cpp b/src/mongo/db/storage/storage_engine_init.cpp
index 6e2b2e23eec..76e88753b2b 100644
--- a/src/mongo/db/storage/storage_engine_init.cpp
+++ b/src/mongo/db/storage/storage_engine_init.cpp
@@ -27,17 +27,13 @@
* it in the license file.
*/
-
-#include "mongo/platform/basic.h"
-
#include "mongo/db/storage/storage_engine_init.h"
#include <map>
-#include <memory>
#include "mongo/base/init.h"
#include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/storage/control/storage_control.h"
#include "mongo/db/storage/execution_control/concurrency_adjustment_parameters_gen.h"
@@ -59,9 +55,7 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kStorage
-
namespace mongo {
-
namespace {
/**
* Creates the lock file used to prevent concurrent processes from accessing the data files,
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp
index 068e6d15098..888935ca7e4 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.cpp
@@ -27,15 +27,11 @@
* it in the license file.
*/
+#include "mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.h"
-#include "mongo/platform/basic.h"
-
-#include <cstring>
-
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h"
-#include "mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_util.h"
#include "mongo/logv2/log.h"
#include "mongo/platform/mutex.h"
@@ -44,7 +40,6 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kStorage
-
namespace mongo {
MONGO_FAIL_POINT_DEFINE(WTPauseOplogVisibilityUpdateLoop);
diff --git a/src/mongo/db/transaction/transaction_participant.cpp b/src/mongo/db/transaction/transaction_participant.cpp
index 2bba3023e3c..d31e7a5403d 100644
--- a/src/mongo/db/transaction/transaction_participant.cpp
+++ b/src/mongo/db/transaction/transaction_participant.cpp
@@ -44,8 +44,7 @@
#include "mongo/db/commands/test_commands_enabled.h"
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/concurrency/exception_util.h"
-#include "mongo/db/concurrency/lock_state.h"
-#include "mongo/db/concurrency/locker.h"
+#include "mongo/db/concurrency/locker_impl.h"
#include "mongo/db/concurrency/replication_state_transition_lock_guard.h"
#include "mongo/db/curop_failpoint_helpers.h"
#include "mongo/db/dbdirectclient.h"
diff --git a/src/mongo/db/transaction/transaction_participant_test.cpp b/src/mongo/db/transaction/transaction_participant_test.cpp
index 54376f4cc6a..59c8d988c8f 100644
--- a/src/mongo/db/transaction/transaction_participant_test.cpp
+++ b/src/mongo/db/transaction/transaction_participant_test.cpp
@@ -50,7 +50,6 @@
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/session/session_txn_record_gen.h"
#include "mongo/db/shard_role.h"
-#include "mongo/db/stats/fill_locker_info.h"
#include "mongo/db/storage/durable_history_pin.h"
#include "mongo/db/transaction/server_transactions_metrics.h"
#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
diff --git a/src/mongo/embedded/embedded.cpp b/src/mongo/embedded/embedded.cpp
index ee0fca37913..b746a2142a6 100644
--- a/src/mongo/embedded/embedded.cpp
+++ b/src/mongo/embedded/embedded.cpp
@@ -27,9 +27,6 @@
* it in the license file.
*/
-
-#include "mongo/platform/basic.h"
-
#include "mongo/embedded/embedded.h"
#include "mongo/base/initializer.h"
@@ -42,7 +39,7 @@
#include "mongo/db/client.h"
#include "mongo/db/commands/feature_compatibility_version.h"
#include "mongo/db/commands/fsync_locked.h"
-#include "mongo/db/concurrency/lock_state.h"
+#include "mongo/db/concurrency/locker.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/global_settings.h"
#include "mongo/db/op_observer/op_observer_impl.h"
diff --git a/src/mongo/executor/SConscript b/src/mongo/executor/SConscript
index 587c4713785..d071ae92c4c 100644
--- a/src/mongo/executor/SConscript
+++ b/src/mongo/executor/SConscript
@@ -435,6 +435,7 @@ env.CppIntegrationTest(
LIBDEPS=[
'$BUILD_DIR/mongo/client/async_client',
'$BUILD_DIR/mongo/client/clientdriver_network',
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/wire_version',
'$BUILD_DIR/mongo/executor/network_interface_factory',
'$BUILD_DIR/mongo/executor/network_interface_thread_pool',
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index cc3596046fd..3ca8219b298 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -618,6 +618,7 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/client/remote_command_targeter_mock',
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/service_context_test_fixture',
'$BUILD_DIR/mongo/executor/network_interface_mock',
'$BUILD_DIR/mongo/executor/network_test_env',
diff --git a/src/mongo/shell/SConscript b/src/mongo/shell/SConscript
index a8af390807f..aa68e6a4c67 100644
--- a/src/mongo/shell/SConscript
+++ b/src/mongo/shell/SConscript
@@ -320,6 +320,7 @@ if not has_option('noshell') and jsEngine:
# library to inject a static or mongo initializer to mongo,
# please add that library as a private libdep of
# mongo_initializers.
+ "$BUILD_DIR/mongo/db/concurrency/lock_manager",
"$BUILD_DIR/mongo/s/write_ops/batch_write_types",
"$BUILD_DIR/mongo/transport/transport_layer",
"$BUILD_DIR/mongo/util/net/ssl_manager",
diff --git a/src/mongo/tools/mongobridge_tool/SConscript b/src/mongo/tools/mongobridge_tool/SConscript
index f917a686bd2..6c9df84daf9 100644
--- a/src/mongo/tools/mongobridge_tool/SConscript
+++ b/src/mongo/tools/mongobridge_tool/SConscript
@@ -7,15 +7,16 @@ yamlEnv = env.Clone()
yamlEnv.InjectThirdParty(libraries=['yaml'])
mongobridge = env.Program(
- target="mongobridge",
+ target='mongobridge',
source=[
- "bridge.cpp",
- "bridge_commands.cpp",
- "mongobridge_options.cpp",
- "mongobridge_options.idl",
- "mongobridge_options_init.cpp",
+ 'bridge.cpp',
+ 'bridge_commands.cpp',
+ 'mongobridge_options.cpp',
+ 'mongobridge_options.idl',
+ 'mongobridge_options_init.cpp',
],
LIBDEPS=[
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/dbmessage',
'$BUILD_DIR/mongo/rpc/rpc',
'$BUILD_DIR/mongo/transport/message_compressor',
diff --git a/src/mongo/transport/SConscript b/src/mongo/transport/SConscript
index 868890f48ba..64ae7d6d536 100644
--- a/src/mongo/transport/SConscript
+++ b/src/mongo/transport/SConscript
@@ -285,6 +285,7 @@ env.Benchmark(
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/service_context_test_fixture',
'service_executor',
'transport_layer_mock',
@@ -297,6 +298,7 @@ env.Benchmark(
'session_workflow_bm.cpp',
],
LIBDEPS=[
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/service_context_test_fixture',
'service_entry_point',
'service_executor',
diff --git a/src/mongo/unittest/SConscript b/src/mongo/unittest/SConscript
index 0d1dfc44e67..1e5e540a79c 100644
--- a/src/mongo/unittest/SConscript
+++ b/src/mongo/unittest/SConscript
@@ -63,7 +63,7 @@ env.Library(
)
env.Library(
- target="integration_test_main",
+ target='integration_test_main',
source=[
'integration_test_main.cpp',
'integration_test_main.idl',
@@ -75,6 +75,7 @@ env.Library(
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/client/connection_string',
'$BUILD_DIR/mongo/db/commands/test_commands_enabled',
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/server_options',
'$BUILD_DIR/mongo/db/server_options_base',
'$BUILD_DIR/mongo/db/serverinit',
diff --git a/src/mongo/util/concurrency/SConscript b/src/mongo/util/concurrency/SConscript
index acc81c451b4..e715ef3a9a8 100644
--- a/src/mongo/util/concurrency/SConscript
+++ b/src/mongo/util/concurrency/SConscript
@@ -41,13 +41,20 @@ env.Library(
],
)
-env.Library(target='admission_context', source=['admission_context.cpp'],
- LIBDEPS=['$BUILD_DIR/mongo/base'])
+env.Library(
+ target='admission_context',
+ source=[
+ 'admission_context.cpp',
+ ],
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/base',
+ ],
+)
env.Library(
target='spin_lock',
source=[
- "spin_lock.cpp",
+ 'spin_lock.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
@@ -81,6 +88,7 @@ env.Benchmark(
'ticketholder_bm.cpp',
],
LIBDEPS=[
+ '$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/service_context',
'ticketholder',
],
diff --git a/src/mongo/util/concurrency/priority_ticketholder.cpp b/src/mongo/util/concurrency/priority_ticketholder.cpp
index 4656c7ab4f4..f99eb6a0331 100644
--- a/src/mongo/util/concurrency/priority_ticketholder.cpp
+++ b/src/mongo/util/concurrency/priority_ticketholder.cpp
@@ -27,14 +27,11 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/service_context.h"
-#include "mongo/util/concurrency/admission_context.h"
#include "mongo/util/concurrency/priority_ticketholder.h"
#include <iostream>
+#include "mongo/db/service_context.h"
#include "mongo/logv2/log.h"
#include "mongo/util/str.h"
diff --git a/src/mongo/util/concurrency/priority_ticketholder_test.cpp b/src/mongo/util/concurrency/priority_ticketholder_test.cpp
index fff70a982ec..1bce5630521 100644
--- a/src/mongo/util/concurrency/priority_ticketholder_test.cpp
+++ b/src/mongo/util/concurrency/priority_ticketholder_test.cpp
@@ -30,7 +30,6 @@
#include "mongo/db/concurrency/locker_noop_client_observer.h"
#include "mongo/logv2/log.h"
#include "mongo/unittest/barrier.h"
-#include "mongo/util/concurrency/admission_context.h"
#include "mongo/util/concurrency/priority_ticketholder.h"
#include "mongo/util/concurrency/ticketholder_test_fixture.h"
#include "mongo/util/periodic_runner_factory.h"
diff --git a/src/mongo/util/concurrency/semaphore_ticketholder.cpp b/src/mongo/util/concurrency/semaphore_ticketholder.cpp
index 00517a0fd31..f849a88b9ce 100644
--- a/src/mongo/util/concurrency/semaphore_ticketholder.cpp
+++ b/src/mongo/util/concurrency/semaphore_ticketholder.cpp
@@ -27,16 +27,13 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/service_context.h"
-#include "mongo/util/concurrency/admission_context.h"
#include "mongo/util/concurrency/semaphore_ticketholder.h"
-#include "mongo/util/concurrency/ticketholder.h"
#include <iostream>
+#include "mongo/db/service_context.h"
#include "mongo/logv2/log.h"
+#include "mongo/util/concurrency/ticketholder.h"
#include "mongo/util/str.h"
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
diff --git a/src/mongo/util/concurrency/ticketholder.cpp b/src/mongo/util/concurrency/ticketholder.cpp
index dd527f9e177..efc043ba816 100644
--- a/src/mongo/util/concurrency/ticketholder.cpp
+++ b/src/mongo/util/concurrency/ticketholder.cpp
@@ -28,14 +28,13 @@
*/
#include "mongo/util/concurrency/ticketholder.h"
+
+#include <iostream>
+
#include "mongo/db/service_context.h"
#include "mongo/db/storage/execution_control/concurrency_adjustment_parameters_gen.h"
#include "mongo/db/storage/storage_engine_feature_flags_gen.h"
#include "mongo/db/storage/storage_engine_parameters_gen.h"
-#include "mongo/util/concurrency/admission_context.h"
-
-#include <iostream>
-
#include "mongo/logv2/log.h"
#include "mongo/util/str.h"