From f63bc9057be27a1f9e4189383a5854ae4c8ed5e6 Mon Sep 17 00:00:00 2001 From: Dianna Hohensee Date: Sun, 3 Mar 2019 23:37:33 -0500 Subject: SERVER-39861 Add the collection UUID to log messages about deferring ident drops --- src/mongo/db/storage/kv/kv_collection_catalog_entry.cpp | 12 ++++++++---- src/mongo/db/storage/kv/kv_database_catalog_entry_base.cpp | 12 +++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src/mongo/db/storage/kv') diff --git a/src/mongo/db/storage/kv/kv_collection_catalog_entry.cpp b/src/mongo/db/storage/kv/kv_collection_catalog_entry.cpp index cfbaea424b2..7907e6d068d 100644 --- a/src/mongo/db/storage/kv/kv_collection_catalog_entry.cpp +++ b/src/mongo/db/storage/kv/kv_collection_catalog_entry.cpp @@ -76,11 +76,13 @@ class KVCollectionCatalogEntry::RemoveIndexChange : public RecoveryUnit::Change public: RemoveIndexChange(OperationContext* opCtx, KVCollectionCatalogEntry* cce, + OptionalCollectionUUID uuid, const NamespaceString& indexNss, StringData indexName, StringData ident) : _opCtx(opCtx), _cce(cce), + _uuid(uuid), _indexNss(indexNss), _indexName(indexName), _ident(ident.toString()) {} @@ -92,8 +94,9 @@ public: auto engine = _cce->_engine; auto storageEngine = engine->getStorageEngine(); if (storageEngine->supportsPendingDrops() && commitTimestamp) { - log() << "Deferring ident drop for " << _ident << " (" << _indexNss - << ") with commit timestamp: " << commitTimestamp; + log() << "Deferring table drop for index '" << _indexName << "' on collection '" + << _indexNss << (_uuid ? " (" + _uuid->toString() + ")'" : "") << ". Ident: '" + << _ident << "', commit timestamp: '" << commitTimestamp << "'"; engine->addDropPendingIdent(*commitTimestamp, _indexNss, _ident); } else { auto kvEngine = engine->getEngine(); @@ -103,6 +106,7 @@ public: OperationContext* const _opCtx; KVCollectionCatalogEntry* const _cce; + OptionalCollectionUUID _uuid; const NamespaceString _indexNss; const std::string _indexName; const std::string _ident; @@ -207,8 +211,8 @@ Status KVCollectionCatalogEntry::removeIndex(OperationContext* opCtx, StringData _catalog->putMetaData(opCtx, ns().toString(), md); // Lazily remove to isolate underlying engine from rollback. - opCtx->recoveryUnit()->registerChange( - new RemoveIndexChange(opCtx, this, ns().makeIndexNamespace(indexName), indexName, ident)); + opCtx->recoveryUnit()->registerChange(new RemoveIndexChange( + opCtx, this, md.options.uuid, ns().makeIndexNamespace(indexName), indexName, ident)); return Status::OK(); } diff --git a/src/mongo/db/storage/kv/kv_database_catalog_entry_base.cpp b/src/mongo/db/storage/kv/kv_database_catalog_entry_base.cpp index c3ae35c820d..8860427123b 100644 --- a/src/mongo/db/storage/kv/kv_database_catalog_entry_base.cpp +++ b/src/mongo/db/storage/kv/kv_database_catalog_entry_base.cpp @@ -80,11 +80,13 @@ class KVDatabaseCatalogEntryBase::RemoveCollectionChange : public RecoveryUnit:: public: RemoveCollectionChange(OperationContext* opCtx, KVDatabaseCatalogEntryBase* dce, + OptionalCollectionUUID uuid, StringData collection, StringData ident, KVCollectionCatalogEntry* entry) : _opCtx(opCtx), _dce(dce), + _uuid(uuid), _collection(collection.toString()), _ident(ident.toString()), _entry(entry) {} @@ -97,8 +99,9 @@ public: auto engine = _dce->_engine; auto storageEngine = engine->getStorageEngine(); if (storageEngine->supportsPendingDrops() && commitTimestamp) { - log() << "Deferring ident drop for " << _ident << " (" << _collection - << ") with commit timestamp: " << commitTimestamp; + log() << "Deferring table drop for collection '" << _collection + << (_uuid ? " (" + _uuid->toString() + ")'" : "") << ". Ident: " << _ident + << ", commit timestamp: " << commitTimestamp; engine->addDropPendingIdent(*commitTimestamp, NamespaceString(_collection), _ident); } else { auto kvEngine = engine->getEngine(); @@ -112,6 +115,7 @@ public: OperationContext* const _opCtx; KVDatabaseCatalogEntryBase* const _dce; + OptionalCollectionUUID _uuid; const std::string _collection; const std::string _ident; KVCollectionCatalogEntry* const _entry; @@ -382,6 +386,8 @@ Status KVDatabaseCatalogEntryBase::dropCollection(OperationContext* opCtx, Strin invariant(entry->getTotalIndexCount(opCtx) == 0); + BSONCollectionCatalogEntry::MetaData md = _engine->getCatalog()->getMetaData(opCtx, ns); + OptionalCollectionUUID uuid = md.options.uuid; const std::string ident = _engine->getCatalog()->getCollectionIdent(ns); Status status = _engine->getCatalog()->dropCollection(opCtx, ns); @@ -392,7 +398,7 @@ Status KVDatabaseCatalogEntryBase::dropCollection(OperationContext* opCtx, Strin // This will lazily delete the KVCollectionCatalogEntry and notify the storageEngine to // drop the collection only on WUOW::commit(). opCtx->recoveryUnit()->registerChange( - new RemoveCollectionChange(opCtx, this, ns, ident, it->second)); + new RemoveCollectionChange(opCtx, this, uuid, ns, ident, it->second)); _collections.erase(ns.toString()); -- cgit v1.2.1