summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/collection_metadata_test.cpp
diff options
context:
space:
mode:
authorSilvia Surroca <silvia.surroca@mongodb.com>2022-12-21 13:35:54 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-12-21 14:17:29 +0000
commit82c46f01769d6cbae70a27ff948b0d93c49f7420 (patch)
treee3427633c5b0a3109bd1c12c15939857867629a2 /src/mongo/db/s/collection_metadata_test.cpp
parent94cd2287db3d22a3876677e393f02ddc3c9c8b17 (diff)
downloadmongo-82c46f01769d6cbae70a27ff948b0d93c49f7420.tar.gz
SERVER-71615 Add top-level `onCurrentShardSince` field to `config.chunk` entries
Diffstat (limited to 'src/mongo/db/s/collection_metadata_test.cpp')
-rw-r--r--src/mongo/db/s/collection_metadata_test.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mongo/db/s/collection_metadata_test.cpp b/src/mongo/db/s/collection_metadata_test.cpp
index 3c576765f4c..c1cf8022901 100644
--- a/src/mongo/db/s/collection_metadata_test.cpp
+++ b/src/mongo/db/s/collection_metadata_test.cpp
@@ -54,7 +54,7 @@ CollectionMetadata makeCollectionMetadataImpl(
const OID epoch = OID::gen();
- const Timestamp kRouting(100, 0);
+ const Timestamp kOnCurrentShardSince(100, 0);
const Timestamp kChunkManager(staleChunkManager ? 99 : 100, 0);
std::vector<ChunkType> allChunks;
@@ -65,12 +65,18 @@ CollectionMetadata makeCollectionMetadataImpl(
// Need to add a chunk to the other shard from nextMinKey to myNextChunk.first.
allChunks.emplace_back(
uuid, ChunkRange{nextMinKey, myNextChunk.first}, version, kOtherShard);
- allChunks.back().setHistory({ChunkHistory(kRouting, kOtherShard)});
+ auto& chunk = allChunks.back();
+ chunk.setOnCurrentShardSince(kOnCurrentShardSince);
+ chunk.setHistory({ChunkHistory(*chunk.getOnCurrentShardSince(), chunk.getShard())});
+
version.incMajor();
}
allChunks.emplace_back(
uuid, ChunkRange{myNextChunk.first, myNextChunk.second}, version, kThisShard);
- allChunks.back().setHistory({ChunkHistory(kRouting, kThisShard)});
+ auto& chunk = allChunks.back();
+ chunk.setOnCurrentShardSince(kOnCurrentShardSince);
+ chunk.setHistory({ChunkHistory(*chunk.getOnCurrentShardSince(), chunk.getShard())});
+
version.incMajor();
nextMinKey = myNextChunk.second;
}
@@ -78,7 +84,9 @@ CollectionMetadata makeCollectionMetadataImpl(
if (SimpleBSONObjComparator::kInstance.evaluate(nextMinKey < shardKeyPattern.globalMax())) {
allChunks.emplace_back(
uuid, ChunkRange{nextMinKey, shardKeyPattern.globalMax()}, version, kOtherShard);
- allChunks.back().setHistory({ChunkHistory(kRouting, kOtherShard)});
+ auto& chunk = allChunks.back();
+ chunk.setOnCurrentShardSince(kOnCurrentShardSince);
+ chunk.setHistory({ChunkHistory(*chunk.getOnCurrentShardSince(), chunk.getShard())});
}
return CollectionMetadata(