From 289b22035a4f7ebad120fedda30458bb3b74665b Mon Sep 17 00:00:00 2001 From: Henrik Edin Date: Fri, 23 Oct 2020 10:04:36 -0400 Subject: SERVER-50870 Establish consistent storage snapshot with the refreshed Collection after yielding --- src/mongo/db/concurrency/SConscript | 11 +++++++ src/mongo/db/concurrency/lock_manager_defs.cpp | 42 ++++++++++++++++++++++++++ src/mongo/db/concurrency/lock_state.cpp | 8 ----- 3 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 src/mongo/db/concurrency/lock_manager_defs.cpp (limited to 'src/mongo/db/concurrency') diff --git a/src/mongo/db/concurrency/SConscript b/src/mongo/db/concurrency/SConscript index 892e7364cc8..37b0095d141 100644 --- a/src/mongo/db/concurrency/SConscript +++ b/src/mongo/db/concurrency/SConscript @@ -36,6 +36,16 @@ env.Library( ], ) +env.Library( + target='lock_manager_defs', + source=[ + 'lock_manager_defs.cpp', + ], + LIBDEPS=[ + '$BUILD_DIR/mongo/base', + ], +) + env.Library( target='lock_manager', source=[ @@ -52,6 +62,7 @@ env.Library( '$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/catalog/collection_catalog', diff --git a/src/mongo/db/concurrency/lock_manager_defs.cpp b/src/mongo/db/concurrency/lock_manager_defs.cpp new file mode 100644 index 00000000000..01ae4586cad --- /dev/null +++ b/src/mongo/db/concurrency/lock_manager_defs.cpp @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2020-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 + * . + * + * 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 "lock_manager_defs.h" + +namespace mongo { + +// Hardcoded resource IDs. +const ResourceId resourceIdLocalDB = ResourceId(RESOURCE_DATABASE, StringData("local")); +const ResourceId resourceIdOplog = ResourceId(RESOURCE_COLLECTION, StringData("local.oplog.rs")); +const ResourceId resourceIdAdminDB = ResourceId(RESOURCE_DATABASE, StringData("admin")); +const ResourceId resourceIdGlobal = ResourceId(RESOURCE_GLOBAL, 1ULL); +const ResourceId resourceIdParallelBatchWriterMode = ResourceId(RESOURCE_PBWM, 1ULL); +const ResourceId resourceIdReplicationStateTransitionLock = ResourceId(RESOURCE_RSTL, 1ULL); + +} // namespace mongo diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp index 416c8c5e7e2..3be2cebb251 100644 --- a/src/mongo/db/concurrency/lock_state.cpp +++ b/src/mongo/db/concurrency/lock_state.cpp @@ -1109,12 +1109,4 @@ void resetGlobalLockStats() { globalStats.reset(); } -// Hardcoded resource IDs. -const ResourceId resourceIdLocalDB = ResourceId(RESOURCE_DATABASE, StringData("local")); -const ResourceId resourceIdOplog = ResourceId(RESOURCE_COLLECTION, StringData("local.oplog.rs")); -const ResourceId resourceIdAdminDB = ResourceId(RESOURCE_DATABASE, StringData("admin")); -const ResourceId resourceIdGlobal = ResourceId(RESOURCE_GLOBAL, 1ULL); -const ResourceId resourceIdParallelBatchWriterMode = ResourceId(RESOURCE_PBWM, 1ULL); -const ResourceId resourceIdReplicationStateTransitionLock = ResourceId(RESOURCE_RSTL, 1ULL); - } // namespace mongo -- cgit v1.2.1