summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-10-25 11:35:26 -0400
committerJudah Schvimer <judah@mongodb.com>2017-10-25 11:35:26 -0400
commitde2a67178e3365b829d57afde92cb6123dd24357 (patch)
tree33d8697c1322e689c82ab98855bcd8c6cab5c0af /src/mongo/db
parenteadebad07fc0e7aa02d0b407f60af9bcf19fde16 (diff)
downloadmongo-de2a67178e3365b829d57afde92cb6123dd24357.tar.gz
Revert "SERVER-31678 Thread through the operation wall-clock time for oplog entries"
This reverts commit 080514c9ee36564d8342cd832f3c5f3a199a9845.
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/commands/dbcheck.cpp16
-rw-r--r--src/mongo/db/op_observer_impl.cpp140
-rw-r--r--src/mongo/db/repl/oplog.cpp9
-rw-r--r--src/mongo/db/repl/oplog.h7
-rw-r--r--src/mongo/db/repl/oplog_test.cpp16
-rw-r--r--src/mongo/db/s/session_catalog_migration_destination.cpp5
-rw-r--r--src/mongo/db/s/session_catalog_migration_destination_test.cpp56
-rw-r--r--src/mongo/db/session_test.cpp13
8 files changed, 32 insertions, 230 deletions
diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp
index fe7bcd178c6..3650b93af48 100644
--- a/src/mongo/db/commands/dbcheck.cpp
+++ b/src/mongo/db/commands/dbcheck.cpp
@@ -461,21 +461,9 @@ private:
const BSONObj& obj) {
return writeConflictRetry(
opCtx, "dbCheck oplog entry", NamespaceString::kRsOplogNamespace.ns(), [&] {
- auto const clockSource = opCtx->getServiceContext()->getFastClockSource();
- const auto wallClockTime = clockSource->now();
-
WriteUnitOfWork uow(opCtx);
- repl::OpTime result = repl::logOp(opCtx,
- "c",
- nss,
- uuid,
- obj,
- nullptr,
- false,
- wallClockTime,
- {},
- kUninitializedStmtId,
- {});
+ repl::OpTime result = repl::logOp(
+ opCtx, "c", nss, uuid, obj, nullptr, false, {}, kUninitializedStmtId, {});
uow.commit();
return result;
});
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp
index 5621f9da8a2..0f3c08b0e07 100644
--- a/src/mongo/db/op_observer_impl.cpp
+++ b/src/mongo/db/op_observer_impl.cpp
@@ -117,15 +117,9 @@ BSONObj makeCollModCmdObj(const BSONObj& collModCmd,
return cmdObjBuilder.obj();
}
-Date_t getWallClockTimeForOpLog(OperationContext* opCtx) {
- auto const clockSource = opCtx->getServiceContext()->getFastClockSource();
- return clockSource->now();
-}
-
struct OpTimeBundle {
repl::OpTime writeOpTime;
repl::OpTime prePostImageOpTime;
- Date_t wallClockTime;
};
/**
@@ -152,7 +146,6 @@ OpTimeBundle replLogUpdate(OperationContext* opCtx,
}
OpTimeBundle opTimes;
- opTimes.wallClockTime = getWallClockTimeForOpLog(opCtx);
if (!storeObj.isEmpty() && opCtx->getTxnNumber()) {
auto noteUpdateOpTime = repl::logOp(opCtx,
@@ -162,7 +155,6 @@ OpTimeBundle replLogUpdate(OperationContext* opCtx,
storeObj,
nullptr,
false,
- opTimes.wallClockTime,
sessionInfo,
args.stmtId,
{});
@@ -183,7 +175,6 @@ OpTimeBundle replLogUpdate(OperationContext* opCtx,
args.update,
&args.criteria,
args.fromMigrate,
- opTimes.wallClockTime,
sessionInfo,
args.stmtId,
oplogLink);
@@ -212,20 +203,10 @@ OpTimeBundle replLogDelete(OperationContext* opCtx,
}
OpTimeBundle opTimes;
- opTimes.wallClockTime = getWallClockTimeForOpLog(opCtx);
if (deletedDoc && opCtx->getTxnNumber()) {
- auto noteOplog = repl::logOp(opCtx,
- "n",
- nss,
- uuid,
- deletedDoc.get(),
- nullptr,
- false,
- opTimes.wallClockTime,
- sessionInfo,
- stmtId,
- {});
+ auto noteOplog = repl::logOp(
+ opCtx, "n", nss, uuid, deletedDoc.get(), nullptr, false, sessionInfo, stmtId, {});
opTimes.prePostImageOpTime = noteOplog;
oplogLink.preImageOpTime = noteOplog;
}
@@ -237,7 +218,6 @@ OpTimeBundle replLogDelete(OperationContext* opCtx,
deleteState.documentKey,
nullptr,
fromMigrate,
- opTimes.wallClockTime,
sessionInfo,
stmtId,
oplogLink);
@@ -269,7 +249,6 @@ void OpObserverImpl::onCreateIndex(OperationContext* opCtx,
builder.done(),
nullptr,
fromMigrate,
- getWallClockTimeForOpLog(opCtx),
{},
kUninitializedStmtId,
{});
@@ -281,7 +260,6 @@ void OpObserverImpl::onCreateIndex(OperationContext* opCtx,
indexDoc,
nullptr,
fromMigrate,
- getWallClockTimeForOpLog(opCtx),
{},
kUninitializedStmtId,
{});
@@ -304,8 +282,7 @@ void OpObserverImpl::onInserts(OperationContext* opCtx,
bool fromMigrate) {
Session* const session = opCtx->getTxnNumber() ? OperationContextSession::get(opCtx) : nullptr;
- const auto opTimeList = repl::logInsertOps(
- opCtx, nss, uuid, session, begin, end, fromMigrate, getWallClockTimeForOpLog(opCtx));
+ const auto opTimeList = repl::logInsertOps(opCtx, nss, uuid, session, begin, end, fromMigrate);
auto css = CollectionShardingState::get(opCtx, nss.ns());
@@ -443,17 +420,7 @@ void OpObserverImpl::onInternalOpMessage(OperationContext* opCtx,
const BSONObj& msgObj,
const boost::optional<BSONObj> o2MsgObj) {
const BSONObj* o2MsgPtr = o2MsgObj ? o2MsgObj.get_ptr() : nullptr;
- repl::logOp(opCtx,
- "n",
- nss,
- uuid,
- msgObj,
- o2MsgPtr,
- false,
- getWallClockTimeForOpLog(opCtx),
- {},
- kUninitializedStmtId,
- {});
+ repl::logOp(opCtx, "n", nss, uuid, msgObj, o2MsgPtr, false, {}, kUninitializedStmtId, {});
}
void OpObserverImpl::onCreateCollection(OperationContext* opCtx,
@@ -486,17 +453,8 @@ void OpObserverImpl::onCreateCollection(OperationContext* opCtx,
if (!collectionName.isSystemDotProfile()) {
// do not replicate system.profile modifications
- repl::logOp(opCtx,
- "c",
- cmdNss,
- options.uuid,
- cmdObj,
- nullptr,
- false,
- getWallClockTimeForOpLog(opCtx),
- {},
- kUninitializedStmtId,
- {});
+ repl::logOp(
+ opCtx, "c", cmdNss, options.uuid, cmdObj, nullptr, false, {}, kUninitializedStmtId, {});
}
AuthorizationManager::get(opCtx->getServiceContext())
@@ -534,17 +492,7 @@ void OpObserverImpl::onCollMod(OperationContext* opCtx,
if (!nss.isSystemDotProfile()) {
// do not replicate system.profile modifications
- repl::logOp(opCtx,
- "c",
- cmdNss,
- uuid,
- cmdObj,
- &o2Obj,
- false,
- getWallClockTimeForOpLog(opCtx),
- {},
- kUninitializedStmtId,
- {});
+ repl::logOp(opCtx, "c", cmdNss, uuid, cmdObj, &o2Obj, false, {}, kUninitializedStmtId, {});
}
AuthorizationManager::get(opCtx->getServiceContext())
@@ -574,17 +522,7 @@ void OpObserverImpl::onDropDatabase(OperationContext* opCtx, const std::string&
const NamespaceString cmdNss{dbName, "$cmd"};
const auto cmdObj = BSON("dropDatabase" << 1);
- repl::logOp(opCtx,
- "c",
- cmdNss,
- {},
- cmdObj,
- nullptr,
- false,
- getWallClockTimeForOpLog(opCtx),
- {},
- kUninitializedStmtId,
- {});
+ repl::logOp(opCtx, "c", cmdNss, {}, cmdObj, nullptr, false, {}, kUninitializedStmtId, {});
if (dbName == FeatureCompatibilityVersion::kDatabase) {
FeatureCompatibilityVersion::onDropCollection(opCtx);
@@ -607,17 +545,8 @@ repl::OpTime OpObserverImpl::onDropCollection(OperationContext* opCtx,
repl::OpTime dropOpTime;
if (!collectionName.isSystemDotProfile()) {
// Do not replicate system.profile modifications
- dropOpTime = repl::logOp(opCtx,
- "c",
- cmdNss,
- uuid,
- cmdObj,
- nullptr,
- false,
- getWallClockTimeForOpLog(opCtx),
- {},
- kUninitializedStmtId,
- {});
+ dropOpTime = repl::logOp(
+ opCtx, "c", cmdNss, uuid, cmdObj, nullptr, false, {}, kUninitializedStmtId, {});
}
if (collectionName.coll() == DurableViewCatalog::viewsCollectionName()) {
@@ -654,17 +583,7 @@ void OpObserverImpl::onDropIndex(OperationContext* opCtx,
const auto cmdNss = nss.getCommandNS();
const auto cmdObj = BSON("dropIndexes" << nss.coll() << "index" << indexName);
- repl::logOp(opCtx,
- "c",
- cmdNss,
- uuid,
- cmdObj,
- &indexInfo,
- false,
- getWallClockTimeForOpLog(opCtx),
- {},
- kUninitializedStmtId,
- {});
+ repl::logOp(opCtx, "c", cmdNss, uuid, cmdObj, &indexInfo, false, {}, kUninitializedStmtId, {});
AuthorizationManager::get(opCtx->getServiceContext())
->logOp(opCtx, "c", cmdNss, cmdObj, &indexInfo);
@@ -691,17 +610,8 @@ repl::OpTime OpObserverImpl::onRenameCollection(OperationContext* opCtx,
const auto cmdObj = builder.done();
- const auto renameOpTime = repl::logOp(opCtx,
- "c",
- cmdNss,
- uuid,
- cmdObj,
- nullptr,
- false,
- getWallClockTimeForOpLog(opCtx),
- {},
- kUninitializedStmtId,
- {});
+ const auto renameOpTime =
+ repl::logOp(opCtx, "c", cmdNss, uuid, cmdObj, nullptr, false, {}, kUninitializedStmtId, {});
if (fromCollection.isSystemDotViews())
DurableViewCatalog::onExternalChange(opCtx, fromCollection);
@@ -737,17 +647,7 @@ void OpObserverImpl::onApplyOps(OperationContext* opCtx,
const std::string& dbName,
const BSONObj& applyOpCmd) {
const NamespaceString cmdNss{dbName, "$cmd"};
- repl::logOp(opCtx,
- "c",
- cmdNss,
- {},
- applyOpCmd,
- nullptr,
- false,
- getWallClockTimeForOpLog(opCtx),
- {},
- kUninitializedStmtId,
- {});
+ repl::logOp(opCtx, "c", cmdNss, {}, applyOpCmd, nullptr, false, {}, kUninitializedStmtId, {});
AuthorizationManager::get(opCtx->getServiceContext())
->logOp(opCtx, "c", cmdNss, applyOpCmd, nullptr);
@@ -761,17 +661,7 @@ void OpObserverImpl::onEmptyCapped(OperationContext* opCtx,
if (!collectionName.isSystemDotProfile()) {
// Do not replicate system.profile modifications
- repl::logOp(opCtx,
- "c",
- cmdNss,
- uuid,
- cmdObj,
- nullptr,
- false,
- getWallClockTimeForOpLog(opCtx),
- {},
- kUninitializedStmtId,
- {});
+ repl::logOp(opCtx, "c", cmdNss, uuid, cmdObj, nullptr, false, {}, kUninitializedStmtId, {});
}
AuthorizationManager::get(opCtx->getServiceContext())
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 8fd70dff826..b7503de1082 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -408,7 +408,6 @@ OpTime logOp(OperationContext* opCtx,
const BSONObj& obj,
const BSONObj* o2,
bool fromMigrate,
- Date_t wallClockTime,
const OperationSessionInfo& sessionInfo,
StmtId statementId,
const OplogLink& oplogLink) {
@@ -435,7 +434,7 @@ OpTime logOp(OperationContext* opCtx,
fromMigrate,
slot.opTime,
slot.hash,
- wallClockTime,
+ Date_t::now(),
sessionInfo,
statementId,
oplogLink);
@@ -452,8 +451,7 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx,
Session* session,
std::vector<InsertStatement>::const_iterator begin,
std::vector<InsertStatement>::const_iterator end,
- bool fromMigrate,
- Date_t wallClockTime) {
+ bool fromMigrate) {
invariant(begin != end);
auto replCoord = ReplicationCoordinator::get(opCtx);
@@ -470,6 +468,7 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx,
Lock::CollectionLock lock(opCtx->lockState(), _oplogCollectionName, MODE_IX);
WriteUnitOfWork wuow(opCtx);
+ auto wallTime = Date_t::now();
OperationSessionInfo sessionInfo;
OplogLink oplogLink;
@@ -498,7 +497,7 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx,
fromMigrate,
insertStatementOplogSlot.opTime,
insertStatementOplogSlot.hash,
- wallClockTime,
+ wallTime,
sessionInfo,
begin[i].stmtId,
oplogLink));
diff --git a/src/mongo/db/repl/oplog.h b/src/mongo/db/repl/oplog.h
index df2178a66aa..78f1c4f8103 100644
--- a/src/mongo/db/repl/oplog.h
+++ b/src/mongo/db/repl/oplog.h
@@ -110,8 +110,7 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx,
Session* session,
std::vector<InsertStatement>::const_iterator begin,
std::vector<InsertStatement>::const_iterator end,
- bool fromMigrate,
- Date_t wallClockTime);
+ bool fromMigrate);
/**
* @param opstr
@@ -125,9 +124,6 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx,
* For 'u' records, 'obj' captures the mutation made to the object but not
* the object itself. 'o2' captures the the criteria for the object that will be modified.
*
- * wallClockTime this specifies the wall-clock timestamp of then this oplog entry was generated. It
- * is purely informational, may not be monotonically increasing and is not interpreted in any way
- * by the replication subsystem.
* oplogLink this contains the timestamp that points to the previous write that will be
* linked via prevTs, and the timestamps of the oplog entry that contains the document
* before/after update was applied. The timestamps are ignored if isNull() is true.
@@ -142,7 +138,6 @@ OpTime logOp(OperationContext* opCtx,
const BSONObj& obj,
const BSONObj* o2,
bool fromMigrate,
- Date_t wallClockTime,
const OperationSessionInfo& sessionInfo,
StmtId stmtId,
const OplogLink& oplogLink);
diff --git a/src/mongo/db/repl/oplog_test.cpp b/src/mongo/db/repl/oplog_test.cpp
index 7666e026955..cad60def20f 100644
--- a/src/mongo/db/repl/oplog_test.cpp
+++ b/src/mongo/db/repl/oplog_test.cpp
@@ -100,17 +100,8 @@ TEST_F(OplogTest, LogOpReturnsOpTimeOnSuccessfulInsertIntoOplogCollection) {
{
AutoGetDb autoDb(opCtx.get(), nss.db(), MODE_X);
WriteUnitOfWork wunit(opCtx.get());
- opTime = logOp(opCtx.get(),
- "n",
- nss,
- {},
- msgObj,
- nullptr,
- false,
- Date_t::now(),
- {},
- kUninitializedStmtId,
- {});
+ opTime =
+ logOp(opCtx.get(), "n", nss, {}, msgObj, nullptr, false, {}, kUninitializedStmtId, {});
ASSERT_FALSE(opTime.isNull());
wunit.commit();
}
@@ -222,8 +213,7 @@ OpTime _logOpNoopWithMsg(OperationContext* opCtx,
// logOp() must be called while holding lock because ephemeralForTest storage engine does not
// support concurrent updates to its internal state.
const auto msgObj = BSON("msg" << nss.ns());
- auto opTime = logOp(
- opCtx, "n", nss, {}, msgObj, nullptr, false, Date_t::now(), {}, kUninitializedStmtId, {});
+ auto opTime = logOp(opCtx, "n", nss, {}, msgObj, nullptr, false, {}, kUninitializedStmtId, {});
ASSERT_FALSE(opTime.isNull());
ASSERT(opTimeNssMap->find(opTime) == opTimeNssMap->end())
diff --git a/src/mongo/db/s/session_catalog_migration_destination.cpp b/src/mongo/db/s/session_catalog_migration_destination.cpp
index 461d53e40b2..cdf0f0a778d 100644
--- a/src/mongo/db/s/session_catalog_migration_destination.cpp
+++ b/src/mongo/db/s/session_catalog_migration_destination.cpp
@@ -242,10 +242,6 @@ ProcessOplogResult processSessionOplog(OperationContext* opCtx,
result.txnNum = sessionInfo.getTxnNumber().value();
const auto stmtId = *oplogEntry.getStatementId();
- // Session oplog entries must always contain wall clock time, because we will not be
- // transferring anything from a previous version of the server
- invariant(oplogEntry.getWallClockTime());
-
auto scopedSession = SessionCatalog::get(opCtx)->getOrCreateSession(opCtx, result.sessionId);
scopedSession->beginTxn(opCtx, result.txnNum);
@@ -289,7 +285,6 @@ ProcessOplogResult processSessionOplog(OperationContext* opCtx,
object,
&object2,
true,
- *oplogEntry.getWallClockTime(),
sessionInfo,
stmtId,
oplogLink);
diff --git a/src/mongo/db/s/session_catalog_migration_destination_test.cpp b/src/mongo/db/s/session_catalog_migration_destination_test.cpp
index 99ee8eae5d8..45ef7d0350c 100644
--- a/src/mongo/db/s/session_catalog_migration_destination_test.cpp
+++ b/src/mongo/db/s/session_catalog_migration_destination_test.cpp
@@ -298,17 +298,14 @@ TEST_F(SessionCatalogMigrationDestinationTest, OplogEntriesWithSameTxn) {
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(sessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry oplog2(OpTime(Timestamp(80, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 80));
oplog2.setOperationSessionInfo(sessionInfo);
oplog2.setStatementId(45);
- oplog2.setWallClockTime(Date_t::now());
OplogEntry oplog3(OpTime(Timestamp(60, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 60));
oplog3.setOperationSessionInfo(sessionInfo);
oplog3.setStatementId(5);
- oplog3.setWallClockTime(Date_t::now());
returnOplog({oplog1, oplog2, oplog3});
@@ -350,19 +347,16 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldOnlyStoreHistoryOfLatestTxn
sessionInfo.setTxnNumber(txnNum++);
oplog1.setOperationSessionInfo(sessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry oplog2(OpTime(Timestamp(80, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 80));
sessionInfo.setTxnNumber(txnNum++);
oplog2.setOperationSessionInfo(sessionInfo);
oplog2.setStatementId(45);
- oplog2.setWallClockTime(Date_t::now());
OplogEntry oplog3(OpTime(Timestamp(60, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 60));
sessionInfo.setTxnNumber(txnNum);
oplog3.setOperationSessionInfo(sessionInfo);
oplog3.setStatementId(5);
- oplog3.setWallClockTime(Date_t::now());
returnOplog({oplog1, oplog2, oplog3});
@@ -394,19 +388,17 @@ TEST_F(SessionCatalogMigrationDestinationTest, OplogEntriesWithSameTxnInSeparate
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(sessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry oplog2(OpTime(Timestamp(80, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 80));
oplog2.setOperationSessionInfo(sessionInfo);
oplog2.setStatementId(45);
- oplog2.setWallClockTime(Date_t::now());
OplogEntry oplog3(OpTime(Timestamp(60, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 60));
oplog3.setOperationSessionInfo(sessionInfo);
oplog3.setStatementId(5);
- oplog3.setWallClockTime(Date_t::now());
// Return in 2 batches
+
returnOplog({oplog1, oplog2});
returnOplog({oplog3});
@@ -452,17 +444,14 @@ TEST_F(SessionCatalogMigrationDestinationTest, OplogEntriesWithDifferentSession)
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(sessionInfo1);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry oplog2(OpTime(Timestamp(80, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 80));
oplog2.setOperationSessionInfo(sessionInfo2);
oplog2.setStatementId(45);
- oplog2.setWallClockTime(Date_t::now());
OplogEntry oplog3(OpTime(Timestamp(60, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 60));
oplog3.setOperationSessionInfo(sessionInfo2);
oplog3.setStatementId(5);
- oplog3.setWallClockTime(Date_t::now());
returnOplog({oplog1, oplog2, oplog3});
@@ -529,7 +518,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldNotNestAlreadyNestedOplog)
origInnerOplog1.toBSON());
oplog1.setOperationSessionInfo(sessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry oplog2(OpTime(Timestamp(1080, 2), 1),
0,
@@ -540,7 +528,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldNotNestAlreadyNestedOplog)
origInnerOplog2.toBSON());
oplog2.setOperationSessionInfo(sessionInfo);
oplog2.setStatementId(45);
- oplog2.setWallClockTime(Date_t::now());
returnOplog({oplog1, oplog2});
@@ -578,7 +565,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldBeAbleToHandlePreImageFindA
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kNoop, kNs, 0, BSON("x" << 100));
preImageOplog.setOperationSessionInfo(sessionInfo);
preImageOplog.setStatementId(45);
- preImageOplog.setWallClockTime(Date_t::now());
OplogEntry updateOplog(OpTime(Timestamp(80, 2), 1),
0,
@@ -589,7 +575,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldBeAbleToHandlePreImageFindA
BSON("$set" << BSON("x" << 101)));
updateOplog.setOperationSessionInfo(sessionInfo);
updateOplog.setStatementId(45);
- updateOplog.setWallClockTime(Date_t::now());
updateOplog.setPreImageOpTime(repl::OpTime(Timestamp(100, 2), 1));
returnOplog({preImageOplog, updateOplog});
@@ -667,7 +652,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldBeAbleToHandlePostImageFind
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kNoop, kNs, 0, BSON("x" << 100));
postImageOplog.setOperationSessionInfo(sessionInfo);
postImageOplog.setStatementId(45);
- postImageOplog.setWallClockTime(Date_t::now());
OplogEntry updateOplog(OpTime(Timestamp(80, 2), 1),
0,
@@ -678,7 +662,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldBeAbleToHandlePostImageFind
BSON("$set" << BSON("x" << 101)));
updateOplog.setOperationSessionInfo(sessionInfo);
updateOplog.setStatementId(45);
- updateOplog.setWallClockTime(Date_t::now());
updateOplog.setPostImageOpTime(repl::OpTime(Timestamp(100, 2), 1));
returnOplog({postImageOplog, updateOplog});
@@ -756,7 +739,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldBeAbleToHandleFindAndModify
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kNoop, kNs, 0, BSON("x" << 100));
preImageOplog.setOperationSessionInfo(sessionInfo);
preImageOplog.setStatementId(45);
- preImageOplog.setWallClockTime(Date_t::now());
OplogEntry updateOplog(OpTime(Timestamp(80, 2), 1),
0,
@@ -767,7 +749,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldBeAbleToHandleFindAndModify
BSON("$set" << BSON("x" << 101)));
updateOplog.setOperationSessionInfo(sessionInfo);
updateOplog.setStatementId(45);
- updateOplog.setWallClockTime(Date_t::now());
updateOplog.setPreImageOpTime(repl::OpTime(Timestamp(100, 2), 1));
returnOplog({preImageOplog});
@@ -860,12 +841,10 @@ TEST_F(SessionCatalogMigrationDestinationTest, OlderTxnShouldBeIgnored) {
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(oldSessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry oplog2(OpTime(Timestamp(80, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 80));
oplog2.setOperationSessionInfo(oldSessionInfo);
oplog2.setStatementId(45);
- oplog2.setWallClockTime(Date_t::now());
returnOplog({oplog1, oplog2});
@@ -904,7 +883,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, NewerTxnWriteShouldNotBeOverwritt
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(oldSessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
returnOplog({oplog1});
@@ -924,7 +902,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, NewerTxnWriteShouldNotBeOverwritt
OplogEntry oplog2(OpTime(Timestamp(80, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 80));
oplog2.setOperationSessionInfo(oldSessionInfo);
oplog2.setStatementId(45);
- oplog2.setWallClockTime(Date_t::now());
returnOplog({oplog2});
@@ -1005,7 +982,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldJoinProperlyForResponseWith
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog.setOperationSessionInfo(sessionInfo);
oplog.setStatementId(23);
- oplog.setWallClockTime(Date_t::now());
returnOplog({oplog});
@@ -1028,7 +1004,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldJoinProperlyForResponseWith
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog.setOperationSessionInfo(sessionInfo);
oplog.setStatementId(23);
- oplog.setWallClockTime(Date_t::now());
returnOplog({oplog});
@@ -1052,7 +1027,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldJoinProperlyForResponseWith
OplogEntry oplog(
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog.setOperationSessionInfo(sessionInfo);
- oplog.setWallClockTime(Date_t::now());
returnOplog({oplog});
@@ -1079,7 +1053,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(sessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
returnOplog({oplog1});
@@ -1095,7 +1068,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
OplogEntry oplog2(OpTime(Timestamp(80, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 80));
oplog2.setOperationSessionInfo(sessionInfo);
oplog2.setStatementId(45);
- oplog2.setWallClockTime(Date_t::now());
returnOplog({oplog2});
@@ -1136,19 +1108,17 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldErrorForConsecutivePreImage
sessionInfo.setSessionId(sessionId);
sessionInfo.setTxnNumber(2);
- OplogEntry preImageOplog1(
+ OplogEntry preImageOplog(
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kNoop, kNs, 0, BSON("x" << 100));
- preImageOplog1.setOperationSessionInfo(sessionInfo);
- preImageOplog1.setStatementId(45);
- preImageOplog1.setWallClockTime(Date_t::now());
+ preImageOplog.setOperationSessionInfo(sessionInfo);
+ preImageOplog.setStatementId(45);
OplogEntry preImageOplog2(
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kNoop, kNs, 0, BSON("x" << 100));
preImageOplog2.setOperationSessionInfo(sessionInfo);
preImageOplog2.setStatementId(45);
- preImageOplog2.setWallClockTime(Date_t::now());
- returnOplog({preImageOplog1, preImageOplog2});
+ returnOplog({preImageOplog, preImageOplog2});
sessionMigration.join();
@@ -1175,7 +1145,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kNoop, kNs, 0, BSON("x" << 100));
preImageOplog.setOperationSessionInfo(sessionInfo);
preImageOplog.setStatementId(45);
- preImageOplog.setWallClockTime(Date_t::now());
OplogEntry updateOplog(OpTime(Timestamp(80, 2), 1),
0,
@@ -1187,7 +1156,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
sessionInfo.setSessionId(makeLogicalSessionIdForTest());
updateOplog.setOperationSessionInfo(sessionInfo);
updateOplog.setStatementId(45);
- updateOplog.setWallClockTime(Date_t::now());
updateOplog.setPreImageOpTime(repl::OpTime(Timestamp(100, 2), 1));
returnOplog({preImageOplog, updateOplog});
@@ -1217,7 +1185,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldErrorForPreImageOplogWithNo
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kNoop, kNs, 0, BSON("x" << 100));
preImageOplog.setOperationSessionInfo(sessionInfo);
preImageOplog.setStatementId(45);
- preImageOplog.setWallClockTime(Date_t::now());
OplogEntry updateOplog(OpTime(Timestamp(80, 2), 1),
0,
@@ -1229,7 +1196,6 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldErrorForPreImageOplogWithNo
sessionInfo.setTxnNumber(56);
updateOplog.setOperationSessionInfo(sessionInfo);
updateOplog.setStatementId(45);
- updateOplog.setWallClockTime(Date_t::now());
updateOplog.setPreImageOpTime(repl::OpTime(Timestamp(100, 2), 1));
returnOplog({preImageOplog, updateOplog});
@@ -1260,7 +1226,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kNoop, kNs, 0, BSON("x" << 100));
preImageOplog.setOperationSessionInfo(sessionInfo);
preImageOplog.setStatementId(45);
- preImageOplog.setWallClockTime(Date_t::now());
OplogEntry updateOplog(OpTime(Timestamp(80, 2), 1),
0,
@@ -1271,7 +1236,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
BSON("$set" << BSON("x" << 101)));
updateOplog.setOperationSessionInfo(sessionInfo);
updateOplog.setStatementId(45);
- updateOplog.setWallClockTime(Date_t::now());
returnOplog({preImageOplog, updateOplog});
@@ -1301,7 +1265,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(sessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry updateOplog(OpTime(Timestamp(80, 2), 1),
0,
@@ -1312,7 +1275,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
BSON("$set" << BSON("x" << 101)));
updateOplog.setOperationSessionInfo(sessionInfo);
updateOplog.setStatementId(45);
- updateOplog.setWallClockTime(Date_t::now());
updateOplog.setPreImageOpTime(repl::OpTime(Timestamp(100, 2), 1));
returnOplog({oplog1, updateOplog});
@@ -1343,7 +1305,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(sessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry updateOplog(OpTime(Timestamp(80, 2), 1),
0,
@@ -1354,7 +1315,6 @@ TEST_F(SessionCatalogMigrationDestinationTest,
BSON("$set" << BSON("x" << 101)));
updateOplog.setOperationSessionInfo(sessionInfo);
updateOplog.setStatementId(45);
- updateOplog.setWallClockTime(Date_t::now());
updateOplog.setPostImageOpTime(repl::OpTime(Timestamp(100, 2), 1));
returnOplog({oplog1, updateOplog});
@@ -1384,17 +1344,14 @@ TEST_F(SessionCatalogMigrationDestinationTest, ShouldIgnoreAlreadyExecutedStatem
OpTime(Timestamp(60, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(sessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry oplog2(OpTime(Timestamp(70, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 80));
oplog2.setOperationSessionInfo(sessionInfo);
oplog2.setStatementId(30);
- oplog2.setWallClockTime(Date_t::now());
OplogEntry oplog3(OpTime(Timestamp(80, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 80));
oplog3.setOperationSessionInfo(sessionInfo);
oplog3.setStatementId(45);
- oplog3.setWallClockTime(Date_t::now());
returnOplog({oplog1, oplog2, oplog3});
@@ -1438,18 +1395,15 @@ TEST_F(SessionCatalogMigrationDestinationTest, OplogEntriesWithIncompleteHistory
OpTime(Timestamp(100, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 100));
oplog1.setOperationSessionInfo(sessionInfo);
oplog1.setStatementId(23);
- oplog1.setWallClockTime(Date_t::now());
OplogEntry oplog2(
OpTime(Timestamp(80, 2), 1), 0, OpTypeEnum::kNoop, kNs, 0, {}, Session::kDeadEndSentinel);
oplog2.setOperationSessionInfo(sessionInfo);
oplog2.setStatementId(kIncompleteHistoryStmtId);
- oplog2.setWallClockTime(Date_t::now());
OplogEntry oplog3(OpTime(Timestamp(60, 2), 1), 0, OpTypeEnum::kInsert, kNs, 0, BSON("x" << 60));
oplog3.setOperationSessionInfo(sessionInfo);
oplog3.setStatementId(5);
- oplog3.setWallClockTime(Date_t::now());
returnOplog({oplog1, oplog2, oplog3});
// migration always fetches at least twice to transition from committing to done.
diff --git a/src/mongo/db/session_test.cpp b/src/mongo/db/session_test.cpp
index a7b1690b369..15cbcd8ba27 100644
--- a/src/mongo/db/session_test.cpp
+++ b/src/mongo/db/session_test.cpp
@@ -84,17 +84,8 @@ protected:
repl::OplogLink link;
link.prevOpTime = prevOpTime;
- return repl::logOp(opCtx,
- "n",
- nss,
- kUUID,
- BSON("TestValue" << 0),
- nullptr,
- false,
- Date_t::now(),
- osi,
- stmtId,
- link);
+ return repl::logOp(
+ opCtx, "n", nss, kUUID, BSON("TestValue" << 0), nullptr, false, osi, stmtId, link);
}
};