summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/operation_sharding_state.cpp
diff options
context:
space:
mode:
authorEsha Maharishi <esha.maharishi@mongodb.com>2016-10-04 14:47:24 -0400
committerEsha Maharishi <esha.maharishi@mongodb.com>2016-10-04 17:42:19 -0400
commite8345ff602fc528dbc33944b21bd344cbea5e3e5 (patch)
treeff9d67d109003d3dd7a7af38f265d93e3ec5df85 /src/mongo/db/s/operation_sharding_state.cpp
parentdfb56737ec8506e60676b93332558cf155b767a7 (diff)
downloadmongo-e8345ff602fc528dbc33944b21bd344cbea5e3e5.tar.gz
SERVER-26102 set shardVersion to IGNORED for system.indexes, but only if a shardVersion was sent in the command
Diffstat (limited to 'src/mongo/db/s/operation_sharding_state.cpp')
-rw-r--r--src/mongo/db/s/operation_sharding_state.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/s/operation_sharding_state.cpp b/src/mongo/db/s/operation_sharding_state.cpp
index a940ffc01df..0f92bbd5492 100644
--- a/src/mongo/db/s/operation_sharding_state.cpp
+++ b/src/mongo/db/s/operation_sharding_state.cpp
@@ -66,6 +66,11 @@ void OperationShardingState::initializeShardVersion(NamespaceString nss,
return;
}
+ if (nss.isSystemDotIndexes()) {
+ setShardVersion(std::move(nss), ChunkVersion::IGNORED());
+ return;
+ }
+
setShardVersion(std::move(nss), std::move(newVersion));
}
@@ -84,6 +89,7 @@ ChunkVersion OperationShardingState::getShardVersion(const NamespaceString& nss)
void OperationShardingState::setShardVersion(NamespaceString nss, ChunkVersion newVersion) {
// This currently supports only setting the shard version for one namespace.
invariant(!_hasVersion || _ns == nss);
+ invariant(!nss.isSystemDotIndexes() || ChunkVersion::isIgnoredVersion(newVersion));
_ns = std::move(nss);
_shardVersion = std::move(newVersion);