diff options
author | Blake Oler <blake.oler@mongodb.com> | 2019-06-19 17:21:34 -0400 |
---|---|---|
committer | Blake Oler <blake.oler@mongodb.com> | 2019-06-26 16:50:38 -0400 |
commit | 42c1fa4f55a55fd9cc98a57f691160152acacf7e (patch) | |
tree | 37808992e4e943149e86098b7789feabec84a4fb /src/mongo/db/s/set_shard_version_command.cpp | |
parent | 4d06ab3d983463ab1f593ef2d43554d8f095fd39 (diff) | |
download | mongo-42c1fa4f55a55fd9cc98a57f691160152acacf7e.tar.gz |
SERVER-41813 Allow ViewCatalog lookup without validating system views
Diffstat (limited to 'src/mongo/db/s/set_shard_version_command.cpp')
-rw-r--r-- | src/mongo/db/s/set_shard_version_command.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/db/s/set_shard_version_command.cpp b/src/mongo/db/s/set_shard_version_command.cpp index 0eb2fbde66c..8db4f26f347 100644 --- a/src/mongo/db/s/set_shard_version_command.cpp +++ b/src/mongo/db/s/set_shard_version_command.cpp @@ -222,15 +222,17 @@ public: repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesForDatabase(opCtx, nss.db())); - // Views do not require a shard version check. + boost::optional<Lock::CollectionLock> collLock; + collLock.emplace(opCtx, nss, MODE_IS); + + // Views do not require a shard version check. We do not care about invalid system views + // for this check, only to validate if a view already exists for this namespace. if (autoDb->getDb() && !autoDb->getDb()->getCollection(opCtx, nss) && - ViewCatalog::get(autoDb->getDb())->lookup(opCtx, nss.ns())) { + ViewCatalog::get(autoDb->getDb()) + ->lookupWithoutValidatingDurableViews(opCtx, nss.ns())) { return true; } - boost::optional<Lock::CollectionLock> collLock; - collLock.emplace(opCtx, nss, MODE_IS); - auto* const css = CollectionShardingState::get(opCtx, nss); const ChunkVersion collectionShardVersion = [&] { auto optMetadata = css->getCurrentMetadataIfKnown(); |