summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/mongod_main.cpp6
-rw-r--r--src/mongo/db/op_observer/op_observer_impl_test.cpp7
-rw-r--r--src/mongo/db/repl/oplog_applier_impl_test.cpp7
-rw-r--r--src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp6
-rw-r--r--src/mongo/db/repl/replication_recovery_test.cpp7
-rw-r--r--src/mongo/db/repl/rollback_test_fixture.cpp6
-rw-r--r--src/mongo/db/repl/storage_timestamp_test.cpp7
-rw-r--r--src/mongo/db/repl/tenant_oplog_applier_test.cpp6
-rw-r--r--src/mongo/db/s/resharding/resharding_oplog_batch_applier_test.cpp6
-rw-r--r--src/mongo/db/s/resharding/resharding_oplog_crud_application_test.cpp6
-rw-r--r--src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp6
-rw-r--r--src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp6
-rw-r--r--src/mongo/db/s/resharding/resharding_recipient_service_external_state_test.cpp6
-rw-r--r--src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp6
-rw-r--r--src/mongo/db/s/session_catalog_migration_destination_test.cpp6
-rw-r--r--src/mongo/db/s/sharding_mongod_test_fixture.cpp6
-rw-r--r--src/mongo/db/session/session_catalog_mongod.cpp4
-rw-r--r--src/mongo/db/session/session_catalog_mongod.h6
-rw-r--r--src/mongo/db/session/session_catalog_mongod_test.cpp4
-rw-r--r--src/mongo/db/session/session_catalog_mongod_transaction_interface.h44
-rw-r--r--src/mongo/db/transaction/SConscript1
-rw-r--r--src/mongo/db/transaction/internal_transactions_reap_service_test.cpp6
-rw-r--r--src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.cpp32
-rw-r--r--src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h51
-rw-r--r--src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp6
-rw-r--r--src/mongo/db/transaction/transaction_participant_test.cpp6
26 files changed, 234 insertions, 26 deletions
diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp
index e0b28035e01..18d3d97ffa5 100644
--- a/src/mongo/db/mongod_main.cpp
+++ b/src/mongo/db/mongod_main.cpp
@@ -177,6 +177,7 @@
#include "mongo/db/storage/storage_parameters_gen.h"
#include "mongo/db/system_index.h"
#include "mongo/db/transaction/internal_transactions_reap_service.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/db/ttl.h"
#include "mongo/db/vector_clock_metadata_hook.h"
@@ -1102,7 +1103,10 @@ void setUpReplication(ServiceContext* serviceContext) {
repl::ReplicationCoordinator::set(serviceContext, std::move(replCoord));
- MongoDSessionCatalog::set(serviceContext, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ serviceContext,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
IndexBuildsCoordinator::set(serviceContext, std::make_unique<IndexBuildsCoordinatorMongod>());
diff --git a/src/mongo/db/op_observer/op_observer_impl_test.cpp b/src/mongo/db/op_observer/op_observer_impl_test.cpp
index 474650e0d13..c78fad85ddc 100644
--- a/src/mongo/db/op_observer/op_observer_impl_test.cpp
+++ b/src/mongo/db/op_observer/op_observer_impl_test.cpp
@@ -59,6 +59,7 @@
#include "mongo/db/repl/tenant_migration_access_blocker_registry.h"
#include "mongo/db/service_context_d_test_fixture.h"
#include "mongo/db/session/session_catalog_mongod.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/db/transaction/transaction_participant_gen.h"
#include "mongo/idl/server_parameter_test_util.h"
@@ -177,8 +178,10 @@ protected:
auto replCoord = repl::ReplicationCoordinator::get(opCtx.get());
ASSERT_OK(replCoord->setFollowerMode(repl::MemberState::RS_PRIMARY));
- MongoDSessionCatalog::set(opCtx->getServiceContext(),
- std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ opCtx->getServiceContext(),
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(opCtx.get());
mongoDSessionCatalog->onStepUp(opCtx.get());
diff --git a/src/mongo/db/repl/oplog_applier_impl_test.cpp b/src/mongo/db/repl/oplog_applier_impl_test.cpp
index 85fafe1c36f..b312f37f048 100644
--- a/src/mongo/db/repl/oplog_applier_impl_test.cpp
+++ b/src/mongo/db/repl/oplog_applier_impl_test.cpp
@@ -67,6 +67,7 @@
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/session/session_txn_record_gen.h"
#include "mongo/db/stats/counters.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant_gen.h"
#include "mongo/db/update/update_oplog_entry_serialization.h"
#include "mongo/idl/server_parameter_test_util.h"
@@ -2688,8 +2689,10 @@ public:
// secondary index creation does not. We use an UnreplicatedWritesBlock to avoid
// timestamping any of the catalog setup.
repl::UnreplicatedWritesBlock noRep(_opCtx.get());
- MongoDSessionCatalog::set(_opCtx->getServiceContext(),
- std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ _opCtx->getServiceContext(),
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(_opCtx.get());
mongoDSessionCatalog->onStepUp(_opCtx.get());
diff --git a/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp b/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp
index 76750e8c790..0144dd48887 100644
--- a/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp
+++ b/src/mongo/db/repl/oplog_applier_impl_test_fixture.cpp
@@ -47,6 +47,7 @@
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/repl/storage_interface_impl.h"
#include "mongo/db/session/session_catalog_mongod.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/vector_clock_mutable.h"
namespace mongo {
@@ -160,7 +161,10 @@ void OplogApplierImplTest::setUp() {
StorageInterface::set(serviceContext, std::make_unique<StorageInterfaceImpl>());
- MongoDSessionCatalog::set(serviceContext, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ serviceContext,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
DropPendingCollectionReaper::set(
serviceContext, std::make_unique<DropPendingCollectionReaper>(getStorageInterface()));
diff --git a/src/mongo/db/repl/replication_recovery_test.cpp b/src/mongo/db/repl/replication_recovery_test.cpp
index fcaef636ac7..c6ddd443124 100644
--- a/src/mongo/db/repl/replication_recovery_test.cpp
+++ b/src/mongo/db/repl/replication_recovery_test.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/storage/durable_history_pin.h"
#include "mongo/db/storage/storage_options.h"
#include "mongo/db/storage/storage_parameters_gen.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/db/update/update_oplog_entry_serialization.h"
#include "mongo/unittest/death_test.h"
@@ -204,8 +205,10 @@ private:
ASSERT_OK(_storageInterface->createCollection(
getOperationContext(), testNs, generateOptionsWithUuid()));
- MongoDSessionCatalog::set(_opCtx->getServiceContext(),
- std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ _opCtx->getServiceContext(),
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(_opCtx.get());
mongoDSessionCatalog->onStepUp(_opCtx.get());
diff --git a/src/mongo/db/repl/rollback_test_fixture.cpp b/src/mongo/db/repl/rollback_test_fixture.cpp
index e98ab9ca641..96b48365220 100644
--- a/src/mongo/db/repl/rollback_test_fixture.cpp
+++ b/src/mongo/db/repl/rollback_test_fixture.cpp
@@ -46,6 +46,7 @@
#include "mongo/db/repl/replication_recovery.h"
#include "mongo/db/repl/rs_rollback.h"
#include "mongo/db/session/session_catalog_mongod.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/unittest/log_test.h"
#include "mongo/util/str.h"
@@ -108,7 +109,10 @@ void RollbackTest::setUp() {
_replicationProcess->getConsistencyMarkers()->setMinValid(_opCtx.get(), OpTime{});
_replicationProcess->initializeRollbackID(_opCtx.get()).transitional_ignore();
- MongoDSessionCatalog::set(serviceContext, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ serviceContext,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto observerRegistry = checked_cast<OpObserverRegistry*>(serviceContext->getOpObserver());
observerRegistry->addObserver(std::make_unique<RollbackTestOpObserver>());
diff --git a/src/mongo/db/repl/storage_timestamp_test.cpp b/src/mongo/db/repl/storage_timestamp_test.cpp
index 73fdc89ac88..50a4f0ac7d3 100644
--- a/src/mongo/db/repl/storage_timestamp_test.cpp
+++ b/src/mongo/db/repl/storage_timestamp_test.cpp
@@ -81,6 +81,7 @@
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/storage/snapshot_manager.h"
#include "mongo/db/storage/storage_engine_impl.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/db/transaction/transaction_participant_gen.h"
#include "mongo/db/update/update_oplog_entry_serialization.h"
@@ -289,8 +290,10 @@ public:
cc().getServiceContext(),
std::unique_ptr<repl::ReplicationProcess>(replicationProcess));
- MongoDSessionCatalog::set(_opCtx->getServiceContext(),
- std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ _opCtx->getServiceContext(),
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
_consistencyMarkers =
repl::ReplicationProcess::get(cc().getServiceContext())->getConsistencyMarkers();
diff --git a/src/mongo/db/repl/tenant_oplog_applier_test.cpp b/src/mongo/db/repl/tenant_oplog_applier_test.cpp
index 04d8005f23a..9905fc65c33 100644
--- a/src/mongo/db/repl/tenant_oplog_applier_test.cpp
+++ b/src/mongo/db/repl/tenant_oplog_applier_test.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/session/logical_session_id_helpers.h"
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/tenant_id.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/update/update_oplog_entry_serialization.h"
#include "mongo/executor/thread_pool_task_executor_test_fixture.h"
#include "mongo/logv2/log.h"
@@ -153,7 +154,10 @@ public:
_opCtx = cc().makeOperationContext();
repl::createOplog(_opCtx.get());
- MongoDSessionCatalog::set(service, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ service,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
// Ensure that we are primary.
auto replCoord = ReplicationCoordinator::get(_opCtx.get());
diff --git a/src/mongo/db/s/resharding/resharding_oplog_batch_applier_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_batch_applier_test.cpp
index 6b99c919b82..9712005b67c 100644
--- a/src/mongo/db/s/resharding/resharding_oplog_batch_applier_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_oplog_batch_applier_test.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/session/logical_session_cache_noop.h"
#include "mongo/db/session/logical_session_id.h"
#include "mongo/db/session/session_catalog_mongod.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/db/vector_clock_metadata_hook.h"
#include "mongo/executor/network_interface_factory.h"
@@ -87,7 +88,10 @@ public:
auto storageImpl = std::make_unique<repl::StorageInterfaceImpl>();
repl::StorageInterface::set(serviceContext, std::move(storageImpl));
- MongoDSessionCatalog::set(serviceContext, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ serviceContext,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(opCtx.get());
mongoDSessionCatalog->onStepUp(opCtx.get());
diff --git a/src/mongo/db/s/resharding/resharding_oplog_crud_application_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_crud_application_test.cpp
index 663078a8e54..94ebf77e94b 100644
--- a/src/mongo/db/s/resharding/resharding_oplog_crud_application_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_oplog_crud_application_test.cpp
@@ -49,6 +49,7 @@
#include "mongo/db/service_context_d_test_fixture.h"
#include "mongo/db/session/logical_session_cache_noop.h"
#include "mongo/db/session/session_catalog_mongod.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/update/update_oplog_entry_serialization.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/chunk_manager.h"
@@ -81,7 +82,10 @@ public:
auto storageImpl = std::make_unique<repl::StorageInterfaceImpl>();
repl::StorageInterface::set(serviceContext, std::move(storageImpl));
- MongoDSessionCatalog::set(serviceContext, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ serviceContext,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(opCtx.get());
mongoDSessionCatalog->onStepUp(opCtx.get());
LogicalSessionCache::set(serviceContext, std::make_unique<LogicalSessionCacheNoop>());
diff --git a/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp
index 53d6cff94a8..d620bee286d 100644
--- a/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/session/logical_session_cache_noop.h"
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/storage/write_unit_of_work.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/s/catalog/sharding_catalog_client_mock.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/unittest/death_test.h"
@@ -114,7 +115,10 @@ public:
// onStepUp() relies on the storage interface to create the config.transactions table.
repl::StorageInterface::set(getServiceContext(),
std::make_unique<repl::StorageInterfaceImpl>());
- MongoDSessionCatalog::set(getServiceContext(), std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ getServiceContext(),
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(operationContext());
mongoDSessionCatalog->onStepUp(operationContext());
LogicalSessionCache::set(getServiceContext(), std::make_unique<LogicalSessionCacheNoop>());
diff --git a/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp
index f9e3b4fccfd..e22495a70c8 100644
--- a/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp
@@ -44,6 +44,7 @@
#include "mongo/db/session/logical_session_id.h"
#include "mongo/db/session/logical_session_id_helpers.h"
#include "mongo/db/session/session_catalog_mongod.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/unittest/death_test.h"
#include "mongo/unittest/unittest.h"
@@ -71,7 +72,10 @@ public:
auto storageImpl = std::make_unique<repl::StorageInterfaceImpl>();
repl::StorageInterface::set(serviceContext, std::move(storageImpl));
- MongoDSessionCatalog::set(serviceContext, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ serviceContext,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(opCtx.get());
mongoDSessionCatalog->onStepUp(opCtx.get());
}
diff --git a/src/mongo/db/s/resharding/resharding_recipient_service_external_state_test.cpp b/src/mongo/db/s/resharding/resharding_recipient_service_external_state_test.cpp
index 79e81e63801..b004e7178ef 100644
--- a/src/mongo/db/s/resharding/resharding_recipient_service_external_state_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_recipient_service_external_state_test.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/s/resharding/resharding_util.h"
#include "mongo/db/service_context_d_test_fixture.h"
#include "mongo/db/session/session_catalog_mongod.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/logv2/log.h"
#include "mongo/s/catalog_cache_test_fixture.h"
#include "mongo/s/database_version.h"
@@ -84,7 +85,10 @@ public:
repl::createOplog(operationContext());
- MongoDSessionCatalog::set(getServiceContext(), std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ getServiceContext(),
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(operationContext());
mongoDSessionCatalog->onStepUp(operationContext());
}
diff --git a/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp b/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp
index ea8af11ebda..d7529641b44 100644
--- a/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp
@@ -47,6 +47,7 @@
#include "mongo/db/session/logical_session_cache_noop.h"
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/session/session_txn_record_gen.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/db/vector_clock_metadata_hook.h"
#include "mongo/executor/network_interface_factory.h"
@@ -108,7 +109,10 @@ class ReshardingTxnClonerTest : public ShardServerTestFixture {
// onStepUp() relies on the storage interface to create the config.transactions table.
repl::StorageInterface::set(getServiceContext(),
std::make_unique<repl::StorageInterfaceImpl>());
- MongoDSessionCatalog::set(getServiceContext(), std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ getServiceContext(),
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(operationContext());
mongoDSessionCatalog->onStepUp(operationContext());
LogicalSessionCache::set(getServiceContext(), std::make_unique<LogicalSessionCacheNoop>());
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 9486e1a70fe..0d75014962d 100644
--- a/src/mongo/db/s/session_catalog_migration_destination_test.cpp
+++ b/src/mongo/db/s/session_catalog_migration_destination_test.cpp
@@ -51,6 +51,7 @@
#include "mongo/db/session/logical_session_id.h"
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/session/session_txn_record_gen.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_history_iterator.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/executor/remote_command_request.h"
@@ -138,7 +139,10 @@ public:
// onStepUp() relies on the storage interface to create the config.transactions table.
repl::StorageInterface::set(getServiceContext(),
std::make_unique<repl::StorageInterfaceImpl>());
- MongoDSessionCatalog::set(getServiceContext(), std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ getServiceContext(),
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(operationContext());
mongoDSessionCatalog->onStepUp(operationContext());
LogicalSessionCache::set(getServiceContext(), std::make_unique<LogicalSessionCacheNoop>());
diff --git a/src/mongo/db/s/sharding_mongod_test_fixture.cpp b/src/mongo/db/s/sharding_mongod_test_fixture.cpp
index 544f3298655..d3879831635 100644
--- a/src/mongo/db/s/sharding_mongod_test_fixture.cpp
+++ b/src/mongo/db/s/sharding_mongod_test_fixture.cpp
@@ -59,6 +59,7 @@
#include "mongo/db/s/shard_server_op_observer.h"
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/storage/snapshot_manager.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/executor/thread_pool_task_executor_test_fixture.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
@@ -252,7 +253,10 @@ void ShardingMongodTestFixture::setUp() {
repl::createOplog(operationContext());
- MongoDSessionCatalog::set(service, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ service,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
// Set the highest FCV because otherwise it defaults to the lower FCV. This way we default to
// testing this release's code, not backwards compatibility code.
diff --git a/src/mongo/db/session/session_catalog_mongod.cpp b/src/mongo/db/session/session_catalog_mongod.cpp
index 2822274690b..2b9a24e9dcf 100644
--- a/src/mongo/db/session/session_catalog_mongod.cpp
+++ b/src/mongo/db/session/session_catalog_mongod.cpp
@@ -521,7 +521,9 @@ BSONObj MongoDSessionCatalog::getConfigTxnPartialIndexSpec() {
return index.toBSON();
}
-MongoDSessionCatalog::MongoDSessionCatalog() {}
+MongoDSessionCatalog::MongoDSessionCatalog(
+ std::unique_ptr<MongoDSessionCatalogTransactionInterface> ti)
+ : _ti(std::move(ti)) {}
void MongoDSessionCatalog::onStepUp(OperationContext* opCtx) {
// Invalidate sessions that could have a retryable write on it, so that we can refresh from disk
diff --git a/src/mongo/db/session/session_catalog_mongod.h b/src/mongo/db/session/session_catalog_mongod.h
index ce5de294b51..10ae6fea506 100644
--- a/src/mongo/db/session/session_catalog_mongod.h
+++ b/src/mongo/db/session/session_catalog_mongod.h
@@ -30,6 +30,7 @@
#pragma once
#include "mongo/db/session/session_catalog.h"
+#include "mongo/db/session/session_catalog_mongod_transaction_interface.h"
namespace mongo {
@@ -66,7 +67,7 @@ public:
*/
static BSONObj getConfigTxnPartialIndexSpec();
- MongoDSessionCatalog();
+ explicit MongoDSessionCatalog(std::unique_ptr<MongoDSessionCatalogTransactionInterface> ti);
/**
* Invoked when the node enters the primary state. Ensures that the transactions collection is
@@ -180,6 +181,9 @@ public:
void checkInUnscopedSession(OperationContext* opCtx,
OperationContextSession::CheckInReason reason);
void checkOutUnscopedSession(OperationContext* opCtx);
+
+private:
+ std::unique_ptr<MongoDSessionCatalogTransactionInterface> _ti;
};
/**
diff --git a/src/mongo/db/session/session_catalog_mongod_test.cpp b/src/mongo/db/session/session_catalog_mongod_test.cpp
index 5e988142e97..87758d0bb63 100644
--- a/src/mongo/db/session/session_catalog_mongod_test.cpp
+++ b/src/mongo/db/session/session_catalog_mongod_test.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/session/session_txn_record_gen.h"
#include "mongo/db/session/sessions_collection_mock.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/util/clock_source_mock.h"
namespace mongo {
@@ -84,7 +85,8 @@ TEST_F(MongoDSessionCatalogTest, ReapSomeExpiredSomeNot) {
_collectionMock->add(LogicalSessionRecord(makeLogicalSessionIdForTest(), clock()->now()));
_collectionMock->add(LogicalSessionRecord(makeLogicalSessionIdForTest(), clock()->now()));
- auto mongoDSessionCatalog = MongoDSessionCatalog{};
+ auto mongoDSessionCatalog =
+ MongoDSessionCatalog(std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>());
auto numReaped = mongoDSessionCatalog.reapSessionsOlderThan(
_opCtx, *_collection, clock()->now() - Minutes{30});
diff --git a/src/mongo/db/session/session_catalog_mongod_transaction_interface.h b/src/mongo/db/session/session_catalog_mongod_transaction_interface.h
new file mode 100644
index 00000000000..4a6af53d049
--- /dev/null
+++ b/src/mongo/db/session/session_catalog_mongod_transaction_interface.h
@@ -0,0 +1,44 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#pragma once
+
+namespace mongo {
+
+/**
+ * This interface provides methods for the MongoDSessionCatalog implementation to access
+ * multi-document transaction features, specifically functionality provided by the
+ * TransactionParticipant class in the db/transaction library.
+ */
+class MongoDSessionCatalogTransactionInterface {
+public:
+ virtual ~MongoDSessionCatalogTransactionInterface() = default;
+};
+
+} // namespace mongo
diff --git a/src/mongo/db/transaction/SConscript b/src/mongo/db/transaction/SConscript
index c4f2b197f96..8a9ed044aa1 100644
--- a/src/mongo/db/transaction/SConscript
+++ b/src/mongo/db/transaction/SConscript
@@ -12,6 +12,7 @@ env.Library(
'internal_transactions_reap_service.cpp',
'retryable_writes_stats.cpp',
'server_transactions_metrics.cpp',
+ 'session_catalog_mongod_transaction_interface_impl.cpp',
'transaction_history_iterator.cpp',
'transaction_metrics_observer.cpp',
'transaction_participant.cpp',
diff --git a/src/mongo/db/transaction/internal_transactions_reap_service_test.cpp b/src/mongo/db/transaction/internal_transactions_reap_service_test.cpp
index 36fb76333b9..46a1c1fbc26 100644
--- a/src/mongo/db/transaction/internal_transactions_reap_service_test.cpp
+++ b/src/mongo/db/transaction/internal_transactions_reap_service_test.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/session/session_txn_record_gen.h"
#include "mongo/db/transaction/internal_transactions_reap_service.h"
#include "mongo/db/transaction/internal_transactions_reap_service_gen.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
namespace mongo {
namespace {
@@ -61,7 +62,10 @@ protected:
auto replCoord = repl::ReplicationCoordinator::get(opCtx);
ASSERT_OK(replCoord->setFollowerMode(repl::MemberState::RS_PRIMARY));
- MongoDSessionCatalog::set(service, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ service,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(opCtx);
mongoDSessionCatalog->onStepUp(opCtx);
diff --git a/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.cpp b/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.cpp
new file mode 100644
index 00000000000..a1f9ef06b89
--- /dev/null
+++ b/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.cpp
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
+
+namespace mongo {} // namespace mongo
diff --git a/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h b/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h
new file mode 100644
index 00000000000..b29427ba5c5
--- /dev/null
+++ b/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h
@@ -0,0 +1,51 @@
+/**
+ * Copyright (C) 2022-present MongoDB, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the Server Side Public License, version 1,
+ * as published by MongoDB, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Server Side Public License for more details.
+ *
+ * You should have received a copy of the Server Side Public License
+ * along with this program. If not, see
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the Server Side Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#pragma once
+
+#include "mongo/db/session/session_catalog_mongod_transaction_interface.h"
+
+namespace mongo {
+
+/**
+ * Facade around the TransactionParticipant class in the db/transaction library.
+ */
+class MongoDSessionCatalogTransactionInterfaceImpl
+ : public MongoDSessionCatalogTransactionInterface {
+ MongoDSessionCatalogTransactionInterfaceImpl(
+ const MongoDSessionCatalogTransactionInterfaceImpl&) = delete;
+ MongoDSessionCatalogTransactionInterfaceImpl& operator=(
+ const MongoDSessionCatalogTransactionInterfaceImpl&) = delete;
+
+public:
+ MongoDSessionCatalogTransactionInterfaceImpl() = default;
+ virtual ~MongoDSessionCatalogTransactionInterfaceImpl() = default;
+};
+
+} // namespace mongo
diff --git a/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp b/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp
index 1b5fff8ede6..6b438d9642e 100644
--- a/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp
+++ b/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp
@@ -46,6 +46,7 @@
#include "mongo/db/service_context.h"
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/transaction/server_transactions_metrics.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/idl/server_parameter_test_util.h"
#include "mongo/stdx/future.h"
@@ -186,7 +187,10 @@ protected:
MockReplCoordServerFixture::setUp();
const auto service = opCtx()->getServiceContext();
repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceImpl>());
- MongoDSessionCatalog::set(service, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ service,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(opCtx());
mongoDSessionCatalog->onStepUp(opCtx());
diff --git a/src/mongo/db/transaction/transaction_participant_test.cpp b/src/mongo/db/transaction/transaction_participant_test.cpp
index e2d601b7228..d0900be4cbb 100644
--- a/src/mongo/db/transaction/transaction_participant_test.cpp
+++ b/src/mongo/db/transaction/transaction_participant_test.cpp
@@ -46,6 +46,7 @@
#include "mongo/db/session/session_catalog_mongod.h"
#include "mongo/db/stats/fill_locker_info.h"
#include "mongo/db/transaction/server_transactions_metrics.h"
+#include "mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h"
#include "mongo/db/transaction/transaction_participant.h"
#include "mongo/db/transaction/transaction_participant_gen.h"
#include "mongo/db/txn_retry_counter_too_old_info.h"
@@ -271,7 +272,10 @@ protected:
// Register a temporary storage interface for MongoDSessionCatalog::onStepUp() create the
// config.transactions table.
repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceImpl>());
- MongoDSessionCatalog::set(service, std::make_unique<MongoDSessionCatalog>());
+ MongoDSessionCatalog::set(
+ service,
+ std::make_unique<MongoDSessionCatalog>(
+ std::make_unique<MongoDSessionCatalogTransactionInterfaceImpl>()));
auto mongoDSessionCatalog = MongoDSessionCatalog::get(opCtx());
mongoDSessionCatalog->onStepUp(opCtx());