diff options
Diffstat (limited to 'src/mongo/db/s/split_chunk.cpp')
| -rw-r--r-- | src/mongo/db/s/split_chunk.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mongo/db/s/split_chunk.cpp b/src/mongo/db/s/split_chunk.cpp index d3c0a6908db..f82f8f56bf2 100644 --- a/src/mongo/db/s/split_chunk.cpp +++ b/src/mongo/db/s/split_chunk.cpp @@ -96,17 +96,16 @@ bool checkIfSingleDoc(OperationContext* opCtx, */ bool checkMetadataForSuccessfulSplitChunk(OperationContext* opCtx, const NamespaceString& nss, - const OID& epoch, const ChunkRange& chunkRange, const std::vector<BSONObj>& splitKeys) { const auto metadataAfterSplit = [&] { AutoGetCollection autoColl(opCtx, nss, MODE_IS); - return CollectionShardingState::get(opCtx, nss)->getCurrentMetadata(); + return CollectionShardingState::get(opCtx, nss)->getMetadata(opCtx); }(); uassert(ErrorCodes::StaleEpoch, - str::stream() << "Collection " << nss.ns() << " changed since split start", - metadataAfterSplit->getCollVersion().epoch() == epoch); + str::stream() << "Collection " << nss.ns() << " became unsharded", + metadataAfterSplit->isSharded()); auto newChunkBounds(splitKeys); auto startKey = chunkRange.getMin(); @@ -209,8 +208,7 @@ StatusWith<boost::optional<ChunkRange>> splitChunk(OperationContext* opCtx, if (!commandStatus.isOK() || !writeConcernStatus.isOK()) { forceShardFilteringMetadataRefresh(opCtx, nss); - if (checkMetadataForSuccessfulSplitChunk( - opCtx, nss, expectedCollectionEpoch, chunkRange, splitKeys)) { + if (checkMetadataForSuccessfulSplitChunk(opCtx, nss, chunkRange, splitKeys)) { // Split was committed. } else if (!commandStatus.isOK()) { return commandStatus; |
