summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorEsha Maharishi <esha.maharishi@mongodb.com>2019-12-17 18:12:55 +0000
committerA. Jesse Jiryu Davis <jesse@mongodb.com>2020-01-27 15:37:10 -0500
commitbcd34ce10b8314a1b68e42981ef1d28b257c6e50 (patch)
tree24c64cacbeb9c522f50b606c8cb5020641dea3f7 /src/mongo/s
parent59c45a50eb528df7f750505b8033d8cddfadf683 (diff)
downloadmongo-bcd34ce10b8314a1b68e42981ef1d28b257c6e50.tar.gz
SERVER-44716 Make donor of a migration use _configsvrEnsureChunkVersionIsGreaterThan to recover outcome of decision if migration used FCV 4.4 protocol
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/request_types/commit_chunk_migration_request_type.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp b/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp
index c2cf4f275ae..c1a28450164 100644
--- a/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp
+++ b/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp
@@ -52,13 +52,28 @@ StatusWith<ChunkType> extractChunk(const BSONObj& source, StringData field) {
if (!status.isOK())
return status;
- auto rangeWith = ChunkRange::fromBSON(fieldElement.Obj());
+ const auto fieldObj = fieldElement.Obj();
+
+ auto rangeWith = ChunkRange::fromBSON(fieldObj);
if (!rangeWith.isOK())
return rangeWith.getStatus();
+ ChunkVersion version;
+ auto swVersion = ChunkVersion::parseLegacyWithField(fieldObj, ChunkType::lastmod());
+ if (swVersion == ErrorCodes::NoSuchKey) {
+ // TODO (SERVER-45194): Require a ChunkVersion to be present once v4.4 is last stable.
+ } else if (!swVersion.isOK()) {
+ return swVersion.getStatus();
+ } else {
+ version = swVersion.getValue();
+ }
+
ChunkType chunk;
chunk.setMin(rangeWith.getValue().getMin());
chunk.setMax(rangeWith.getValue().getMax());
+ if (version.isSet()) {
+ chunk.setVersion(version);
+ }
return chunk;
}