summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorJamie Heppenstall <jamie.heppenstall@mongodb.com>2020-05-04 14:28:35 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-04 19:15:50 +0000
commitfa6c70e09cc25ba5cd57b4fd02b920ed59282437 (patch)
tree258fc275ff961ba24f8730848fb3732e4c7f1ce5 /src/mongo
parentaacb7410c83ed079fc62af94fa546dedc66b89fa (diff)
downloadmongo-fa6c70e09cc25ba5cd57b4fd02b920ed59282437.tar.gz
SERVER-46564 Remove the CheckpointLock class
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/catalog/multi_index_block.cpp2
-rw-r--r--src/mongo/db/storage/kv/kv_engine.h9
-rw-r--r--src/mongo/db/storage/storage_engine.h38
-rw-r--r--src/mongo/db/storage/storage_engine_impl.h4
-rw-r--r--src/mongo/db/storage/storage_engine_mock.h3
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp34
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h8
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp3
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp2
10 files changed, 0 insertions, 107 deletions
diff --git a/src/mongo/db/catalog/multi_index_block.cpp b/src/mongo/db/catalog/multi_index_block.cpp
index 9fef20e4559..ca147b71fe6 100644
--- a/src/mongo/db/catalog/multi_index_block.cpp
+++ b/src/mongo/db/catalog/multi_index_block.cpp
@@ -696,8 +696,6 @@ Status MultiIndexBlock::commit(OperationContext* opCtx,
// checkpoint.
//
// TODO (SERVER-44012): to remove this workaround.
- auto checkpointLock =
- opCtx->getServiceContext()->getStorageEngine()->getCheckpointLock(opCtx);
auto indexIdent =
opCtx->getServiceContext()->getStorageEngine()->getCatalog()->getIndexIdent(
opCtx, collection->getCatalogId(), _indexes[i].block->getIndexName());
diff --git a/src/mongo/db/storage/kv/kv_engine.h b/src/mongo/db/storage/kv/kv_engine.h
index 3716211e99f..1fa32db2a55 100644
--- a/src/mongo/db/storage/kv/kv_engine.h
+++ b/src/mongo/db/storage/kv/kv_engine.h
@@ -252,15 +252,6 @@ public:
"The current storage engine doesn't support backup mode");
}
- /**
- * See StorageEngine::getCheckpointLock for details.
- */
- virtual std::unique_ptr<StorageEngine::CheckpointLock> getCheckpointLock(
- OperationContext* opCtx) {
- uasserted(ErrorCodes::CommandNotSupported,
- "The current storage engine does not support checkpoints");
- }
-
virtual void addIndividuallyCheckpointedIndexToList(const std::string& ident) {
uasserted(ErrorCodes::CommandNotSupported,
"The current storage engine does not support checkpoints");
diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h
index c39f046cbc1..493a4b2c06c 100644
--- a/src/mongo/db/storage/storage_engine.h
+++ b/src/mongo/db/storage/storage_engine.h
@@ -188,36 +188,6 @@ public:
};
/**
- * RAII-style class required for checkpoint activity. Instances should be obtained via
- * getCheckpointLock() calls.
- *
- * Operations taking a checkpoint should create a CheckpointLock first. Also used when opening
- * several checkpoint cursors to guarantee that all cursors are against the same checkpoint.
- *
- * This interface is placed in the StorageEngine in order to be accessible externally and
- * internally to the storage layer. Each storage engine chooses how to implement it.
- */
- class CheckpointLock {
- CheckpointLock(const CheckpointLock&) = delete;
- CheckpointLock& operator=(const CheckpointLock&) = delete;
-
- // We should never call the move constructor of the base class. We should not create base
- // CheckpointLock instances, so any CheckpointLock type will actually be an instance of a
- // derived class. At that point, moving the CheckpointLock type would call this constructor
- // and skip the derived class' move constructor, likely leading to subtle bugs.
- //
- // Always using CheckpointLock pointer types will obviate needing a move constructor in
- // either base or derived classes.
- CheckpointLock(CheckpointLock&&) = delete;
-
- public:
- virtual ~CheckpointLock() = default;
-
- protected:
- CheckpointLock() = default;
- };
-
- /**
* The destructor should only be called if we are tearing down but not exiting the process.
*/
virtual ~StorageEngine() {}
@@ -626,14 +596,6 @@ public:
virtual DurableCatalog* getCatalog() = 0;
virtual const DurableCatalog* getCatalog() const = 0;
- /**
- * Returns a CheckpointLock RAII instance that holds the checkpoint resource mutex.
- *
- * All operations taking a checkpoint should use this CheckpointLock. Also applicable for
- * opening several checkpoint cursors to ensure the same checkpoint is targeted.
- */
- virtual std::unique_ptr<CheckpointLock> getCheckpointLock(OperationContext* opCtx) = 0;
-
virtual void addIndividuallyCheckpointedIndexToList(const std::string& ident) = 0;
virtual void clearIndividuallyCheckpointedIndexesList() = 0;
diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h
index e4a1f2eb64b..797349d9a13 100644
--- a/src/mongo/db/storage/storage_engine_impl.h
+++ b/src/mongo/db/storage/storage_engine_impl.h
@@ -328,10 +328,6 @@ public:
return _catalog.get();
}
- std::unique_ptr<CheckpointLock> getCheckpointLock(OperationContext* opCtx) override {
- return _engine->getCheckpointLock(opCtx);
- }
-
void addIndividuallyCheckpointedIndexToList(const std::string& ident) override {
return _engine->addIndividuallyCheckpointedIndexToList(ident);
}
diff --git a/src/mongo/db/storage/storage_engine_mock.h b/src/mongo/db/storage/storage_engine_mock.h
index 49375b1d421..0beac0d8e93 100644
--- a/src/mongo/db/storage/storage_engine_mock.h
+++ b/src/mongo/db/storage/storage_engine_mock.h
@@ -179,9 +179,6 @@ public:
const DurableCatalog* getCatalog() const final {
return nullptr;
}
- std::unique_ptr<CheckpointLock> getCheckpointLock(OperationContext* opCtx) final {
- return nullptr;
- }
void addIndividuallyCheckpointedIndexToList(const std::string& ident) final {}
void clearIndividuallyCheckpointedIndexesList() final {}
bool isInIndividuallyCheckpointedIndexesList(const std::string& ident) const final {
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
index 2c9dd2d8dec..cd4f6ed7113 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
@@ -491,10 +491,6 @@ Status WiredTigerIndex::compact(OperationContext* opCtx) {
if (!cache->isEphemeral()) {
WT_SESSION* s = WiredTigerRecoveryUnit::get(opCtx)->getSession()->getSession();
opCtx->recoveryUnit()->abandonSnapshot();
- // WT compact prompts WT to take checkpoints, so we need to take the checkpoint lock around
- // WT compact calls.
- auto checkpointLock =
- opCtx->getServiceContext()->getStorageEngine()->getCheckpointLock(opCtx);
int ret = s->compact(s, uri().c_str(), "timeout=0");
invariantWTOK(ret);
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index 1741ebf601c..30e2b8ad937 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -238,33 +238,6 @@ private:
stdx::condition_variable _condvar;
};
-namespace {
-
-/**
- * RAII class that holds an exclusive lock on the checkpoint resource mutex.
- *
- * Instances are created via getCheckpointLock(), which passes in the checkpoint resource mutex.
- */
-class CheckpointLockImpl : public StorageEngine::CheckpointLock {
- CheckpointLockImpl(const CheckpointLockImpl&) = delete;
- CheckpointLockImpl& operator=(const CheckpointLockImpl&) = delete;
- CheckpointLockImpl(CheckpointLockImpl&& other) = delete;
-
-public:
- CheckpointLockImpl() = delete;
- CheckpointLockImpl(OperationContext* opCtx, Lock::ResourceMutex mutex)
- : _lk(opCtx->lockState(), mutex) {
- invariant(_lk.isLocked());
- }
-
- ~CheckpointLockImpl() = default;
-
-private:
- Lock::ExclusiveLock _lk;
-};
-
-} // namespace
-
std::string toString(const StorageEngine::OldestActiveTransactionTimestampResult& r) {
if (r.isOK()) {
if (r.getValue()) {
@@ -351,7 +324,6 @@ public:
if (initialDataTimestamp.asULL() <= 1) {
UniqueWiredTigerSession session = _sessionCache->getSession();
WT_SESSION* s = session->getSession();
- auto checkpointLock = _wiredTigerKVEngine->getCheckpointLock(opCtx.get());
_wiredTigerKVEngine->clearIndividuallyCheckpointedIndexesList();
invariantWTOK(s->checkpoint(s, "use_timestamp=false"));
} else if (stableTimestamp < initialDataTimestamp) {
@@ -377,7 +349,6 @@ public:
UniqueWiredTigerSession session = _sessionCache->getSession();
WT_SESSION* s = session->getSession();
{
- auto checkpointLock = _wiredTigerKVEngine->getCheckpointLock(opCtx.get());
_wiredTigerKVEngine->clearIndividuallyCheckpointedIndexesList();
invariantWTOK(s->checkpoint(s, "use_timestamp=true"));
}
@@ -2185,11 +2156,6 @@ Timestamp WiredTigerKVEngine::getPinnedOplog() const {
return Timestamp::min();
}
-std::unique_ptr<StorageEngine::CheckpointLock> WiredTigerKVEngine::getCheckpointLock(
- OperationContext* opCtx) {
- return std::make_unique<CheckpointLockImpl>(opCtx, _checkpointMutex);
-}
-
bool WiredTigerKVEngine::isInIndividuallyCheckpointedIndexesList(const std::string& ident) const {
for (auto it = _checkpointedIndexes.begin(); it != _checkpointedIndexes.end(); ++it) {
if (*it == ident) {
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
index b26d5149bd6..c7511c3e354 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h
@@ -347,12 +347,6 @@ public:
return _clockSource;
}
- /**
- * Returns a CheckpointLockImpl RAII instance holding the _checkpointMutex.
- */
- std::unique_ptr<StorageEngine::CheckpointLock> getCheckpointLock(
- OperationContext* opCtx) override;
-
void addIndividuallyCheckpointedIndexToList(const std::string& ident) override {
_checkpointedIndexes.push_back(ident);
}
@@ -487,8 +481,6 @@ private:
// A list of indexes that were individually checkpoint'ed and are not consistent with the rest
// of the checkpoint's PIT view of the storage data. This list is reset when a storage-wide WT
// checkpoint is taken that makes the PIT view consistent again.
- //
- // Access must be protected by the CheckpointLock.
std::list<std::string> _checkpointedIndexes;
std::unique_ptr<WiredTigerEngineRuntimeConfigParameter> _runTimeConfigParam;
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index 23e26e92d63..b5cf62e76dd 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -1711,9 +1711,6 @@ Status WiredTigerRecordStore::compact(OperationContext* opCtx) {
if (!cache->isEphemeral()) {
WT_SESSION* s = WiredTigerRecoveryUnit::get(opCtx)->getSession()->getSession();
opCtx->recoveryUnit()->abandonSnapshot();
- // WT compact prompts WT to take checkpoints, so we need to take the checkpoint lock around
- // WT compact calls.
- auto checkpointLock = _kvEngine->getCheckpointLock(opCtx);
int ret = s->compact(s, getURI().c_str(), "timeout=0");
invariantWTOK(ret);
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
index d6ecc7799d4..4af6a875552 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
@@ -300,7 +300,6 @@ void WiredTigerSessionCache::waitUntilDurable(OperationContext* opCtx,
auto config = syncType == Fsync::kCheckpointStableTimestamp ? "use_timestamp=true"
: "use_timestamp=false";
{
- auto checkpointLock = _engine->getCheckpointLock(opCtx);
_engine->clearIndividuallyCheckpointedIndexesList();
invariantWTOK(s->checkpoint(s, config));
}
@@ -351,7 +350,6 @@ void WiredTigerSessionCache::waitUntilDurable(OperationContext* opCtx,
invariantWTOK(_waitUntilDurableSession->log_flush(_waitUntilDurableSession, "sync=on"));
LOGV2_DEBUG(22419, 4, "flushed journal");
} else {
- auto checkpointLock = _engine->getCheckpointLock(opCtx);
_engine->clearIndividuallyCheckpointedIndexesList();
invariantWTOK(_waitUntilDurableSession->checkpoint(_waitUntilDurableSession, nullptr));
LOGV2_DEBUG(22420, 4, "created checkpoint");