diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-11-20 18:32:31 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-11-20 20:24:29 -0500 |
commit | 56a1d0887ba26a9d760eba2237643d17932d2e29 (patch) | |
tree | 452d2f8de2bd942e688bcc4261a0a7236457f08c | |
parent | 08d239f5c350910f0aa5631d8ad79cdf0bd6d43f (diff) | |
download | mongo-56a1d0887ba26a9d760eba2237643d17932d2e29.tar.gz |
SERVER-32047 Make `forceRoutingTableRefresh` wait for critical section outside of collection lock
(cherry picked from commit 1ed3f218239da2a3913dba8d45f59a7dab430fd3)
-rw-r--r-- | src/mongo/db/s/force_routing_table_refresh_command.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/db/s/force_routing_table_refresh_command.cpp b/src/mongo/db/s/force_routing_table_refresh_command.cpp index 16db83b4d49..0ca0c80bb8b 100644 --- a/src/mongo/db/s/force_routing_table_refresh_command.cpp +++ b/src/mongo/db/s/force_routing_table_refresh_command.cpp @@ -106,6 +106,8 @@ public: "Can't issue forceRoutingTableRefresh from 'eval'", !opCtx->getClient()->isInDirectClient()); + auto& oss = OperationShardingState::get(opCtx); + const NamespaceString nss(parseNs(dbname, cmdObj)); { @@ -116,17 +118,17 @@ public: // of the commit (and new writes to the committed chunk) that hasn't yet propagated back // to this shard. This ensures the read your own writes causal consistency guarantee. auto css = CollectionShardingState::get(opCtx, nss); - if (css && css->getMigrationSourceManager()) { + if (css->getMigrationSourceManager()) { auto criticalSectionSignal = css->getMigrationSourceManager()->getMigrationCriticalSectionSignal(true); if (criticalSectionSignal) { - auto& oss = OperationShardingState::get(opCtx); oss.setMigrationCriticalSectionSignal(criticalSectionSignal); - oss.waitForMigrationCriticalSectionSignal(opCtx); } } } + oss.waitForMigrationCriticalSectionSignal(opCtx); + LOG(1) << "Forcing routing table refresh for " << nss; ChunkVersion unusedShardVersion; |