From 6729afa6c6f081333973601172fafa7c71741508 Mon Sep 17 00:00:00 2001 From: Sergi Mateo Bellido Date: Tue, 15 Jun 2021 17:18:34 +0000 Subject: SERVER-57316 Changing a few functions that rely on the presence of epochs/timestamps on config.chunks --- src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp index 2617c4201a0..fff12e81622 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp @@ -1537,13 +1537,15 @@ void ShardingCatalogManager::ensureChunkVersionIsGreaterThan( // Get the chunk with the current collectionVersion for this epoch. ChunkType highestChunk; { + const auto query = coll.getTimestamp() ? BSON(ChunkType::collectionUUID() << *collUuid) + : BSON(ChunkType::epoch(version.epoch())); const auto highestChunksVector = uassertStatusOK(configShard->exhaustiveFindOnConfig( opCtx, ReadPreferenceSetting{ReadPreference::PrimaryOnly}, repl::ReadConcernLevel::kLocalReadConcern, ChunkType::ConfigNS, - BSON(ChunkType::epoch(version.epoch())) /* query */, + query, BSON(ChunkType::lastmod << -1) /* sort */, 1 /* limit */)) .docs; -- cgit v1.2.1