Skip to content

Commit

Permalink
SERVER-33161 make the second phase of index two-phase drop occur when…
Browse files Browse the repository at this point in the history
… drop reaches checkpointed instead of oldest
  • Loading branch information
Dianna Hohensee committed Jan 11, 2019
1 parent ac226ba commit 2f67f3c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions src/mongo/db/storage/kv/kv_storage_engine.cpp
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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) {
Expand All @@ -501,7 +501,7 @@ void KVStorageEngine::finishInit() {
_timestampMonitor = std::make_unique<TimestampMonitor>(
_engine.get(), getGlobalServiceContext()->getPeriodicRunner());
_timestampMonitor->startup();
_timestampMonitor->addListener(&_oldestTimestampListener);
_timestampMonitor->addListener(&_checkpointTimestampListener);
}
}

Expand Down Expand Up @@ -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);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/mongo/db/storage/kv/kv_storage_engine.h
Expand Up @@ -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;

Expand All @@ -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;
Expand Down

0 comments on commit 2f67f3c

Please sign in to comment.