summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2021-01-12 02:07:17 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-01-12 12:17:08 +0000
commit460b587740c5fa0504ecbf69191c00a7154713da (patch)
tree8f5d032d858f1f536c46cd20ec0d2bf88feebdb6 /src/mongo/db
parent312941481279fbfed585074f1b36266dee751f94 (diff)
downloadmongo-460b587740c5fa0504ecbf69191c00a7154713da.tar.gz
SERVER-53689 Make only the ReplSetDistLockManager tests use a mocked lock manager
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/s/SConscript3
-rw-r--r--src/mongo/db/s/config/config_server_test_fixture.cpp11
-rw-r--r--src/mongo/db/s/config/config_server_test_fixture.h2
-rw-r--r--src/mongo/db/s/dist_lock_catalog_replset_test.cpp1
-rw-r--r--src/mongo/db/s/dist_lock_manager.cpp5
-rw-r--r--src/mongo/db/s/dist_lock_manager.h14
-rw-r--r--src/mongo/db/s/dist_lock_manager_mock.cpp137
-rw-r--r--src/mongo/db/s/dist_lock_manager_mock.h86
-rw-r--r--src/mongo/db/s/dist_lock_manager_replset.cpp5
-rw-r--r--src/mongo/db/s/dist_lock_manager_replset.h2
-rw-r--r--src/mongo/db/s/dist_lock_manager_replset_test.cpp20
-rw-r--r--src/mongo/db/s/sharding_mongod_test_fixture.cpp29
-rw-r--r--src/mongo/db/s/split_chunk_test.cpp41
-rw-r--r--src/mongo/db/s/vector_clock_config_server_test.cpp8
14 files changed, 28 insertions, 336 deletions
diff --git a/src/mongo/db/s/SConscript b/src/mongo/db/s/SConscript
index 18df1b1aac1..986b67a99c6 100644
--- a/src/mongo/db/s/SConscript
+++ b/src/mongo/db/s/SConscript
@@ -408,8 +408,6 @@ env.Library(
env.Library(
target='sharding_mongod_test_fixture',
source=[
- 'dist_lock_catalog_mock.cpp',
- 'dist_lock_manager_mock.cpp',
'sharding_mongod_test_fixture.cpp',
],
LIBDEPS=[
@@ -451,6 +449,7 @@ env.CppUnitTest(
'collection_metadata_filtering_test.cpp',
'collection_metadata_test.cpp',
'collection_sharding_runtime_test.cpp',
+ 'dist_lock_catalog_mock.cpp',
'dist_lock_catalog_replset_test.cpp',
'dist_lock_manager_replset_test.cpp',
'metadata_manager_test.cpp',
diff --git a/src/mongo/db/s/config/config_server_test_fixture.cpp b/src/mongo/db/s/config/config_server_test_fixture.cpp
index b8a21753d7e..6013e807143 100644
--- a/src/mongo/db/s/config/config_server_test_fixture.cpp
+++ b/src/mongo/db/s/config/config_server_test_fixture.cpp
@@ -51,8 +51,6 @@
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/s/config/sharding_catalog_manager.h"
-#include "mongo/db/s/dist_lock_catalog_replset.h"
-#include "mongo/db/s/dist_lock_manager_replset.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/executor/thread_pool_task_executor_test_fixture.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
@@ -161,15 +159,6 @@ void ConfigServerTestFixture::tearDown() {
ShardingMongodTestFixture::tearDown();
}
-std::unique_ptr<DistLockManager> ConfigServerTestFixture::makeDistLockManager() {
- return std::make_unique<ReplSetDistLockManager>(
- getServiceContext(),
- "distLockProcessId",
- std::make_unique<DistLockCatalogImpl>(),
- ReplSetDistLockManager::kDistLockPingInterval,
- ReplSetDistLockManager::kDistLockExpirationTime);
-}
-
std::unique_ptr<ShardingCatalogClient> ConfigServerTestFixture::makeShardingCatalogClient() {
return std::make_unique<ShardingCatalogClientImpl>();
}
diff --git a/src/mongo/db/s/config/config_server_test_fixture.h b/src/mongo/db/s/config/config_server_test_fixture.h
index 3e82cd8fcc3..30c59329287 100644
--- a/src/mongo/db/s/config/config_server_test_fixture.h
+++ b/src/mongo/db/s/config/config_server_test_fixture.h
@@ -167,8 +167,6 @@ protected:
*/
void setUpAndInitializeConfigDb();
- std::unique_ptr<DistLockManager> makeDistLockManager() override;
-
std::unique_ptr<ShardingCatalogClient> makeShardingCatalogClient() override;
std::unique_ptr<ClusterCursorManager> makeClusterCursorManager() override;
diff --git a/src/mongo/db/s/dist_lock_catalog_replset_test.cpp b/src/mongo/db/s/dist_lock_catalog_replset_test.cpp
index b712ed2e84b..67fff471f77 100644
--- a/src/mongo/db/s/dist_lock_catalog_replset_test.cpp
+++ b/src/mongo/db/s/dist_lock_catalog_replset_test.cpp
@@ -37,7 +37,6 @@
#include "mongo/db/commands.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/s/dist_lock_catalog_replset.h"
-#include "mongo/db/s/dist_lock_manager_mock.h"
#include "mongo/db/s/shard_server_test_fixture.h"
#include "mongo/db/s/type_lockpings.h"
#include "mongo/db/s/type_locks.h"
diff --git a/src/mongo/db/s/dist_lock_manager.cpp b/src/mongo/db/s/dist_lock_manager.cpp
index 00893d912e4..b1ca6766631 100644
--- a/src/mongo/db/s/dist_lock_manager.cpp
+++ b/src/mongo/db/s/dist_lock_manager.cpp
@@ -77,11 +77,6 @@ DistLockManager::ScopedDistLock& DistLockManager::ScopedDistLock::operator=(
return *this;
}
-Status DistLockManager::ScopedDistLock::checkStatus() {
- invariant(_lockManager);
- return _lockManager->checkStatus(_opCtx, _lockID);
-}
-
DistLockManager* DistLockManager::get(OperationContext* opCtx) {
return getDistLockManager(opCtx->getServiceContext()).get();
}
diff --git a/src/mongo/db/s/dist_lock_manager.h b/src/mongo/db/s/dist_lock_manager.h
index 7d9eec4e425..28fc475a535 100644
--- a/src/mongo/db/s/dist_lock_manager.h
+++ b/src/mongo/db/s/dist_lock_manager.h
@@ -49,9 +49,6 @@ using DistLockHandle = OID;
* // Did not get lock. scopedLockStatus destructor will not call unlock.
* }
*
- * // To check if lock is still owned:
- * auto status = scopedDistLock.getValue().checkStatus();
- *
* if (!status.isOK()) {
* // Someone took over the lock! Unlock will still be called at destructor, but will
* // practically be a no-op since it doesn't own the lock anymore.
@@ -82,11 +79,6 @@ public:
ScopedDistLock(ScopedDistLock&& other);
ScopedDistLock& operator=(ScopedDistLock&& other);
- /**
- * Checks whether the lock is still being held by querying the config server.
- */
- Status checkStatus();
-
private:
OperationContext* _opCtx;
DistLockHandle _lockID;
@@ -178,12 +170,6 @@ public:
* Makes a best-effort attempt to unlock all locks owned by the given processID.
*/
virtual void unlockAll(OperationContext* opCtx) = 0;
-
-private:
- /**
- * Checks if the lockHandle still exists in the config server.
- */
- virtual Status checkStatus(OperationContext* opCtx, const DistLockHandle& lockHandle) = 0;
};
} // namespace mongo
diff --git a/src/mongo/db/s/dist_lock_manager_mock.cpp b/src/mongo/db/s/dist_lock_manager_mock.cpp
deleted file mode 100644
index 97d773cffd0..00000000000
--- a/src/mongo/db/s/dist_lock_manager_mock.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * Copyright (C) 2018-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.
- */
-
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kTest
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/s/dist_lock_manager_mock.h"
-
-#include <algorithm>
-
-#include "mongo/unittest/unittest.h"
-#include "mongo/util/str.h"
-#include "mongo/util/time_support.h"
-
-namespace mongo {
-namespace {
-
-void noLockFuncSet(StringData name, StringData whyMessage, Milliseconds waitFor) {
- FAIL(str::stream() << "Lock not expected to be called. "
- << "Name: " << name << ", whyMessage: " << whyMessage
- << ", waitFor: " << waitFor);
-}
-
-} // namespace
-
-DistLockManagerMock::DistLockManagerMock()
- : _lockReturnStatus{Status::OK()}, _lockChecker{noLockFuncSet} {}
-
-DistLockManagerMock::~DistLockManagerMock() = default;
-
-void DistLockManagerMock::startUp() {}
-
-void DistLockManagerMock::shutDown(OperationContext* opCtx) {
- uassert(28659, "DistLockManagerMock shut down with outstanding locks present", _locks.empty());
-}
-
-std::string DistLockManagerMock::getProcessID() {
- return "Mock dist lock manager process id";
-}
-
-StatusWith<DistLockHandle> DistLockManagerMock::lockWithSessionID(OperationContext* opCtx,
- StringData name,
- StringData whyMessage,
- const OID& lockSessionID,
- Milliseconds waitFor) {
- _lockChecker(name, whyMessage, waitFor);
- _lockChecker = noLockFuncSet;
-
- if (!_lockReturnStatus.isOK()) {
- return _lockReturnStatus;
- }
-
- if (_locks.end() != std::find_if(_locks.begin(), _locks.end(), [name](LockInfo info) -> bool {
- return info.name == name;
- })) {
- return Status(ErrorCodes::LockBusy,
- str::stream() << "Lock \"" << name << "\" is already taken");
- }
-
- LockInfo info;
- info.name = name.toString();
- info.lockID = lockSessionID;
- _locks.push_back(info);
-
- return info.lockID;
-}
-
-StatusWith<DistLockHandle> DistLockManagerMock::tryLockWithLocalWriteConcern(
- OperationContext* opCtx, StringData name, StringData whyMessage, const OID& lockSessionID) {
- MONGO_UNREACHABLE;
-}
-
-void DistLockManagerMock::unlockAll(OperationContext* opCtx) {
- MONGO_UNREACHABLE;
-}
-
-void DistLockManagerMock::unlock(OperationContext* opCtx, const DistLockHandle& lockHandle) {
- std::vector<LockInfo>::iterator it =
- std::find_if(_locks.begin(), _locks.end(), [&lockHandle](LockInfo info) -> bool {
- return info.lockID == lockHandle;
- });
- if (it == _locks.end()) {
- return;
- }
- _locks.erase(it);
-}
-
-void DistLockManagerMock::unlock(OperationContext* opCtx,
- const DistLockHandle& lockHandle,
- StringData name) {
- std::vector<LockInfo>::iterator it =
- std::find_if(_locks.begin(), _locks.end(), [&lockHandle, &name](LockInfo info) -> bool {
- return ((info.lockID == lockHandle) && (info.name == name));
- });
- if (it == _locks.end()) {
- return;
- }
- _locks.erase(it);
-}
-
-Status DistLockManagerMock::checkStatus(OperationContext* opCtx, const DistLockHandle& lockHandle) {
- return Status::OK();
-}
-
-void DistLockManagerMock::expectLock(LockFunc checker, Status status) {
- _lockReturnStatus = std::move(status);
- _lockChecker = checker;
-}
-
-} // namespace mongo
diff --git a/src/mongo/db/s/dist_lock_manager_mock.h b/src/mongo/db/s/dist_lock_manager_mock.h
deleted file mode 100644
index 9cf1ed13e6f..00000000000
--- a/src/mongo/db/s/dist_lock_manager_mock.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Copyright (C) 2018-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.
- */
-
-#pragma once
-
-#include <functional>
-#include <vector>
-
-#include "mongo/db/s/dist_lock_manager.h"
-
-namespace mongo {
-
-class DistLockManagerMock : public DistLockManager {
-public:
- DistLockManagerMock();
- virtual ~DistLockManagerMock();
-
- void startUp() override;
- void shutDown(OperationContext* opCtx) override;
-
- std::string getProcessID() override;
-
- StatusWith<DistLockHandle> lockWithSessionID(OperationContext* opCtx,
- StringData name,
- StringData whyMessage,
- const OID& lockSessionID,
- Milliseconds waitFor) override;
-
- StatusWith<DistLockHandle> tryLockWithLocalWriteConcern(OperationContext* opCtx,
- StringData name,
- StringData whyMessage,
- const OID& lockSessionID) override;
-
- void unlockAll(OperationContext* opCtx) override;
-
- using LockFunc =
- std::function<void(StringData name, StringData whyMessage, Milliseconds waitFor)>;
-
- void expectLock(LockFunc checkerFunc, Status lockStatus);
-
- void unlock(OperationContext* opCtx, const DistLockHandle& lockHandle) override;
-
- void unlock(OperationContext* opCtx,
- const DistLockHandle& lockHandle,
- StringData name) override;
-
-private:
- struct LockInfo {
- DistLockHandle lockID;
- std::string name;
- };
-
- Status checkStatus(OperationContext* opCtx, const DistLockHandle& lockHandle) override;
-
- std::vector<LockInfo> _locks;
- Status _lockReturnStatus;
- LockFunc _lockChecker;
-};
-
-} // namespace mongo
diff --git a/src/mongo/db/s/dist_lock_manager_replset.cpp b/src/mongo/db/s/dist_lock_manager_replset.cpp
index 8b7f1490cd4..5876aa7e3d7 100644
--- a/src/mongo/db/s/dist_lock_manager_replset.cpp
+++ b/src/mongo/db/s/dist_lock_manager_replset.cpp
@@ -598,11 +598,6 @@ void ReplSetDistLockManager::unlockAll(OperationContext* opCtx) {
}
}
-Status ReplSetDistLockManager::checkStatus(OperationContext* opCtx,
- const DistLockHandle& lockHandle) {
- return _catalog->getLockByTS(opCtx, lockHandle).getStatus();
-}
-
void ReplSetDistLockManager::queueUnlock(const DistLockHandle& lockSessionID,
const boost::optional<std::string>& name) {
stdx::unique_lock<Latch> lk(_mutex);
diff --git a/src/mongo/db/s/dist_lock_manager_replset.h b/src/mongo/db/s/dist_lock_manager_replset.h
index ba468e3fad5..fc0a41ef2a2 100644
--- a/src/mongo/db/s/dist_lock_manager_replset.h
+++ b/src/mongo/db/s/dist_lock_manager_replset.h
@@ -82,8 +82,6 @@ public:
void unlockAll(OperationContext* opCtx) override;
private:
- Status checkStatus(OperationContext* opCtx, const DistLockHandle& lockSessionID) override;
-
/**
* Queue a lock to be unlocked asynchronously with retry until it doesn't error.
*/
diff --git a/src/mongo/db/s/dist_lock_manager_replset_test.cpp b/src/mongo/db/s/dist_lock_manager_replset_test.cpp
index 548e170a4eb..6649937895e 100644
--- a/src/mongo/db/s/dist_lock_manager_replset_test.cpp
+++ b/src/mongo/db/s/dist_lock_manager_replset_test.cpp
@@ -545,13 +545,7 @@ TEST_F(DistLockManagerReplSetTest, CheckLockStatusOK) {
},
Status::OK());
- auto& scopedLock = lockStatus.getValue();
-
getMockCatalog()->expectNoGrabLock();
- getMockCatalog()->expectGetLockByTS(
- [&lockSessionID](const OID& ts) { ASSERT_EQUALS(lockSessionID, ts); }, retLockDoc);
-
- ASSERT_OK(scopedLock.checkStatus());
}
TEST_F(DistLockManagerReplSetTest, CheckLockStatusNoLongerOwn) {
@@ -584,14 +578,7 @@ TEST_F(DistLockManagerReplSetTest, CheckLockStatusNoLongerOwn) {
},
Status::OK());
- auto& scopedLock = lockStatus.getValue();
-
getMockCatalog()->expectNoGrabLock();
- getMockCatalog()->expectGetLockByTS(
- [&lockSessionID](const OID& ts) { ASSERT_EQUALS(lockSessionID, ts); },
- {ErrorCodes::LockNotFound, "no lock"});
-
- ASSERT_NOT_OK(scopedLock.checkStatus());
}
TEST_F(DistLockManagerReplSetTest, CheckLockStatusError) {
@@ -624,14 +611,7 @@ TEST_F(DistLockManagerReplSetTest, CheckLockStatusError) {
},
Status::OK());
- auto& scopedLock = lockStatus.getValue();
-
getMockCatalog()->expectNoGrabLock();
- getMockCatalog()->expectGetLockByTS(
- [&lockSessionID](const OID& ts) { ASSERT_EQUALS(lockSessionID, ts); },
- {ErrorCodes::NetworkTimeout, "bad test network"});
-
- ASSERT_NOT_OK(scopedLock.checkStatus());
}
/**
diff --git a/src/mongo/db/s/sharding_mongod_test_fixture.cpp b/src/mongo/db/s/sharding_mongod_test_fixture.cpp
index d0881708665..d8d1e1b1160 100644
--- a/src/mongo/db/s/sharding_mongod_test_fixture.cpp
+++ b/src/mongo/db/s/sharding_mongod_test_fixture.cpp
@@ -54,7 +54,6 @@
#include "mongo/db/repl/storage_interface_mock.h"
#include "mongo/db/s/collection_sharding_state_factory_shard.h"
#include "mongo/db/s/config_server_op_observer.h"
-#include "mongo/db/s/dist_lock_manager_mock.h"
#include "mongo/db/s/op_observer_sharding_impl.h"
#include "mongo/db/s/shard_local.h"
#include "mongo/db/s/shard_server_op_observer.h"
@@ -219,7 +218,33 @@ std::unique_ptr<ShardRegistry> ShardingMongodTestFixture::makeShardRegistry(
}
std::unique_ptr<DistLockManager> ShardingMongodTestFixture::makeDistLockManager() {
- return std::make_unique<DistLockManagerMock>();
+ class DistLockManagerNoop : public DistLockManager {
+ public:
+ void startUp() override {}
+ void shutDown(OperationContext* opCtx) {}
+ std::string getProcessID() override {
+ return "DistLockManagerNoop";
+ }
+ StatusWith<DistLockHandle> lockWithSessionID(OperationContext* opCtx,
+ StringData name,
+ StringData whyMessage,
+ const OID& lockSessionID,
+ Milliseconds waitFor) override {
+ return DistLockHandle::gen();
+ }
+ StatusWith<DistLockHandle> tryLockWithLocalWriteConcern(OperationContext* opCtx,
+ StringData name,
+ StringData whyMessage,
+ const OID& lockSessionID) override {
+ return DistLockHandle::gen();
+ }
+ void unlock(OperationContext* opCtx, const DistLockHandle& lockHandle) override {}
+ void unlock(OperationContext* opCtx,
+ const DistLockHandle& lockHandle,
+ StringData name) override {}
+ void unlockAll(OperationContext* opCtx) override {}
+ };
+ return std::make_unique<DistLockManagerNoop>();
}
std::unique_ptr<ClusterCursorManager> ShardingMongodTestFixture::makeClusterCursorManager() {
diff --git a/src/mongo/db/s/split_chunk_test.cpp b/src/mongo/db/s/split_chunk_test.cpp
index 298059e85cc..32f3c604dd3 100644
--- a/src/mongo/db/s/split_chunk_test.cpp
+++ b/src/mongo/db/s/split_chunk_test.cpp
@@ -34,7 +34,6 @@
#include <boost/optional.hpp>
#include "mongo/db/json.h"
-#include "mongo/db/s/dist_lock_manager_mock.h"
#include "mongo/db/s/shard_server_test_fixture.h"
#include "mongo/db/s/sharding_initialization_mongod.h"
#include "mongo/db/s/split_chunk.h"
@@ -97,12 +96,6 @@ public:
}
/**
- * Tells the DistLockManagerMock instance to expect a lock, and logs the corresponding
- * information.
- */
- void expectLock();
-
- /**
* Returns the mock response that correspond with particular requests. For example, dbResponse
* returns a response for when a find-databases request occurs.
*
@@ -162,16 +155,6 @@ void SplitChunkTest::setUpChunkVersions() {
ChunkVersion(1, 1, _epoch), ChunkVersion(1, 2, _epoch), ChunkVersion(1, 3, _epoch)};
}
-void SplitChunkTest::expectLock() {
- dynamic_cast<DistLockManagerMock*>(distLock())
- ->expectLock(
- [this](StringData name, StringData whyMessage, Milliseconds) {
- LOGV2(22105, "Lock name", "name"_attr = name);
- LOGV2(22106, "Reason for lock", "reason"_attr = whyMessage);
- },
- Status::OK());
-}
-
void SplitChunkTest::commitChunkSplitResponse(bool isOk) {
onCommand([&](const RemoteCommandRequest& request) {
return isOk ? BSON("ok" << 1) : BSON("ok" << 0);
@@ -220,8 +203,6 @@ TEST_F(SplitChunkTest, HashedKeyPatternNumberLongSplitKeys) {
validSplitKeys.push_back(BSON("foo" << i));
}
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -265,8 +246,6 @@ TEST_F(SplitChunkTest, HashedKeyPatternIntegerSplitKeys) {
std::vector<BSONObj> invalidSplitKeys{
BSON("foo" << -1), BSON("foo" << 0), BSON("foo" << 1), BSON("foo" << 42)};
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -303,8 +282,6 @@ TEST_F(SplitChunkTest, HashedKeyPatternDoubleSplitKeys) {
std::vector<BSONObj> invalidSplitKeys{
BSON("foo" << 47.21230129), BSON("foo" << 1.0), BSON("foo" << 0.0), BSON("foo" << -0.001)};
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -347,8 +324,6 @@ TEST_F(SplitChunkTest, HashedKeyPatternStringSplitKeys) {
BSON("foo"
<< "")};
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -388,8 +363,6 @@ TEST_F(SplitChunkTest, ValidRangeKeyPatternSplitKeys) {
<< ""),
BSON("foo" << 3.1415926535)};
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -432,8 +405,6 @@ TEST_F(SplitChunkTest, SplitChunkWithNoErrors) {
splitKeys.push_back(BSON("foo" << i));
}
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -493,8 +464,6 @@ TEST_F(SplitChunkTest, AttemptSplitWithConfigsvrError) {
splitKeys.push_back(BSON("foo" << i));
}
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -537,8 +506,6 @@ TEST_F(SplitChunkTest, AttemptSplitOnNoDatabases) {
splitKeys.push_back(BSON("foo" << i));
}
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -571,8 +538,6 @@ TEST_F(SplitChunkTest, AttemptSplitOnNoCollections) {
splitKeys.push_back(BSON("foo" << i));
}
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -608,8 +573,6 @@ TEST_F(SplitChunkTest, AttemptSplitOnNoChunks) {
splitKeys.push_back(BSON("foo" << i));
}
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -651,8 +614,6 @@ TEST_F(SplitChunkTest, NoCollectionAfterSplit) {
splitKeys.push_back(BSON("foo" << i));
}
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
@@ -695,8 +656,6 @@ TEST_F(SplitChunkTest, NoChunksAfterSplit) {
splitKeys.push_back(BSON("foo" << i));
}
- expectLock();
-
// Call the splitChunk function asynchronously on a different thread, so that we do not block,
// and so we can construct the mock responses to requests made by splitChunk below.
auto future = launchAsync([&] {
diff --git a/src/mongo/db/s/vector_clock_config_server_test.cpp b/src/mongo/db/s/vector_clock_config_server_test.cpp
index 81e8138c097..afbf5fcc2bb 100644
--- a/src/mongo/db/s/vector_clock_config_server_test.cpp
+++ b/src/mongo/db/s/vector_clock_config_server_test.cpp
@@ -33,7 +33,6 @@
#include "mongo/db/keys_collection_manager.h"
#include "mongo/db/logical_time_validator.h"
#include "mongo/db/s/config/config_server_test_fixture.h"
-#include "mongo/db/s/dist_lock_manager_mock.h"
#include "mongo/db/vector_clock_mutable.h"
#include "mongo/unittest/death_test.h"
#include "mongo/util/clock_source_mock.h"
@@ -68,13 +67,6 @@ protected:
ConfigServerTestFixture::tearDown();
}
- // The VectorClock tests assume nothing else ticks ClusterTime. However,
- // ConfigServerTestFixture installs an actual DistLockManager, which does writes (thereby
- // ticking ClusterTime). So for these tests, that is overridden to be a mock.
- std::unique_ptr<DistLockManager> makeDistLockManager() override {
- return std::make_unique<DistLockManagerMock>();
- }
-
/**
* Forces KeyManager to refresh cache and generate new keys.
*/