diff options
author | Judah Schvimer <judah@mongodb.com> | 2017-08-14 14:18:44 -0400 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2017-08-14 14:18:44 -0400 |
commit | 530c50d569e72170007ba0061a43758c873bab3b (patch) | |
tree | 096565144d0a1688c445624a355c916e68ea2bd9 /src/mongo/db/repl/replication_consistency_markers_impl_test.cpp | |
parent | 10bff4daf0473b8970a2b7b7e34d18804655ba34 (diff) | |
download | mongo-530c50d569e72170007ba0061a43758c873bab3b.tar.gz |
SERVER-29894 fall back on old oplog delete from point in FCV 3.4
Diffstat (limited to 'src/mongo/db/repl/replication_consistency_markers_impl_test.cpp')
-rw-r--r-- | src/mongo/db/repl/replication_consistency_markers_impl_test.cpp | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp b/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp index 8a0ba53e6ce..03885151087 100644 --- a/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp +++ b/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp @@ -300,8 +300,7 @@ TEST_F(ReplicationConsistencyMarkersTest, OplogTruncateAfterPointUpgrade) { Timestamp time2(Seconds(456), 0); OpTime minValidTime(Timestamp(789), 2); - // Insert the old oplogDeleteFromPoint and make sure that we don't read it and do not have - // trouble reading and updating the new one. + // Insert the old oplogDeleteFromPoint and make sure getOplogTruncateAfterPoint() returns it. ASSERT_OK(getStorageInterface()->createCollection(opCtx, minValidNss, {})); ASSERT_OK(getStorageInterface()->insertDocument( opCtx, @@ -310,12 +309,51 @@ TEST_F(ReplicationConsistencyMarkersTest, OplogTruncateAfterPointUpgrade) { << minValidTime.getTimestamp() << MinValidDocument::kMinValidTermFieldName << minValidTime.getTerm() - << ReplicationConsistencyMarkersImpl::kOldOplogDeleteFromPointFieldName + << MinValidDocument::kOldOplogDeleteFromPointFieldName << time1))); consistencyMarkers.initializeMinValidDocument(opCtx); + + // Set the feature compatibility version to 3.6. + serverGlobalParams.featureCompatibility.version.store( + ServerGlobalParams::FeatureCompatibility::Version::k36); + + // Check that we see no oplog truncate after point in FCV 3.6. + ASSERT(consistencyMarkers.getOplogTruncateAfterPoint(opCtx).isNull()); + ASSERT_EQ(consistencyMarkers.getMinValid(opCtx), minValidTime); + + // Set the feature compatibility version to 3.4. + serverGlobalParams.featureCompatibility.version.store( + ServerGlobalParams::FeatureCompatibility::Version::k34); + + // Check that we see the old oplog delete from point in FCV 3.4. + ASSERT_EQ(consistencyMarkers.getOplogTruncateAfterPoint(opCtx), time1); + ASSERT_EQ(consistencyMarkers.getMinValid(opCtx), minValidTime); + + // Check that the minValid document has the oplog delete from point. + auto minValidDocument = getMinValidDocument(opCtx, minValidNss); + ASSERT_TRUE(minValidDocument.hasField(MinValidDocument::kOldOplogDeleteFromPointFieldName)); + + consistencyMarkers.removeOldOplogDeleteFromPointField(opCtx); + + // Check that the minValid document does not have the oplog delete from point. + minValidDocument = getMinValidDocument(opCtx, minValidNss); + ASSERT_FALSE(minValidDocument.hasField(MinValidDocument::kOldOplogDeleteFromPointFieldName)); + + // Check that after removing the old oplog delete from point, that we do not see the oplog + // truncate after point in FCV 3.4. + ASSERT(consistencyMarkers.getOplogTruncateAfterPoint(opCtx).isNull()); + ASSERT_EQ(consistencyMarkers.getMinValid(opCtx), minValidTime); + + // Set the feature compatibility version to 3.6. + serverGlobalParams.featureCompatibility.version.store( + ServerGlobalParams::FeatureCompatibility::Version::k36); + + // Check that after removing the old oplog delete from point, that we do not see the oplog + // truncate after point in FCV 3.6. ASSERT(consistencyMarkers.getOplogTruncateAfterPoint(opCtx).isNull()); ASSERT_EQ(consistencyMarkers.getMinValid(opCtx), minValidTime); + // Check that we can set the oplog truncate after point. consistencyMarkers.setOplogTruncateAfterPoint(opCtx, time2); ASSERT_EQ(consistencyMarkers.getOplogTruncateAfterPoint(opCtx), time2); } |