diff options
author | Mihai Andrei <mihai.andrei@mongodb.com> | 2019-10-02 16:57:41 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-02 16:57:41 +0000 |
commit | 22d98f57d8d1f8efe442c4c63fdd245b65c8861b (patch) | |
tree | 33cb324b03952be99c7b21b85becdbdd0de3ecfe /src/mongo/db/repl/idempotency_test_fixture.cpp | |
parent | 260d57123962476165ceb7b1b7185b63bfd9f7ca (diff) | |
download | mongo-22d98f57d8d1f8efe442c4c63fdd245b65c8861b.tar.gz |
SERVER-43651 Move fillWriterVectors, multiSyncApply, and syncApply to OplogApplierImpl
Diffstat (limited to 'src/mongo/db/repl/idempotency_test_fixture.cpp')
-rw-r--r-- | src/mongo/db/repl/idempotency_test_fixture.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/mongo/db/repl/idempotency_test_fixture.cpp b/src/mongo/db/repl/idempotency_test_fixture.cpp index adae4b62607..185e4f0dd4c 100644 --- a/src/mongo/db/repl/idempotency_test_fixture.cpp +++ b/src/mongo/db/repl/idempotency_test_fixture.cpp @@ -53,6 +53,8 @@ #include "mongo/db/repl/bgsync.h" #include "mongo/db/repl/drop_pending_collection_reaper.h" #include "mongo/db/repl/oplog.h" +#include "mongo/db/repl/oplog_applier.h" +#include "mongo/db/repl/oplog_applier_impl.h" #include "mongo/db/repl/oplog_interface_local.h" #include "mongo/db/repl/replication_consistency_markers_mock.h" #include "mongo/db/repl/replication_coordinator_mock.h" @@ -96,6 +98,20 @@ repl::OplogEntry makeOplogEntry(repl::OpTime opTime, boost::none); // post-image optime } +/** + * Test only subclass of OplogApplierImpl for using fillWriterVectors in tests. + */ +class OplogApplierImplForTest : public OplogApplierImpl { +public: + OplogApplierImplForTest(const OplogApplier::Options& options); + using OplogApplierImpl::fillWriterVectors; +}; + +// Minimal constructor that takes options, the only member accessed in fillWriterVectors. +OplogApplierImplForTest::OplogApplierImplForTest(const OplogApplier::Options& options) + : OplogApplierImpl( + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, options, nullptr) {} + } // namespace /** @@ -380,10 +396,8 @@ void IdempotencyTest::testOpsAreIdempotent(std::vector<OplogEntry> ops, Sequence {entry.toBSON(), entry.getOpTime().getTimestamp()}, entry.getOpTime().getTerm())); } - - SyncTail syncTail(nullptr, // observer - nullptr, // storage interface - repl::OplogApplier::Options(repl::OplogApplication::Mode::kInitialSync)); + OplogApplier::Options option(OplogApplication::Mode::kInitialSync); + OplogApplierImplForTest oplogApplier(option); std::vector<MultiApplier::OperationPtrs> writerVectors(1); std::vector<MultiApplier::Operations> derivedOps; @@ -394,7 +408,7 @@ void IdempotencyTest::testOpsAreIdempotent(std::vector<OplogEntry> ops, Sequence std::vector<OplogEntry> op; op.push_back(entry); singleOpVectors.emplace_back(op); - syncTail.fillWriterVectors( + oplogApplier.fillWriterVectors( _opCtx.get(), &singleOpVectors.back(), &writerVectors, &derivedOps); } |