diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2022-08-15 14:26:44 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-15 15:34:24 +0000 |
commit | dab5cd5899ce6760ec5176b79821fcc45812624a (patch) | |
tree | e7abd3c22ea84da8bdb05f5790a3c86058cad92e /src/mongo/db/transaction | |
parent | abca3f700aa1da45ea14c8f2dc6ab52f952e3945 (diff) | |
download | mongo-dab5cd5899ce6760ec5176b79821fcc45812624a.tar.gz |
SERVER-68635 Move the whole insert path out of CollectionImpl
Diffstat (limited to 'src/mongo/db/transaction')
-rw-r--r-- | src/mongo/db/transaction/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/transaction/transaction_participant.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/transaction/transaction_participant_test.cpp | 8 |
3 files changed, 7 insertions, 10 deletions
diff --git a/src/mongo/db/transaction/SConscript b/src/mongo/db/transaction/SConscript index 234612b827f..f64da4c08cb 100644 --- a/src/mongo/db/transaction/SConscript +++ b/src/mongo/db/transaction/SConscript @@ -22,6 +22,7 @@ env.Library( ], LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/db/catalog/collection_catalog', + '$BUILD_DIR/mongo/db/catalog/collection_crud', '$BUILD_DIR/mongo/db/catalog/database_holder', '$BUILD_DIR/mongo/db/catalog/local_oplog_info', '$BUILD_DIR/mongo/db/catalog_raii', diff --git a/src/mongo/db/transaction/transaction_participant.cpp b/src/mongo/db/transaction/transaction_participant.cpp index 221c9dfef35..43ade31c7fe 100644 --- a/src/mongo/db/transaction/transaction_participant.cpp +++ b/src/mongo/db/transaction/transaction_participant.cpp @@ -27,16 +27,14 @@ * it in the license file. */ - #define LOGV2_FOR_TRANSACTION(ID, DLEVEL, MESSAGE, ...) \ LOGV2_DEBUG_OPTIONS(ID, DLEVEL, {logv2::LogComponent::kTransaction}, MESSAGE, ##__VA_ARGS__) -#include "mongo/platform/basic.h" - #include "mongo/db/transaction/transaction_participant.h" #include <fmt/format.h> +#include "mongo/db/catalog/collection_write_path.h" #include "mongo/db/catalog/database_holder.h" #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/catalog/local_oplog_info.h" @@ -81,7 +79,6 @@ #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kStorage - namespace mongo { using namespace fmt::literals; namespace { @@ -421,7 +418,8 @@ void updateSessionEntry(OperationContext* opCtx, if (recordId.isNull()) { // Upsert case. - auto status = collection->insertDocument(opCtx, InsertStatement(updateMod), nullptr, false); + auto status = collection_internal::insertDocument( + opCtx, *collection, InsertStatement(updateMod), nullptr, false); if (status == ErrorCodes::DuplicateKey) { throwWriteConflictException( diff --git a/src/mongo/db/transaction/transaction_participant_test.cpp b/src/mongo/db/transaction/transaction_participant_test.cpp index 9e2642e20e2..16c8d1ba235 100644 --- a/src/mongo/db/transaction/transaction_participant_test.cpp +++ b/src/mongo/db/transaction/transaction_participant_test.cpp @@ -27,10 +27,7 @@ * it in the license file. */ -#include "mongo/platform/basic.h" - -#include <memory> - +#include "mongo/db/catalog/collection_write_path.h" #include "mongo/db/client.h" #include "mongo/db/concurrency/replication_state_transition_lock_guard.h" #include "mongo/db/db_raii.h" @@ -404,7 +401,8 @@ void insertTxnRecord(OperationContext* opCtx, unsigned i, DurableTxnStateEnum st auto coll = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, nss); ASSERT(coll); OpDebug* const nullOpDebug = nullptr; - ASSERT_OK(coll->insertDocument(opCtx, InsertStatement(record.toBSON()), nullOpDebug, false)); + ASSERT_OK(collection_internal::insertDocument( + opCtx, coll, InsertStatement(record.toBSON()), nullOpDebug, false)); wuow.commit(); } } // namespace |