summaryrefslogtreecommitdiff
path: root/src/mongo/db/db_raii.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2019-06-18 14:29:46 -0400
committerRandolph Tan <randolph@10gen.com>2019-06-27 14:08:59 -0400
commit0d07bf5e7a72a5bce3f7d7d681a71d7ecfe7eb8c (patch)
tree6316b1ceee6a890fe075873bb8af853ba37dc750 /src/mongo/db/db_raii.cpp
parentd6834482ef9bbca8fd81e82483dedde965de9574 (diff)
downloadmongo-0d07bf5e7a72a5bce3f7d7d681a71d7ecfe7eb8c.tar.gz
SERVER-40258 Relax locking requirements for sharding metadata refresh on shards
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r--src/mongo/db/db_raii.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index fae5952f834..8cf2455629b 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -318,8 +318,9 @@ AutoGetCollectionForReadCommand::AutoGetCollectionForReadCommand(
: kDoNotChangeProfilingLevel,
deadline) {
if (!_autoCollForRead.getView()) {
- // We have both the DB and collection locked, which is the prerequisite to do a stable shard
- // version check, but we'd like to do the check after we have a satisfactory snapshot.
+ // Perform the check early so the query planner would be able to extract the correct
+ // shard key. Also make sure that version is compatible if query planner decides to
+ // use an empty plan.
auto css = CollectionShardingState::get(opCtx, _autoCollForRead.getNss());
css->checkShardVersionOrThrow(opCtx);
}