summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/idempotency_test_fixture.cpp
diff options
context:
space:
mode:
authorauto-revert-processor <dev-prod-dag@mongodb.com>2022-10-15 02:35:24 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-15 03:10:12 +0000
commite63e4961f27a9a6a4b9ae5b84c0d7e67e2f9d4db (patch)
treeb674be7b23bf479cd90118728de46d36c190b9cd /src/mongo/db/repl/idempotency_test_fixture.cpp
parent8d463a6789d68e2fc39b93346152e1b4a626e14a (diff)
downloadmongo-e63e4961f27a9a6a4b9ae5b84c0d7e67e2f9d4db.tar.gz
Revert "SERVER-62395 Use tid field to create namespace on non-txn commands during oplog application"
This reverts commit 3e16f4386ed3772d9aa01c16057f43d4a90eb133.
Diffstat (limited to 'src/mongo/db/repl/idempotency_test_fixture.cpp')
-rw-r--r--src/mongo/db/repl/idempotency_test_fixture.cpp38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/mongo/db/repl/idempotency_test_fixture.cpp b/src/mongo/db/repl/idempotency_test_fixture.cpp
index 43fae2f3382..2f836b798cd 100644
--- a/src/mongo/db/repl/idempotency_test_fixture.cpp
+++ b/src/mongo/db/repl/idempotency_test_fixture.cpp
@@ -173,10 +173,6 @@ Status IdempotencyTest::resetState() {
return Status::OK();
}
-void IdempotencyTest::setNss(const NamespaceString& nss) {
- _nss = nss;
-}
-
void IdempotencyTest::testOpsAreIdempotent(std::vector<OplogEntry> ops, SequenceType sequenceType) {
ASSERT_OK(resetState());
@@ -219,37 +215,37 @@ void IdempotencyTest::testOpsAreIdempotent(std::vector<OplogEntry> ops, Sequence
}
OplogEntry IdempotencyTest::createCollection(UUID uuid) {
- return makeCreateCollectionOplogEntry(nextOpTime(), _nss, BSON("uuid" << uuid));
+ return makeCreateCollectionOplogEntry(nextOpTime(), nss, BSON("uuid" << uuid));
}
OplogEntry IdempotencyTest::dropCollection() {
- return makeCommandOplogEntry(nextOpTime(), _nss, BSON("drop" << _nss.coll()));
+ return makeCommandOplogEntry(nextOpTime(), nss, BSON("drop" << nss.coll()));
}
OplogEntry IdempotencyTest::insert(const BSONObj& obj) {
- return makeInsertDocumentOplogEntry(nextOpTime(), _nss, obj);
+ return makeInsertDocumentOplogEntry(nextOpTime(), nss, obj);
}
template <class IdType>
OplogEntry IdempotencyTest::update(IdType _id, const BSONObj& obj) {
- return makeUpdateDocumentOplogEntry(nextOpTime(), _nss, BSON("_id" << _id), obj);
+ return makeUpdateDocumentOplogEntry(nextOpTime(), nss, BSON("_id" << _id), obj);
}
OplogEntry IdempotencyTest::buildIndex(const BSONObj& indexSpec,
const BSONObj& options,
const UUID& uuid) {
BSONObjBuilder bob;
- bob.append("createIndexes", _nss.coll());
+ bob.append("createIndexes", nss.coll());
bob.append("v", 2);
bob.append("key", indexSpec);
bob.append("name", std::string(indexSpec.firstElementFieldName()) + "_index");
bob.appendElementsUnique(options);
- return makeCommandOplogEntry(nextOpTime(), _nss, bob.obj(), uuid);
+ return makeCommandOplogEntry(nextOpTime(), nss, bob.obj(), uuid);
}
OplogEntry IdempotencyTest::dropIndex(const std::string& indexName, const UUID& uuid) {
- auto cmd = BSON("dropIndexes" << _nss.coll() << "index" << indexName);
- return makeCommandOplogEntry(nextOpTime(), _nss, cmd, uuid);
+ auto cmd = BSON("dropIndexes" << nss.coll() << "index" << indexName);
+ return makeCommandOplogEntry(nextOpTime(), nss, cmd, uuid);
}
OplogEntry IdempotencyTest::prepare(LogicalSessionId lsid,
@@ -262,7 +258,7 @@ OplogEntry IdempotencyTest::prepare(LogicalSessionId lsid,
info.setTxnNumber(txnNum);
return makeOplogEntry(nextOpTime(),
OpTypeEnum::kCommand,
- _nss.getCommandNS(),
+ nss.getCommandNS(),
BSON("applyOps" << ops << "prepare" << true),
boost::none /* o2 */,
info /* sessionInfo */,
@@ -281,7 +277,7 @@ OplogEntry IdempotencyTest::commitUnprepared(LogicalSessionId lsid,
info.setSessionId(lsid);
info.setTxnNumber(txnNum);
return makeCommandOplogEntryWithSessionInfoAndStmtIds(
- nextOpTime(), _nss, BSON("applyOps" << ops), lsid, txnNum, {stmtId}, prevOpTime);
+ nextOpTime(), nss, BSON("applyOps" << ops), lsid, txnNum, {stmtId}, prevOpTime);
}
OplogEntry IdempotencyTest::commitPrepared(LogicalSessionId lsid,
@@ -290,7 +286,7 @@ OplogEntry IdempotencyTest::commitPrepared(LogicalSessionId lsid,
OpTime prepareOpTime) {
return makeCommandOplogEntryWithSessionInfoAndStmtIds(
nextOpTime(),
- _nss,
+ nss,
BSON("commitTransaction" << 1 << "commitTimestamp" << prepareOpTime.getTimestamp()),
lsid,
txnNum,
@@ -303,7 +299,7 @@ OplogEntry IdempotencyTest::abortPrepared(LogicalSessionId lsid,
StmtId stmtId,
OpTime prepareOpTime) {
return makeCommandOplogEntryWithSessionInfoAndStmtIds(
- nextOpTime(), _nss, BSON("abortTransaction" << 1), lsid, txnNum, {stmtId}, prepareOpTime);
+ nextOpTime(), nss, BSON("abortTransaction" << 1), lsid, txnNum, {stmtId}, prepareOpTime);
}
OplogEntry IdempotencyTest::partialTxn(LogicalSessionId lsid,
@@ -316,7 +312,7 @@ OplogEntry IdempotencyTest::partialTxn(LogicalSessionId lsid,
info.setTxnNumber(txnNum);
return makeOplogEntry(nextOpTime(),
OpTypeEnum::kCommand,
- _nss.getCommandNS(),
+ nss.getCommandNS(),
BSON("applyOps" << ops << "partialTxn" << true),
boost::none /* o2 */,
info /* sessionInfo */,
@@ -376,7 +372,7 @@ std::vector<CollectionState> IdempotencyTest::validateAllCollections() {
CollectionState IdempotencyTest::validate(const NamespaceString& nss) {
auto collUUID = [&]() -> boost::optional<UUID> {
- AutoGetCollectionForReadCommand autoColl(_opCtx.get(), _nss);
+ AutoGetCollectionForReadCommand autoColl(_opCtx.get(), nss);
if (const auto& collection = autoColl.getCollection()) {
return collection->uuid();
}
@@ -390,7 +386,7 @@ CollectionState IdempotencyTest::validate(const NamespaceString& nss) {
}
{
- AutoGetCollectionForReadCommand collection(_opCtx.get(), _nss);
+ AutoGetCollectionForReadCommand collection(_opCtx.get(), nss);
if (!collection) {
// Return a mostly default initialized CollectionState struct with exists set to false
@@ -405,7 +401,7 @@ CollectionState IdempotencyTest::validate(const NamespaceString& nss) {
ASSERT_OK(
CollectionValidation::validate(_opCtx.get(),
- _nss,
+ nss,
CollectionValidation::ValidateMode::kForegroundFull,
CollectionValidation::RepairMode::kNone,
&validateResults,
@@ -413,7 +409,7 @@ CollectionState IdempotencyTest::validate(const NamespaceString& nss) {
ASSERT_TRUE(validateResults.valid);
}
- AutoGetCollectionForReadCommand collection(_opCtx.get(), _nss);
+ AutoGetCollectionForReadCommand collection(_opCtx.get(), nss);
std::string dataHash = computeDataHash(collection.getCollection());