From 2f67f3c66271e724b48afa2db88e8b6c3317f6ab Mon Sep 17 00:00:00 2001 From: Dianna Hohensee Date: Fri, 11 Jan 2019 09:52:44 -0500 Subject: [PATCH] SERVER-33161 make the second phase of index two-phase drop occur when drop reaches checkpointed instead of oldest --- src/mongo/db/storage/kv/kv_storage_engine.cpp | 20 +++++++++---------- src/mongo/db/storage/kv/kv_storage_engine.h | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mongo/db/storage/kv/kv_storage_engine.cpp b/src/mongo/db/storage/kv/kv_storage_engine.cpp index a09d4c7a743d1..c7e09dfcf7925 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine.cpp +++ b/src/mongo/db/storage/kv/kv_storage_engine.cpp @@ -89,9 +89,9 @@ KVStorageEngine::KVStorageEngine( _options(std::move(options)), _databaseCatalogEntryFactory(std::move(databaseCatalogEntryFactory)), _dropPendingIdentReaper(engine), - _oldestTimestampListener( - TimestampMonitor::TimestampType::kOldest, - [this](Timestamp timestamp) { _onOldestTimestampChanged(timestamp); }), + _checkpointTimestampListener( + TimestampMonitor::TimestampType::kCheckpoint, + [this](Timestamp timestamp) { _onCheckpointTimestampChanged(timestamp); }), _supportsDocLocking(_engine->supportsDocLocking()), _supportsDBLocking(_engine->supportsDBLocking()), _supportsCappedCollections(_engine->supportsCappedCollections()) { @@ -477,7 +477,7 @@ std::string KVStorageEngine::getFilesystemPathForDb(const std::string& dbName) c void KVStorageEngine::cleanShutdown() { if (_timestampMonitor) { - _timestampMonitor->removeListener(&_oldestTimestampListener); + _timestampMonitor->removeListener(&_checkpointTimestampListener); } for (DBMap::const_iterator it = _dbs.begin(); it != _dbs.end(); ++it) { @@ -501,7 +501,7 @@ void KVStorageEngine::finishInit() { _timestampMonitor = std::make_unique( _engine.get(), getGlobalServiceContext()->getPeriodicRunner()); _timestampMonitor->startup(); - _timestampMonitor->addListener(&_oldestTimestampListener); + _timestampMonitor->addListener(&_checkpointTimestampListener); } } @@ -791,17 +791,17 @@ void KVStorageEngine::addDropPendingIdent(const Timestamp& dropTimestamp, _dropPendingIdentReaper.addDropPendingIdent(dropTimestamp, nss, ident); } -void KVStorageEngine::_onOldestTimestampChanged(const Timestamp& oldestTimestamp) { - if (oldestTimestamp.isNull()) { +void KVStorageEngine::_onCheckpointTimestampChanged(const Timestamp& checkpointTimestamp) { + if (checkpointTimestamp.isNull()) { return; } // No drop-pending idents present if getEarliestDropTimestamp() returns boost::none. if (auto earliestDropTimestamp = _dropPendingIdentReaper.getEarliestDropTimestamp()) { - if (oldestTimestamp > *earliestDropTimestamp) { + if (checkpointTimestamp > *earliestDropTimestamp) { log() << "Removing drop-pending idents with drop timestamps before: " - << oldestTimestamp; + << checkpointTimestamp; auto opCtx = cc().makeOperationContext(); - _dropPendingIdentReaper.dropIdentsOlderThan(opCtx.get(), oldestTimestamp); + _dropPendingIdentReaper.dropIdentsOlderThan(opCtx.get(), checkpointTimestamp); } } } diff --git a/src/mongo/db/storage/kv/kv_storage_engine.h b/src/mongo/db/storage/kv/kv_storage_engine.h index df80e48746fe7..1bd52d7e522fb 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine.h +++ b/src/mongo/db/storage/kv/kv_storage_engine.h @@ -386,9 +386,9 @@ class KVStorageEngine final : public KVStorageEngineInterface, public StorageEng void _dumpCatalog(OperationContext* opCtx); /** - * Called when the oldest timestamp advances in the KVEngine. + * Called when the checkpoint timestamp advances in the KVEngine. */ - void _onOldestTimestampChanged(const Timestamp& oldestTimestamp); + void _onCheckpointTimestampChanged(const Timestamp& checkpointTimestamp); class RemoveDBChange; @@ -402,8 +402,8 @@ class KVStorageEngine final : public KVStorageEngineInterface, public StorageEng // Manages drop-pending idents. Requires access to '_engine'. KVDropPendingIdentReaper _dropPendingIdentReaper; - // Listener for oldest timestamp changes. - TimestampMonitor::TimestampListener _oldestTimestampListener; + // Listener for checkpoint timestamp changes. + TimestampMonitor::TimestampListener _checkpointTimestampListener; const bool _supportsDocLocking; const bool _supportsDBLocking;