summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-05-30 19:12:28 -0400
committerBenety Goh <benety@mongodb.com>2018-05-30 19:12:28 -0400
commita3fb68c2b88493ee41793cde037636ce3f330058 (patch)
tree6093fca6aaa5c6259fff8266e0b0bffb00eac1b2 /src/mongo/dbtests
parentd2978d6af210356616c07193a29641a41f797d8b (diff)
downloadmongo-a3fb68c2b88493ee41793cde037636ce3f330058.tar.gz
SERVER-32335 remove multiInitialSyncApply
Replaces calls to SyncTail::multiApply with OplogApplier::multiApply
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/storage_timestamp_tests.cpp39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp
index d40972a7956..8a842c8ff2c 100644
--- a/src/mongo/dbtests/storage_timestamp_tests.cpp
+++ b/src/mongo/dbtests/storage_timestamp_tests.cpp
@@ -53,6 +53,7 @@
#include "mongo/db/repl/drop_pending_collection_reaper.h"
#include "mongo/db/repl/multiapplier.h"
#include "mongo/db/repl/oplog.h"
+#include "mongo/db/repl/oplog_applier.h"
#include "mongo/db/repl/oplog_entry.h"
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/repl_client_info.h"
@@ -108,6 +109,14 @@ BSONCollectionCatalogEntry::IndexMetaData getIndexMetaData(
return collMetaData.indexes[idxOffset];
}
+class DoNothingOplogApplierObserver : public repl::OplogApplier::Observer {
+public:
+ void onBatchBegin(const repl::OplogApplier::Operations&) final {}
+ void onBatchEnd(const StatusWith<repl::OpTime>&, const repl::OplogApplier::Operations&) final {}
+ void onMissingDocumentsFetchedAndInserted(const std::vector<FetchInfo>&) final {}
+ void onOperationConsumed(const BSONObj&) final {}
+};
+
class StorageTimestampTest {
public:
ServiceContext::UniqueOperationContext _opCtxRaii = cc().makeOperationContext();
@@ -1329,11 +1338,18 @@ public:
<< doc2));
std::vector<repl::OplogEntry> ops = {op0, op1, op2};
+ DoNothingOplogApplierObserver observer;
auto storageInterface = repl::StorageInterface::get(_opCtx);
auto writerPool = repl::SyncTail::makeWriterPool();
- repl::SyncTail syncTail(
- nullptr, _consistencyMarkers, storageInterface, repl::multiSyncApply, writerPool.get());
- ASSERT_EQUALS(op2.getOpTime(), unittest::assertGet(syncTail.multiApply(_opCtx, ops)));
+ repl::OplogApplier oplogApplier(nullptr,
+ nullptr,
+ &observer,
+ nullptr,
+ _consistencyMarkers,
+ storageInterface,
+ {},
+ writerPool.get());
+ ASSERT_EQUALS(op2.getOpTime(), unittest::assertGet(oplogApplier.multiApply(_opCtx, ops)));
AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
assertMultikeyPaths(
@@ -1434,18 +1450,21 @@ public:
// after bulk index builds.
std::vector<repl::OplogEntry> ops = {op0, createIndexOp, op1, op2};
+ DoNothingOplogApplierObserver observer;
auto storageInterface = repl::StorageInterface::get(_opCtx);
auto writerPool = repl::SyncTail::makeWriterPool();
repl::OplogApplier::Options options;
options.allowNamespaceNotFoundErrorsOnCrudOps = true;
options.missingDocumentSourceForInitialSync = HostAndPort("localhost", 123);
- repl::SyncTail syncTail(nullptr,
- _consistencyMarkers,
- storageInterface,
- repl::multiInitialSyncApply,
- writerPool.get(),
- options);
- auto lastTime = unittest::assertGet(syncTail.multiApply(_opCtx, ops));
+ repl::OplogApplier oplogApplier(nullptr,
+ nullptr,
+ &observer,
+ nullptr,
+ _consistencyMarkers,
+ storageInterface,
+ options,
+ writerPool.get());
+ auto lastTime = unittest::assertGet(oplogApplier.multiApply(_opCtx, ops));
ASSERT_EQ(lastTime.getTimestamp(), insertTime2.asTimestamp());
AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);