diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-04-13 10:16:47 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-04-14 18:28:44 -0400 |
commit | e96a5090084d5d80f1349b3223d38f5f52c013f0 (patch) | |
tree | 9c2a0daa1537fa603c8500f1e61a86bc8e583563 /src/mongo/db/s/sharding_state.cpp | |
parent | 12d552607487faa7fc457577845c2e3623b21541 (diff) | |
download | mongo-e96a5090084d5d80f1349b3223d38f5f52c013f0.tar.gz |
SERVER-28739 make the js scripting engine correctly verify that accessed collections are unsharded
Diffstat (limited to 'src/mongo/db/s/sharding_state.cpp')
-rw-r--r-- | src/mongo/db/s/sharding_state.cpp | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/src/mongo/db/s/sharding_state.cpp b/src/mongo/db/s/sharding_state.cpp index 2646af582dd..0b3bc8bd9fb 100644 --- a/src/mongo/db/s/sharding_state.cpp +++ b/src/mongo/db/s/sharding_state.cpp @@ -63,7 +63,6 @@ #include "mongo/s/client/shard_registry.h" #include "mongo/s/client/sharding_network_connection_hook.h" #include "mongo/s/grid.h" -#include "mongo/s/local_sharding_info.h" #include "mongo/s/sharding_initialization.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" @@ -111,30 +110,6 @@ void updateShardIdentityConfigStringCB(const string& setName, const string& newC } } -bool haveLocalShardingInfo(OperationContext* opCtx, const string& ns) { - if (!ShardingState::get(opCtx)->enabled()) { - return false; - } - - const auto& oss = OperationShardingState::get(opCtx); - if (oss.hasShardVersion()) { - return true; - } - - const auto& sci = ShardedConnectionInfo::get(opCtx->getClient(), false); - if (sci && !sci->getVersion(ns).isStrictlyEqualTo(ChunkVersion::UNSHARDED())) { - return true; - } - - return false; -} - -MONGO_INITIALIZER_WITH_PREREQUISITES(MongoDLocalShardingInfo, ("SetGlobalEnvironment")) -(InitializerContext* context) { - enableLocalShardingInfo(getGlobalServiceContext(), &haveLocalShardingInfo); - return Status::OK(); -} - } // namespace ShardingState::ShardingState() @@ -248,6 +223,7 @@ void ShardingState::scheduleCleanup(const NamespaceString& nss) { Status ShardingState::onStaleShardVersion(OperationContext* opCtx, const NamespaceString& nss, const ChunkVersion& expectedVersion) { + invariant(!opCtx->getClient()->isInDirectClient()); invariant(!opCtx->lockState()->isLocked()); invariant(enabled()); |