diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp
|
index 4c7784f..630ff7f 100644
|
--- a/src/mongo/db/commands/list_collections.cpp
|
+++ b/src/mongo/db/commands/list_collections.cpp
|
@@ -342,6 +342,9 @@ public:
|
SimpleBSONObjComparator::kInstance.evaluate(
|
filterElt.Obj() == ListCollectionsFilter::makeTypeCollectionFilter());
|
if (!skipViews) {
|
+ Lock::CollectionLock(opCtx->lockState(),
|
+ NamespaceString::kSystemDotViewsCollectionName,
|
+ MODE_IS);
|
db->getViewCatalog()->iterate(opCtx, [&](const ViewDefinition& view) {
|
BSONObj viewBson = buildViewBson(view, nameOnly);
|
if (!viewBson.isEmpty()) {
|
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
|
index f06f635..0b9d3e2 100644
|
--- a/src/mongo/db/repl/sync_tail.cpp
|
+++ b/src/mongo/db/repl/sync_tail.cpp
|
@@ -333,8 +333,10 @@ Status SyncTail::syncApply(OperationContext* opCtx,
|
return finishApply(writeConflictRetry(opCtx, "syncApply_CRUD", nss.ns(), [&] {
|
// Need to throw instead of returning a status for it to be properly ignored.
|
try {
|
- AutoGetCollection autoColl(
|
- opCtx, getNsOrUUID(nss, op), fixLockModeForSystemDotViewsChanges(nss, MODE_IX));
|
+ AutoGetCollection autoColl(opCtx,
|
+ getNsOrUUID(nss, op),
|
+ MODE_IX,
|
+ fixLockModeForSystemDotViewsChanges(nss, MODE_IX));
|
auto db = autoColl.getDb();
|
uassert(ErrorCodes::NamespaceNotFound,
|
str::stream() << "missing database (" << nss.db() << ")",
|
diff --git a/src/mongo/db/views/durable_view_catalog.cpp b/src/mongo/db/views/durable_view_catalog.cpp
|
index e0f829b..b3d9e4f 100644
|
--- a/src/mongo/db/views/durable_view_catalog.cpp
|
+++ b/src/mongo/db/views/durable_view_catalog.cpp
|
@@ -54,7 +54,7 @@ namespace mongo {
|
// DurableViewCatalog
|
|
void DurableViewCatalog::onExternalChange(OperationContext* opCtx, const NamespaceString& name) {
|
- dassert(opCtx->lockState()->isDbLockedForMode(name.db(), MODE_IX));
|
+ invariant(opCtx->lockState()->isCollectionLockedForMode(name.ns(), MODE_X));
|
auto databaseHolder = DatabaseHolder::get(opCtx);
|
auto db = databaseHolder->getDb(opCtx, name.db());
|
if (db) {
|