summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/shard_metadata_util_test.cpp
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2017-06-14 17:22:24 -0400
committerDianna Hohensee <dianna.hohensee@10gen.com>2017-06-20 15:23:36 -0400
commit125497e1ba8b4cd10ae5fa84fc66e70cfe46ccce (patch)
treed6d0d965f3e5e3e6bdc4800e640fcc6ee7668b72 /src/mongo/db/s/shard_metadata_util_test.cpp
parent38218c1a0c2a15a05557df36794fe53618ca0db5 (diff)
downloadmongo-125497e1ba8b4cd10ae5fa84fc66e70cfe46ccce.tar.gz
SERVER-29437 update shard config.collections schema to use lastRefreshedChunkVersion instead of refreshSequenceNumber
Diffstat (limited to 'src/mongo/db/s/shard_metadata_util_test.cpp')
-rw-r--r--src/mongo/db/s/shard_metadata_util_test.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/mongo/db/s/shard_metadata_util_test.cpp b/src/mongo/db/s/shard_metadata_util_test.cpp
index cae6de39283..2d766dd5422 100644
--- a/src/mongo/db/s/shard_metadata_util_test.cpp
+++ b/src/mongo/db/s/shard_metadata_util_test.cpp
@@ -75,7 +75,6 @@ protected:
ASSERT_OK(updateShardCollectionsEntry(operationContext(),
BSON(ShardCollectionType::uuid(kNss.ns())),
shardCollectionType.toBSON(),
- BSONObj(),
true /*upsert*/));
return shardCollectionType;
}
@@ -188,9 +187,6 @@ TEST_F(ShardMetadataUtilTest, UpdateAndReadCollectionsEntry) {
ShardCollectionType readShardCollectionType =
assertGet(readShardCollectionsEntry(operationContext(), kNss));
- // updateShardCollectionsEntry initializes 'refreshSequenceNumber' that isn't present in
- // 'insertedShardCollectionType', so must compare fields.
-
ASSERT_EQUALS(updateShardCollectionType.getUUID(), readShardCollectionType.getUUID());
ASSERT_EQUALS(updateShardCollectionType.getNss(), readShardCollectionType.getNss());
ASSERT_EQUALS(updateShardCollectionType.getEpoch(), readShardCollectionType.getEpoch());
@@ -201,8 +197,10 @@ TEST_F(ShardMetadataUtilTest, UpdateAndReadCollectionsEntry) {
ASSERT_EQUALS(updateShardCollectionType.getUnique(), readShardCollectionType.getUnique());
ASSERT_EQUALS(updateShardCollectionType.hasRefreshing(),
readShardCollectionType.hasRefreshing());
- ASSERT(!updateShardCollectionType.hasRefreshSequenceNumber());
- ASSERT(!readShardCollectionType.hasRefreshSequenceNumber());
+
+ // Refresh fields should not have been set.
+ ASSERT(!updateShardCollectionType.hasLastRefreshedCollectionVersion());
+ ASSERT(!readShardCollectionType.hasLastRefreshedCollectionVersion());
}
TEST_F(ShardMetadataUtilTest, PersistedRefreshSignalStartAndFinish) {
@@ -221,7 +219,7 @@ TEST_F(ShardMetadataUtilTest, PersistedRefreshSignalStartAndFinish) {
ASSERT_BSONOBJ_EQ(shardCollectionsEntry.getDefaultCollation(), getDefaultCollation());
ASSERT_EQUALS(shardCollectionsEntry.getUnique(), kUnique);
ASSERT_EQUALS(shardCollectionsEntry.getRefreshing(), true);
- ASSERT(!shardCollectionsEntry.hasRefreshSequenceNumber());
+ ASSERT(!shardCollectionsEntry.hasLastRefreshedCollectionVersion());
// Signal refresh start again to make sure nothing changes
ASSERT_OK(setPersistedRefreshFlags(operationContext(), kNss));
@@ -230,16 +228,17 @@ TEST_F(ShardMetadataUtilTest, PersistedRefreshSignalStartAndFinish) {
ASSERT_EQUALS(state.epoch, getCollectionVersion().epoch());
ASSERT_EQUALS(state.refreshing, true);
- ASSERT_EQUALS(state.sequenceNumber, 0LL);
+ ASSERT_EQUALS(state.lastRefreshedCollectionVersion,
+ ChunkVersion(0, 0, getCollectionVersion().epoch()));
// Signal refresh finish
- ASSERT_OK(unsetPersistedRefreshFlags(operationContext(), kNss));
+ ASSERT_OK(unsetPersistedRefreshFlags(operationContext(), kNss, getCollectionVersion()));
state = assertGet(getPersistedRefreshFlags(operationContext(), kNss));
ASSERT_EQUALS(state.epoch, getCollectionVersion().epoch());
ASSERT_EQUALS(state.refreshing, false);
- ASSERT_EQUALS(state.sequenceNumber, 1LL);
+ ASSERT_EQUALS(state.lastRefreshedCollectionVersion, getCollectionVersion());
}
TEST_F(ShardMetadataUtilTest, WriteAndReadChunks) {