diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2019-12-17 18:12:55 +0000 |
---|---|---|
committer | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2020-01-27 15:37:10 -0500 |
commit | bcd34ce10b8314a1b68e42981ef1d28b257c6e50 (patch) | |
tree | 24c64cacbeb9c522f50b606c8cb5020641dea3f7 /src/mongo/s | |
parent | 59c45a50eb528df7f750505b8033d8cddfadf683 (diff) | |
download | mongo-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.cpp | 17 |
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; } |