summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2022-04-22 19:42:03 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-22 20:12:32 +0000
commit90d6271d2f663a4aaf633de5e362972e50e90c21 (patch)
treed24da0cee090d7d92972fa8f43fa4f0eb41ac915 /src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp
parent983a7174c6d792049ef0f54e36a55f93801df89c (diff)
downloadmongo-90d6271d2f663a4aaf633de5e362972e50e90c21.tar.gz
SERVER-60761 Move the global read-only flag to be an OperationContext function
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp
index 70912221539..0b38e30c443 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.cpp
@@ -28,8 +28,6 @@
*/
#include "mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.h"
-
-#include "mongo/db/operation_context_noop.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
namespace mongo {
@@ -53,7 +51,6 @@ WiredTigerHarnessHelper::WiredTigerHarnessHelper(StringData extraStrings)
0,
true,
false,
- false,
false) {
repl::ReplicationCoordinator::set(
serviceContext(),
@@ -63,8 +60,8 @@ WiredTigerHarnessHelper::WiredTigerHarnessHelper(StringData extraStrings)
std::unique_ptr<RecordStore> WiredTigerHarnessHelper::newRecordStore(
const std::string& ns, const CollectionOptions& collOptions, KeyFormat keyFormat) {
- WiredTigerRecoveryUnit* ru = checked_cast<WiredTigerRecoveryUnit*>(_engine.newRecoveryUnit());
- OperationContextNoop opCtx(ru);
+ ServiceContext::UniqueOperationContext opCtx(newOperationContext());
+ WiredTigerRecoveryUnit* ru = checked_cast<WiredTigerRecoveryUnit*>(opCtx->recoveryUnit());
std::string uri = WiredTigerKVEngine::kTableUriPrefix + ns;
StringData ident = ns;
NamespaceString nss(ns);
@@ -81,7 +78,7 @@ std::unique_ptr<RecordStore> WiredTigerHarnessHelper::newRecordStore(
std::string config = result.getValue();
{
- WriteUnitOfWork uow(&opCtx);
+ WriteUnitOfWork uow(opCtx.get());
WT_SESSION* s = ru->getSession()->getSession();
invariantWTOK(s->create(s, uri.c_str(), config.c_str()), s);
uow.commit();
@@ -98,26 +95,24 @@ std::unique_ptr<RecordStore> WiredTigerHarnessHelper::newRecordStore(
params.isLogged = WiredTigerUtil::useTableLogging(nss);
params.cappedCallback = nullptr;
params.sizeStorer = nullptr;
- params.isReadOnly = false;
params.tracksSizeAdjustments = true;
params.forceUpdateWithFullDocument = collOptions.timeseries != boost::none;
- auto ret = std::make_unique<StandardWiredTigerRecordStore>(&_engine, &opCtx, params);
- ret->postConstructorInit(&opCtx);
+ auto ret = std::make_unique<StandardWiredTigerRecordStore>(&_engine, opCtx.get(), params);
+ ret->postConstructorInit(opCtx.get());
return std::move(ret);
}
std::unique_ptr<RecordStore> WiredTigerHarnessHelper::newOplogRecordStore() {
auto ret = newOplogRecordStoreNoInit();
- auto* ru = _engine.newRecoveryUnit();
- OperationContextNoop opCtx(ru);
- dynamic_cast<WiredTigerRecordStore*>(ret.get())->postConstructorInit(&opCtx);
+ ServiceContext::UniqueOperationContext opCtx(newOperationContext());
+ dynamic_cast<WiredTigerRecordStore*>(ret.get())->postConstructorInit(opCtx.get());
return ret;
}
std::unique_ptr<RecordStore> WiredTigerHarnessHelper::newOplogRecordStoreNoInit() {
- WiredTigerRecoveryUnit* ru = dynamic_cast<WiredTigerRecoveryUnit*>(_engine.newRecoveryUnit());
- OperationContextNoop opCtx(ru);
+ ServiceContext::UniqueOperationContext opCtx(newOperationContext());
+ WiredTigerRecoveryUnit* ru = checked_cast<WiredTigerRecoveryUnit*>(opCtx->recoveryUnit());
std::string ident = NamespaceString::kRsOplogNamespace.ns();
std::string uri = WiredTigerKVEngine::kTableUriPrefix + ident;
@@ -137,7 +132,7 @@ std::unique_ptr<RecordStore> WiredTigerHarnessHelper::newOplogRecordStoreNoInit(
std::string config = result.getValue();
{
- WriteUnitOfWork uow(&opCtx);
+ WriteUnitOfWork uow(opCtx.get());
WT_SESSION* s = ru->getSession()->getSession();
invariantWTOK(s->create(s, uri.c_str(), config.c_str()), s);
uow.commit();
@@ -156,10 +151,9 @@ std::unique_ptr<RecordStore> WiredTigerHarnessHelper::newOplogRecordStoreNoInit(
params.oplogMaxSize = 1024 * 1024 * 1024;
params.cappedCallback = nullptr;
params.sizeStorer = nullptr;
- params.isReadOnly = false;
params.tracksSizeAdjustments = true;
params.forceUpdateWithFullDocument = false;
- return std::make_unique<StandardWiredTigerRecordStore>(&_engine, &opCtx, params);
+ return std::make_unique<StandardWiredTigerRecordStore>(&_engine, opCtx.get(), params);
}
std::unique_ptr<RecoveryUnit> WiredTigerHarnessHelper::newRecoveryUnit() {