diff options
author | Eric Milkie <milkie@10gen.com> | 2017-09-19 11:27:59 -0400 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2017-09-25 13:17:16 -0400 |
commit | 8c118d741327e6e3fe29955f7f75f6fe853297e5 (patch) | |
tree | b215e7de950e487f67fbd8f98fe27437d90a70d3 /src/mongo/dbtests/dbtests.cpp | |
parent | 62fe0f89e9fa15c69f912d31b822b3631f691fe7 (diff) | |
download | mongo-8c118d741327e6e3fe29955f7f75f6fe853297e5.tar.gz |
SERVER-31086 adorn secondary inserts and vector inserts with timestamps
Diffstat (limited to 'src/mongo/dbtests/dbtests.cpp')
-rw-r--r-- | src/mongo/dbtests/dbtests.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp index 7ae04b93520..c4f26023093 100644 --- a/src/mongo/dbtests/dbtests.cpp +++ b/src/mongo/dbtests/dbtests.cpp @@ -51,6 +51,7 @@ #include "mongo/dbtests/framework.h" #include "mongo/scripting/engine.h" #include "mongo/stdx/memory.h" +#include "mongo/util/clock_source_mock.h" #include "mongo/util/quick_exit.h" #include "mongo/util/signal_handlers_synchronous.h" #include "mongo/util/startup_test.h" @@ -120,6 +121,9 @@ int dbtestsMain(int argc, char** argv, char** envp) { ::mongo::setupSynchronousSignalHandlers(); mongo::dbtests::initWireSpec(); mongo::runGlobalInitializersOrDie(argc, argv, envp); + serverGlobalParams.featureCompatibility.version.store( + ServerGlobalParams::FeatureCompatibility::Version::k36); + serverGlobalParams.featureCompatibility.isSchemaVersion36.store(true); repl::ReplSettings replSettings; replSettings.setOplogSizeBytes(10 * 1024 * 1024); ServiceContext* service = getGlobalServiceContext(); @@ -127,11 +131,26 @@ int dbtestsMain(int argc, char** argv, char** envp) { auto logicalClock = stdx::make_unique<LogicalClock>(service); LogicalClock::set(service, std::move(logicalClock)); + auto fastClock = stdx::make_unique<ClockSourceMock>(); + // Timestamps are split into two 32-bit integers, seconds and "increments". Currently (but + // maybe not for eternity), a Timestamp with a value of `0` seconds is always considered + // "null" by `Timestamp::isNull`, regardless of its increment value. Ticking the + // `ClockSourceMock` only bumps the "increment" counter, thus by default, generating "null" + // timestamps. Bumping by one second here avoids any accidental interpretations. + fastClock->advance(Seconds(1)); + service->setFastClockSource(std::move(fastClock)); + + auto preciseClock = stdx::make_unique<ClockSourceMock>(); + // See above. + preciseClock->advance(Seconds(1)); + service->setPreciseClockSource(std::move(preciseClock)); + repl::setGlobalReplicationCoordinator( new repl::ReplicationCoordinatorMock(service, replSettings)); repl::getGlobalReplicationCoordinator() ->setFollowerMode(repl::MemberState::RS_PRIMARY) .ignore(); + getGlobalAuthorizationManager()->setAuthEnabled(false); ScriptEngine::setup(); StartupTest::runTests(); |