diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-05-18 17:29:14 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2018-06-07 08:45:11 -0400 |
commit | 80de0da37b00dbeed576b28a842cb172b6714358 (patch) | |
tree | 383e2c5b393eb67688cadd182af88ed18af5d473 /src/mongo/db/s | |
parent | 15e7ffc06ef9b38f9ffe2d85fc691c9b5a567bbd (diff) | |
download | mongo-80de0da37b00dbeed576b28a842cb172b6714358.tar.gz |
SERVER-32198 Get rid of CollectionShardingState::collectionIsSharded
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r-- | src/mongo/db/s/collection_sharding_state.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/s/collection_sharding_state.h | 6 | ||||
-rw-r--r-- | src/mongo/db/s/get_shard_version_command.cpp | 2 |
3 files changed, 1 insertions, 19 deletions
diff --git a/src/mongo/db/s/collection_sharding_state.cpp b/src/mongo/db/s/collection_sharding_state.cpp index d457d260f09..2d6dfed45e0 100644 --- a/src/mongo/db/s/collection_sharding_state.cpp +++ b/src/mongo/db/s/collection_sharding_state.cpp @@ -258,18 +258,6 @@ void CollectionShardingState::checkShardVersionOrThrow(OperationContext* opCtx) } } -bool CollectionShardingState::collectionIsSharded(OperationContext* opCtx) { - auto metadata = getMetadata(opCtx).getMetadata(); - if (metadata && (metadata->getCollVersion().isStrictlyEqualTo(ChunkVersion::UNSHARDED()))) { - return false; - } - - // If 'metadata' is null, then the shard doesn't know if this collection is sharded or not. In - // this scenario we will assume this collection is sharded. We will know sharding state - // definitively once SERVER-24960 has been fixed. - return true; -} - // Call with collection unlocked. Note that the CollectionShardingState object involved might not // exist anymore at the time of the call, or indeed anytime outside the AutoGetCollection block, so // anything that might alias something in it must be copied first. diff --git a/src/mongo/db/s/collection_sharding_state.h b/src/mongo/db/s/collection_sharding_state.h index 398c4833b29..f16c41d6dc8 100644 --- a/src/mongo/db/s/collection_sharding_state.h +++ b/src/mongo/db/s/collection_sharding_state.h @@ -164,12 +164,6 @@ public: void checkShardVersionOrThrow(OperationContext* opCtx); /** - * Returns whether this collection is sharded. Valid only if mongoD is primary. - * TODO SERVER-24960: This method may return a false positive until SERVER-24960 is fixed. - */ - bool collectionIsSharded(OperationContext* opCtx); - - /** * Tracks deletion of any documents within the range, returning when deletion is complete. * Throws if the collection is dropped while it sleeps. */ diff --git a/src/mongo/db/s/get_shard_version_command.cpp b/src/mongo/db/s/get_shard_version_command.cpp index 4fd8a6d2261..cd5a8febb8e 100644 --- a/src/mongo/db/s/get_shard_version_command.cpp +++ b/src/mongo/db/s/get_shard_version_command.cpp @@ -60,7 +60,7 @@ public: } AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { - return AllowedOnSecondary::kNever; + return AllowedOnSecondary::kAlways; } bool adminOnly() const override { |