diff options
Diffstat (limited to 'src/mongo/db/views/durable_view_catalog.cpp')
-rw-r--r-- | src/mongo/db/views/durable_view_catalog.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/mongo/db/views/durable_view_catalog.cpp b/src/mongo/db/views/durable_view_catalog.cpp index 1b597081d50..849ce37d4f4 100644 --- a/src/mongo/db/views/durable_view_catalog.cpp +++ b/src/mongo/db/views/durable_view_catalog.cpp @@ -50,12 +50,12 @@ namespace mongo { // DurableViewCatalog -void DurableViewCatalog::onExternalChange(OperationContext* txn, const NamespaceString& name) { - dassert(txn->lockState()->isDbLockedForMode(name.db(), MODE_IX)); - Database* db = dbHolder().get(txn, name.db()); +void DurableViewCatalog::onExternalChange(OperationContext* opCtx, const NamespaceString& name) { + dassert(opCtx->lockState()->isDbLockedForMode(name.db(), MODE_IX)); + Database* db = dbHolder().get(opCtx, name.db()); if (db) { - txn->recoveryUnit()->onCommit([db]() { db->getViewCatalog()->invalidate(); }); + opCtx->recoveryUnit()->onCommit([db]() { db->getViewCatalog()->invalidate(); }); } } @@ -65,15 +65,15 @@ const std::string& DurableViewCatalogImpl::getName() const { return _db->name(); } -Status DurableViewCatalogImpl::iterate(OperationContext* txn, Callback callback) { - dassert(txn->lockState()->isDbLockedForMode(_db->name(), MODE_IS) || - txn->lockState()->isDbLockedForMode(_db->name(), MODE_IX)); +Status DurableViewCatalogImpl::iterate(OperationContext* opCtx, Callback callback) { + dassert(opCtx->lockState()->isDbLockedForMode(_db->name(), MODE_IS) || + opCtx->lockState()->isDbLockedForMode(_db->name(), MODE_IX)); Collection* systemViews = _db->getCollection(_db->getSystemViewsName()); if (!systemViews) return Status::OK(); - Lock::CollectionLock lk(txn->lockState(), _db->getSystemViewsName(), MODE_IS); - auto cursor = systemViews->getCursor(txn); + Lock::CollectionLock lk(opCtx->lockState(), _db->getSystemViewsName(), MODE_IS); + auto cursor = systemViews->getCursor(opCtx); while (auto record = cursor->next()) { RecordData& data = record->data; @@ -119,22 +119,22 @@ Status DurableViewCatalogImpl::iterate(OperationContext* txn, Callback callback) return Status::OK(); } -void DurableViewCatalogImpl::upsert(OperationContext* txn, +void DurableViewCatalogImpl::upsert(OperationContext* opCtx, const NamespaceString& name, const BSONObj& view) { - dassert(txn->lockState()->isDbLockedForMode(_db->name(), MODE_X)); + dassert(opCtx->lockState()->isDbLockedForMode(_db->name(), MODE_X)); NamespaceString systemViewsNs(_db->getSystemViewsName()); - Collection* systemViews = _db->getOrCreateCollection(txn, systemViewsNs.ns()); + Collection* systemViews = _db->getOrCreateCollection(opCtx, systemViewsNs.ns()); const bool requireIndex = false; - RecordId id = Helpers::findOne(txn, systemViews, BSON("_id" << name.ns()), requireIndex); + RecordId id = Helpers::findOne(opCtx, systemViews, BSON("_id" << name.ns()), requireIndex); const bool enforceQuota = true; Snapshotted<BSONObj> oldView; - if (!id.isNormal() || !systemViews->findDoc(txn, id, &oldView)) { + if (!id.isNormal() || !systemViews->findDoc(opCtx, id, &oldView)) { LOG(2) << "insert view " << view << " into " << _db->getSystemViewsName(); uassertStatusOK( - systemViews->insertDocument(txn, view, &CurOp::get(txn)->debug(), enforceQuota)); + systemViews->insertDocument(opCtx, view, &CurOp::get(opCtx)->debug(), enforceQuota)); } else { OplogUpdateEntryArgs args; args.ns = systemViewsNs.ns(); @@ -143,29 +143,29 @@ void DurableViewCatalogImpl::upsert(OperationContext* txn, args.fromMigrate = false; const bool assumeIndexesAreAffected = true; - auto res = systemViews->updateDocument(txn, + auto res = systemViews->updateDocument(opCtx, id, oldView, view, enforceQuota, assumeIndexesAreAffected, - &CurOp::get(txn)->debug(), + &CurOp::get(opCtx)->debug(), &args); uassertStatusOK(res); } } -void DurableViewCatalogImpl::remove(OperationContext* txn, const NamespaceString& name) { - dassert(txn->lockState()->isDbLockedForMode(_db->name(), MODE_X)); +void DurableViewCatalogImpl::remove(OperationContext* opCtx, const NamespaceString& name) { + dassert(opCtx->lockState()->isDbLockedForMode(_db->name(), MODE_X)); Collection* systemViews = _db->getCollection(_db->getSystemViewsName()); if (!systemViews) return; const bool requireIndex = false; - RecordId id = Helpers::findOne(txn, systemViews, BSON("_id" << name.ns()), requireIndex); + RecordId id = Helpers::findOne(opCtx, systemViews, BSON("_id" << name.ns()), requireIndex); if (!id.isNormal()) return; LOG(2) << "remove view " << name << " from " << _db->getSystemViewsName(); - systemViews->deleteDocument(txn, id, &CurOp::get(txn)->debug()); + systemViews->deleteDocument(opCtx, id, &CurOp::get(opCtx)->debug()); } } // namespace mongo |