diff options
Diffstat (limited to 'src/mongo/db/views')
-rw-r--r-- | src/mongo/db/views/durable_view_catalog.cpp | 42 | ||||
-rw-r--r-- | src/mongo/db/views/durable_view_catalog.h | 14 | ||||
-rw-r--r-- | src/mongo/db/views/view_catalog.cpp | 87 | ||||
-rw-r--r-- | src/mongo/db/views/view_catalog.h | 28 | ||||
-rw-r--r-- | src/mongo/db/views/view_catalog_test.cpp | 6 |
5 files changed, 89 insertions, 88 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 diff --git a/src/mongo/db/views/durable_view_catalog.h b/src/mongo/db/views/durable_view_catalog.h index 69386768963..3ffec8a152a 100644 --- a/src/mongo/db/views/durable_view_catalog.h +++ b/src/mongo/db/views/durable_view_catalog.h @@ -56,14 +56,14 @@ public: * Thread-safe method to mark a catalog name was changed. This will cause the in-memory * view catalog to be marked invalid */ - static void onExternalChange(OperationContext* txn, const NamespaceString& name); + static void onExternalChange(OperationContext* opCtx, const NamespaceString& name); using Callback = stdx::function<Status(const BSONObj& view)>; - virtual Status iterate(OperationContext* txn, Callback callback) = 0; - virtual void upsert(OperationContext* txn, + virtual Status iterate(OperationContext* opCtx, Callback callback) = 0; + virtual void upsert(OperationContext* opCtx, const NamespaceString& name, const BSONObj& view) = 0; - virtual void remove(OperationContext* txn, const NamespaceString& name) = 0; + virtual void remove(OperationContext* opCtx, const NamespaceString& name) = 0; virtual const std::string& getName() const = 0; }; @@ -75,9 +75,9 @@ class DurableViewCatalogImpl final : public DurableViewCatalog { public: explicit DurableViewCatalogImpl(Database* db) : _db(db) {} - Status iterate(OperationContext* txn, Callback callback); - void upsert(OperationContext* txn, const NamespaceString& name, const BSONObj& view); - void remove(OperationContext* txn, const NamespaceString& name); + Status iterate(OperationContext* opCtx, Callback callback); + void upsert(OperationContext* opCtx, const NamespaceString& name, const BSONObj& view); + void remove(OperationContext* opCtx, const NamespaceString& name); const std::string& getName() const; private: diff --git a/src/mongo/db/views/view_catalog.cpp b/src/mongo/db/views/view_catalog.cpp index d8e0e842824..a3653c794d0 100644 --- a/src/mongo/db/views/view_catalog.cpp +++ b/src/mongo/db/views/view_catalog.cpp @@ -56,23 +56,23 @@ namespace mongo { namespace { -StatusWith<std::unique_ptr<CollatorInterface>> parseCollator(OperationContext* txn, +StatusWith<std::unique_ptr<CollatorInterface>> parseCollator(OperationContext* opCtx, BSONObj collationSpec) { // If 'collationSpec' is empty, return the null collator, which represents the "simple" // collation. if (collationSpec.isEmpty()) { return {nullptr}; } - return CollatorFactoryInterface::get(txn->getServiceContext())->makeFromBSON(collationSpec); + return CollatorFactoryInterface::get(opCtx->getServiceContext())->makeFromBSON(collationSpec); } } // namespace -Status ViewCatalog::reloadIfNeeded(OperationContext* txn) { +Status ViewCatalog::reloadIfNeeded(OperationContext* opCtx) { stdx::lock_guard<stdx::mutex> lk(_mutex); - return _reloadIfNeeded_inlock(txn); + return _reloadIfNeeded_inlock(opCtx); } -Status ViewCatalog::_reloadIfNeeded_inlock(OperationContext* txn) { +Status ViewCatalog::_reloadIfNeeded_inlock(OperationContext* opCtx) { if (_valid.load()) return Status::OK(); @@ -81,9 +81,9 @@ Status ViewCatalog::_reloadIfNeeded_inlock(OperationContext* txn) { // Need to reload, first clear our cache. _viewMap.clear(); - Status status = _durable->iterate(txn, [&](const BSONObj& view) -> Status { + Status status = _durable->iterate(opCtx, [&](const BSONObj& view) -> Status { BSONObj collationSpec = view.hasField("collation") ? view["collation"].Obj() : BSONObj(); - auto collator = parseCollator(txn, collationSpec); + auto collator = parseCollator(opCtx, collationSpec); if (!collator.isOK()) { return collator.getStatus(); } @@ -106,20 +106,20 @@ Status ViewCatalog::_reloadIfNeeded_inlock(OperationContext* txn) { return status; } -void ViewCatalog::iterate(OperationContext* txn, ViewIteratorCallback callback) { +void ViewCatalog::iterate(OperationContext* opCtx, ViewIteratorCallback callback) { stdx::lock_guard<stdx::mutex> lk(_mutex); - _requireValidCatalog_inlock(txn); + _requireValidCatalog_inlock(opCtx); for (auto&& view : _viewMap) { callback(*view.second); } } -Status ViewCatalog::_createOrUpdateView_inlock(OperationContext* txn, +Status ViewCatalog::_createOrUpdateView_inlock(OperationContext* opCtx, const NamespaceString& viewName, const NamespaceString& viewOn, const BSONArray& pipeline, std::unique_ptr<CollatorInterface> collator) { - _requireValidCatalog_inlock(txn); + _requireValidCatalog_inlock(opCtx); // Build the BSON definition for this view to be saved in the durable view catalog. If the // collation is empty, omit it from the definition altogether. @@ -136,27 +136,27 @@ Status ViewCatalog::_createOrUpdateView_inlock(OperationContext* txn, viewName.db(), viewName.coll(), viewOn.coll(), ownedPipeline, std::move(collator)); // Check that the resulting dependency graph is acyclic and within the maximum depth. - Status graphStatus = _upsertIntoGraph(txn, *(view.get())); + Status graphStatus = _upsertIntoGraph(opCtx, *(view.get())); if (!graphStatus.isOK()) { return graphStatus; } - _durable->upsert(txn, viewName, viewDefBuilder.obj()); + _durable->upsert(opCtx, viewName, viewDefBuilder.obj()); _viewMap[viewName.ns()] = view; - txn->recoveryUnit()->onRollback([this, viewName]() { + opCtx->recoveryUnit()->onRollback([this, viewName]() { this->_viewMap.erase(viewName.ns()); this->_viewGraphNeedsRefresh = true; }); // We may get invalidated, but we're exclusively locked, so the change must be ours. - txn->recoveryUnit()->onCommit([this]() { this->_valid.store(true); }); + opCtx->recoveryUnit()->onCommit([this]() { this->_valid.store(true); }); return Status::OK(); } -Status ViewCatalog::_upsertIntoGraph(OperationContext* txn, const ViewDefinition& viewDef) { +Status ViewCatalog::_upsertIntoGraph(OperationContext* opCtx, const ViewDefinition& viewDef) { // Performs the insert into the graph. - auto doInsert = [this, &txn](const ViewDefinition& viewDef, bool needsValidation) -> Status { + auto doInsert = [this, &opCtx](const ViewDefinition& viewDef, bool needsValidation) -> Status { // Make a LiteParsedPipeline to determine the namespaces referenced by this pipeline. AggregationRequest request(viewDef.viewOn(), viewDef.pipeline()); const LiteParsedPipeline liteParsedPipeline(request); @@ -171,7 +171,7 @@ Status ViewCatalog::_upsertIntoGraph(OperationContext* txn, const ViewDefinition resolvedNamespaces[nss.coll()] = {nss, {}}; } boost::intrusive_ptr<ExpressionContext> expCtx = - new ExpressionContext(txn, + new ExpressionContext(opCtx, request, CollatorInterface::cloneCollator(viewDef.defaultCollator()), std::move(resolvedNamespaces)); @@ -194,7 +194,7 @@ Status ViewCatalog::_upsertIntoGraph(OperationContext* txn, const ViewDefinition if (needsValidation) { // Check the collation of all the dependent namespaces before updating the graph. - auto collationStatus = _validateCollation_inlock(txn, viewDef, refs); + auto collationStatus = _validateCollation_inlock(opCtx, viewDef, refs); if (!collationStatus.isOK()) { return collationStatus; } @@ -215,7 +215,7 @@ Status ViewCatalog::_upsertIntoGraph(OperationContext* txn, const ViewDefinition } } // Only if the inserts completed without error will we no longer need a refresh. - txn->recoveryUnit()->onRollback([this]() { this->_viewGraphNeedsRefresh = true; }); + opCtx->recoveryUnit()->onRollback([this]() { this->_viewGraphNeedsRefresh = true; }); _viewGraphNeedsRefresh = false; } @@ -226,11 +226,11 @@ Status ViewCatalog::_upsertIntoGraph(OperationContext* txn, const ViewDefinition return doInsert(viewDef, true); } -Status ViewCatalog::_validateCollation_inlock(OperationContext* txn, +Status ViewCatalog::_validateCollation_inlock(OperationContext* opCtx, const ViewDefinition& view, const std::vector<NamespaceString>& refs) { for (auto&& potentialViewNss : refs) { - auto otherView = _lookup_inlock(txn, potentialViewNss.ns()); + auto otherView = _lookup_inlock(opCtx, potentialViewNss.ns()); if (otherView && !CollatorInterface::collatorsMatch(view.defaultCollator(), otherView->defaultCollator())) { @@ -243,7 +243,7 @@ Status ViewCatalog::_validateCollation_inlock(OperationContext* txn, return Status::OK(); } -Status ViewCatalog::createView(OperationContext* txn, +Status ViewCatalog::createView(OperationContext* opCtx, const NamespaceString& viewName, const NamespaceString& viewOn, const BSONArray& pipeline, @@ -262,7 +262,7 @@ Status ViewCatalog::createView(OperationContext* txn, return Status(ErrorCodes::BadValue, "View must be created on a view or collection in the same database"); - if (_lookup_inlock(txn, StringData(viewName.ns()))) + if (_lookup_inlock(opCtx, StringData(viewName.ns()))) return Status(ErrorCodes::NamespaceExists, "Namespace already exists"); if (!NamespaceString::validCollectionName(viewOn.coll())) @@ -274,15 +274,15 @@ Status ViewCatalog::createView(OperationContext* txn, ErrorCodes::InvalidNamespace, "View name cannot start with 'system.', which is reserved for system namespaces"); - auto collator = parseCollator(txn, collation); + auto collator = parseCollator(opCtx, collation); if (!collator.isOK()) return collator.getStatus(); return _createOrUpdateView_inlock( - txn, viewName, viewOn, pipeline, std::move(collator.getValue())); + opCtx, viewName, viewOn, pipeline, std::move(collator.getValue())); } -Status ViewCatalog::modifyView(OperationContext* txn, +Status ViewCatalog::modifyView(OperationContext* opCtx, const NamespaceString& viewName, const NamespaceString& viewOn, const BSONArray& pipeline) { @@ -300,7 +300,7 @@ Status ViewCatalog::modifyView(OperationContext* txn, return Status(ErrorCodes::BadValue, "View must be created on a view or collection in the same database"); - auto viewPtr = _lookup_inlock(txn, viewName.ns()); + auto viewPtr = _lookup_inlock(opCtx, viewName.ns()); if (!viewPtr) return Status(ErrorCodes::NamespaceNotFound, str::stream() << "cannot modify missing view " << viewName.ns()); @@ -310,24 +310,24 @@ Status ViewCatalog::modifyView(OperationContext* txn, str::stream() << "invalid name for 'viewOn': " << viewOn.coll()); ViewDefinition savedDefinition = *viewPtr; - txn->recoveryUnit()->onRollback([this, txn, viewName, savedDefinition]() { + opCtx->recoveryUnit()->onRollback([this, opCtx, viewName, savedDefinition]() { this->_viewMap[viewName.ns()] = std::make_shared<ViewDefinition>(savedDefinition); }); return _createOrUpdateView_inlock( - txn, + opCtx, viewName, viewOn, pipeline, CollatorInterface::cloneCollator(savedDefinition.defaultCollator())); } -Status ViewCatalog::dropView(OperationContext* txn, const NamespaceString& viewName) { +Status ViewCatalog::dropView(OperationContext* opCtx, const NamespaceString& viewName) { stdx::lock_guard<stdx::mutex> lk(_mutex); - _requireValidCatalog_inlock(txn); + _requireValidCatalog_inlock(opCtx); // Save a copy of the view definition in case we need to roll back. - auto viewPtr = _lookup_inlock(txn, viewName.ns()); + auto viewPtr = _lookup_inlock(opCtx, viewName.ns()); if (!viewPtr) { return {ErrorCodes::NamespaceNotFound, str::stream() << "cannot drop missing view: " << viewName.ns()}; @@ -336,20 +336,21 @@ Status ViewCatalog::dropView(OperationContext* txn, const NamespaceString& viewN ViewDefinition savedDefinition = *viewPtr; invariant(_valid.load()); - _durable->remove(txn, viewName); + _durable->remove(opCtx, viewName); _viewGraph.remove(savedDefinition.name()); _viewMap.erase(viewName.ns()); - txn->recoveryUnit()->onRollback([this, txn, viewName, savedDefinition]() { + opCtx->recoveryUnit()->onRollback([this, opCtx, viewName, savedDefinition]() { this->_viewGraphNeedsRefresh = true; this->_viewMap[viewName.ns()] = std::make_shared<ViewDefinition>(savedDefinition); }); // We may get invalidated, but we're exclusively locked, so the change must be ours. - txn->recoveryUnit()->onCommit([this]() { this->_valid.store(true); }); + opCtx->recoveryUnit()->onCommit([this]() { this->_valid.store(true); }); return Status::OK(); } -std::shared_ptr<ViewDefinition> ViewCatalog::_lookup_inlock(OperationContext* txn, StringData ns) { +std::shared_ptr<ViewDefinition> ViewCatalog::_lookup_inlock(OperationContext* opCtx, + StringData ns) { // We expect the catalog to be valid, so short-circuit other checks for best performance. if (MONGO_unlikely(!_valid.load())) { // If the catalog is invalid, we want to avoid references to virtualized or other invalid @@ -357,11 +358,11 @@ std::shared_ptr<ViewDefinition> ViewCatalog::_lookup_inlock(OperationContext* tx // invalid view definitions. if (!NamespaceString::validCollectionName(ns)) return nullptr; - Status status = _reloadIfNeeded_inlock(txn); + Status status = _reloadIfNeeded_inlock(opCtx); // In case of errors we've already logged a message. Only uassert if there actually is // a user connection, as otherwise we'd crash the server. The catalog will remain invalid, // and any views after the first invalid one are ignored. - if (txn->getClient()->isFromUserConnection()) + if (opCtx->getClient()->isFromUserConnection()) uassertStatusOK(status); } @@ -372,19 +373,19 @@ std::shared_ptr<ViewDefinition> ViewCatalog::_lookup_inlock(OperationContext* tx return nullptr; } -std::shared_ptr<ViewDefinition> ViewCatalog::lookup(OperationContext* txn, StringData ns) { +std::shared_ptr<ViewDefinition> ViewCatalog::lookup(OperationContext* opCtx, StringData ns) { stdx::lock_guard<stdx::mutex> lk(_mutex); - return _lookup_inlock(txn, ns); + return _lookup_inlock(opCtx, ns); } -StatusWith<ResolvedView> ViewCatalog::resolveView(OperationContext* txn, +StatusWith<ResolvedView> ViewCatalog::resolveView(OperationContext* opCtx, const NamespaceString& nss) { stdx::lock_guard<stdx::mutex> lk(_mutex); const NamespaceString* resolvedNss = &nss; std::vector<BSONObj> resolvedPipeline; for (int i = 0; i < ViewGraph::kMaxViewDepth; i++) { - auto view = _lookup_inlock(txn, resolvedNss->ns()); + auto view = _lookup_inlock(opCtx, resolvedNss->ns()); if (!view) { // Return error status if pipeline is too large. int pipelineSize = 0; diff --git a/src/mongo/db/views/view_catalog.h b/src/mongo/db/views/view_catalog.h index f0c6dac89ca..a8fea3692f4 100644 --- a/src/mongo/db/views/view_catalog.h +++ b/src/mongo/db/views/view_catalog.h @@ -70,7 +70,7 @@ public: * executes under the catalog's mutex, so it must not access other methods of the catalog, * acquire locks or run for a long time. */ - void iterate(OperationContext* txn, ViewIteratorCallback callback); + void iterate(OperationContext* opCtx, ViewIteratorCallback callback); /** * Create a new view 'viewName' with contents defined by running the specified aggregation @@ -81,7 +81,7 @@ public: * * Must be in WriteUnitOfWork. View creation rolls back if the unit of work aborts. */ - Status createView(OperationContext* txn, + Status createView(OperationContext* opCtx, const NamespaceString& viewName, const NamespaceString& viewOn, const BSONArray& pipeline, @@ -92,14 +92,14 @@ public: * * Must be in WriteUnitOfWork. The drop rolls back if the unit of work aborts. */ - Status dropView(OperationContext* txn, const NamespaceString& viewName); + Status dropView(OperationContext* opCtx, const NamespaceString& viewName); /** * Modify the view named 'viewName' to have the new 'viewOn' and 'pipeline'. * * Must be in WriteUnitOfWork. The modification rolls back if the unit of work aborts. */ - Status modifyView(OperationContext* txn, + Status modifyView(OperationContext* opCtx, const NamespaceString& viewName, const NamespaceString& viewOn, const BSONArray& pipeline); @@ -108,14 +108,14 @@ public: * Look up the 'nss' in the view catalog, returning a shared pointer to a View definition, or * nullptr if it doesn't exist. */ - std::shared_ptr<ViewDefinition> lookup(OperationContext* txn, StringData nss); + std::shared_ptr<ViewDefinition> lookup(OperationContext* opCtx, StringData nss); /** * Resolve the views on 'nss', transforming the pipeline appropriately. This function returns a * fully-resolved view definition containing the backing namespace, the resolved pipeline and * the collation to use for the operation. */ - StatusWith<ResolvedView> resolveView(OperationContext* txn, const NamespaceString& nss); + StatusWith<ResolvedView> resolveView(OperationContext* opCtx, const NamespaceString& nss); /** * Reload the views catalog if marked invalid. No-op if already valid. Does only minimal @@ -124,7 +124,7 @@ public: * cycle detection etc. This is implicitly called by other methods when the ViewCatalog is * marked invalid, and on first opening a database. */ - Status reloadIfNeeded(OperationContext* txn); + Status reloadIfNeeded(OperationContext* opCtx); /** * To be called when direct modifications to the DurableViewCatalog have been committed, so @@ -136,7 +136,7 @@ public: } private: - Status _createOrUpdateView_inlock(OperationContext* txn, + Status _createOrUpdateView_inlock(OperationContext* opCtx, const NamespaceString& viewName, const NamespaceString& viewOn, const BSONArray& pipeline, @@ -145,21 +145,21 @@ private: * Parses the view definition pipeline, attempts to upsert into the view graph, and refreshes * the graph if necessary. Returns an error status if the resulting graph would be invalid. */ - Status _upsertIntoGraph(OperationContext* txn, const ViewDefinition& viewDef); + Status _upsertIntoGraph(OperationContext* opCtx, const ViewDefinition& viewDef); /** * Returns Status::OK if each view namespace in 'refs' has the same default collation as 'view'. * Otherwise, returns ErrorCodes::OptionNotSupportedOnView. */ - Status _validateCollation_inlock(OperationContext* txn, + Status _validateCollation_inlock(OperationContext* opCtx, const ViewDefinition& view, const std::vector<NamespaceString>& refs); - std::shared_ptr<ViewDefinition> _lookup_inlock(OperationContext* txn, StringData ns); - Status _reloadIfNeeded_inlock(OperationContext* txn); + std::shared_ptr<ViewDefinition> _lookup_inlock(OperationContext* opCtx, StringData ns); + Status _reloadIfNeeded_inlock(OperationContext* opCtx); - void _requireValidCatalog_inlock(OperationContext* txn) { - uassertStatusOK(_reloadIfNeeded_inlock(txn)); + void _requireValidCatalog_inlock(OperationContext* opCtx) { + uassertStatusOK(_reloadIfNeeded_inlock(opCtx)); invariant(_valid.load()); } diff --git a/src/mongo/db/views/view_catalog_test.cpp b/src/mongo/db/views/view_catalog_test.cpp index 1a034533a58..d6303eb8070 100644 --- a/src/mongo/db/views/view_catalog_test.cpp +++ b/src/mongo/db/views/view_catalog_test.cpp @@ -66,14 +66,14 @@ public: static const std::string name; using Callback = stdx::function<Status(const BSONObj& view)>; - virtual Status iterate(OperationContext* txn, Callback callback) { + virtual Status iterate(OperationContext* opCtx, Callback callback) { ++_iterateCount; return Status::OK(); } - virtual void upsert(OperationContext* txn, const NamespaceString& name, const BSONObj& view) { + virtual void upsert(OperationContext* opCtx, const NamespaceString& name, const BSONObj& view) { ++_upsertCount; } - virtual void remove(OperationContext* txn, const NamespaceString& name) {} + virtual void remove(OperationContext* opCtx, const NamespaceString& name) {} virtual const std::string& getName() const { return name; }; |