diff options
Diffstat (limited to 'src/mongo/s/d_state.cpp')
-rw-r--r-- | src/mongo/s/d_state.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/s/d_state.cpp b/src/mongo/s/d_state.cpp index 9e1a413690a..5f9cfff51bf 100644 --- a/src/mongo/s/d_state.cpp +++ b/src/mongo/s/d_state.cpp @@ -218,12 +218,17 @@ bool haveLocalShardingInfo(OperationContext* txn, const string& ns) { return false; } - auto css = CollectionShardingState::get(txn, ns); - if (!css->getMetadata()) { - return false; + const auto& oss = OperationShardingState::get(txn); + if (oss.hasShardVersion()) { + return true; + } + + const auto& sci = ShardedConnectionInfo::get(txn->getClient(), false); + if (sci && !sci->getVersion(ns).isStrictlyEqualTo(ChunkVersion::UNSHARDED())) { + return true; } - return ShardedConnectionInfo::get(txn->getClient(), false) != nullptr; + return false; } void usingAShardConnection(const string& addr) {} |