|
42 | 42 | #include "mongo/db/repl/oplog.h"
|
43 | 43 | #include "mongo/db/repl/oplog_entry.h"
|
44 | 44 | #include "mongo/db/repl/optime.h"
|
| 45 | +#include "mongo/db/repl/storage_interface_impl.h" |
| 46 | +#include "mongo/db/repl/storage_interface_mock.h" |
45 | 47 | #include "mongo/db/server_transactions_metrics.h"
|
46 | 48 | #include "mongo/db/service_context.h"
|
47 | 49 | #include "mongo/db/session_catalog_mongod.h"
|
@@ -226,9 +228,18 @@ class TxnParticipantTest : public MockReplCoordServerFixture {
|
226 | 228 | protected:
|
227 | 229 | void setUp() override {
|
228 | 230 | MockReplCoordServerFixture::setUp();
|
| 231 | + const auto service = opCtx()->getServiceContext(); |
| 232 | + auto _storageInterfaceImpl = std::make_unique<repl::StorageInterfaceImpl>(); |
| 233 | + |
| 234 | + // onStepUp() relies on the storage interface to create the config.transactions table. |
| 235 | + repl::StorageInterface::set(service, std::move(_storageInterfaceImpl)); |
229 | 236 | MongoDSessionCatalog::onStepUp(opCtx());
|
230 | 237 |
|
231 |
| - const auto service = opCtx()->getServiceContext(); |
| 238 | + // We use the mocked storage interface here since StorageInterfaceImpl does not support |
| 239 | + // getPointInTimeReadTimestamp(). |
| 240 | + auto _storageInterfaceMock = std::make_unique<repl::StorageInterfaceMock>(); |
| 241 | + repl::StorageInterface::set(service, std::move(_storageInterfaceMock)); |
| 242 | + |
232 | 243 | OpObserverRegistry* opObserverRegistry =
|
233 | 244 | dynamic_cast<OpObserverRegistry*>(service->getOpObserver());
|
234 | 245 | auto mockObserver = std::make_unique<OpObserverMock>();
|
@@ -1520,6 +1531,9 @@ TEST_F(TxnParticipantTest, ReacquireLocksForPreparedTransactionsOnStepUp) {
|
1520 | 1531 |
|
1521 | 1532 | // Step-up will restore the locks of prepared transactions.
|
1522 | 1533 | ASSERT(opCtx()->writesAreReplicated());
|
| 1534 | + const auto service = opCtx()->getServiceContext(); |
| 1535 | + // onStepUp() relies on the storage interface to create the config.transactions table. |
| 1536 | + repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceImpl>()); |
1523 | 1537 | MongoDSessionCatalog::onStepUp(opCtx());
|
1524 | 1538 | {
|
1525 | 1539 | auto sessionCheckout = checkOutSession({});
|
|
0 commit comments