summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp')
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp
index 7a54f771fa6..a2421962853 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp
@@ -259,15 +259,10 @@ Status NamespaceDetailsCollectionCatalogEntry::removeIndex(OperationContext* txn
d->idx(getTotalIndexCount(txn)) = IndexDetails();
}
- // Soneone may be querying the system.indexes namespace directly, so we need to invalidate
- // its cursors. Having to go back up through the DatabaseHolder is a bit of a layering
- // violation, but at this point we're not going to add more MMAPv1 specific interfaces.
- // We can find the name of the database through the first entries of the CollectionMap.
- StringData dbName(nsToDatabaseSubstring(_db->_collections.begin()->first));
- invariant(txn->lockState()->isDbLockedForMode(dbName, MODE_X));
- Database* db = dbHolder().get(txn, dbName);
- Collection* systemIndexes = db->getCollection(db->getSystemIndexesName());
- systemIndexes->getCursorManager()->invalidateDocument(txn, infoLocation, INVALIDATION_DELETION);
+ // Someone may be querying the system.indexes namespace directly, so we need to invalidate
+ // its cursors.
+ MMAPV1DatabaseCatalogEntry::invalidateSystemCollectionRecord(
+ txn, NamespaceString(_db->name(), "system.indexes"), infoLocation);
// remove from system.indexes
_indexRecordStore->deleteRecord(txn, infoLocation);
@@ -394,6 +389,10 @@ void NamespaceDetailsCollectionCatalogEntry::_updateSystemNamespaces(OperationCo
txn, newEntry.objdata(), newEntry.objsize(), false);
fassert(40074, newLocation.getStatus().isOK());
+ // Invalidate old namespace record
+ MMAPV1DatabaseCatalogEntry::invalidateSystemCollectionRecord(
+ txn, NamespaceString(_db->name(), "system.namespaces"), _namespacesRecordId);
+
_namespacesRecordStore->deleteRecord(txn, _namespacesRecordId);
setNamespacesRecordId(txn, newLocation.getValue());