summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Brock <tyler.brock@gmail.com>2022-07-25 13:45:22 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-25 14:33:38 +0000
commit0125582d71bebbdc5591281eab1b7f9759474fb0 (patch)
tree0945b8e21191a4dc43b3f01ba65d3821f9877746
parentc0e3f3796a417747ccd1a8a97cb4fc21d78f2fc5 (diff)
downloadmongo-0125582d71bebbdc5591281eab1b7f9759474fb0.tar.gz
SERVER-66595 remove calls to getGlobalServiceContext in POS derived classes
-rw-r--r--src/mongo/db/repl/tenant_migration_donor_service.cpp2
-rw-r--r--src/mongo/db/repl/tenant_migration_recipient_service.cpp18
-rw-r--r--src/mongo/db/s/resharding/resharding_coordinator_service.cpp9
-rw-r--r--src/mongo/db/s/resharding/resharding_coordinator_service.h10
-rw-r--r--src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp9
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_service.cpp11
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_service.h11
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_service_test.cpp9
-rw-r--r--src/mongo/db/s/resharding/resharding_recipient_service.cpp11
-rw-r--r--src/mongo/db/s/resharding/resharding_recipient_service.h11
-rw-r--r--src/mongo/db/s/resharding/resharding_recipient_service_test.cpp9
11 files changed, 77 insertions, 33 deletions
diff --git a/src/mongo/db/repl/tenant_migration_donor_service.cpp b/src/mongo/db/repl/tenant_migration_donor_service.cpp
index a271df97934..77f8de0fe8f 100644
--- a/src/mongo/db/repl/tenant_migration_donor_service.cpp
+++ b/src/mongo/db/repl/tenant_migration_donor_service.cpp
@@ -1194,7 +1194,7 @@ TenantMigrationDonorService::Instance::_waitUntilStartMigrationDonorTimestampIsC
})
.until([this, self = shared_from_this(), startMigrationDonorTimestamp](Status status) {
uassertStatusOK(status);
- auto storageEngine = getGlobalServiceContext()->getStorageEngine();
+ auto storageEngine = _serviceContext->getStorageEngine();
if (storageEngine->getLastStableRecoveryTimestamp() < startMigrationDonorTimestamp) {
return false;
}
diff --git a/src/mongo/db/repl/tenant_migration_recipient_service.cpp b/src/mongo/db/repl/tenant_migration_recipient_service.cpp
index c71e29a1848..f3d3e66804b 100644
--- a/src/mongo/db/repl/tenant_migration_recipient_service.cpp
+++ b/src/mongo/db/repl/tenant_migration_recipient_service.cpp
@@ -731,7 +731,7 @@ SemiFuture<void> TenantMigrationRecipientService::Instance::_createAndConnectCli
auto majoritySnapshotOpTime = _getDonorMajorityOpTime(client);
if (majoritySnapshotOpTime.getTimestamp() < startMigrationDonorTimestamp) {
stdx::lock_guard lk(_mutex);
- const auto now = getGlobalServiceContext()->getFastClockSource()->now();
+ const auto now = _serviceContext->getFastClockSource()->now();
_excludeDonorHost(
lk,
serverAddress,
@@ -747,7 +747,7 @@ SemiFuture<void> TenantMigrationRecipientService::Instance::_createAndConnectCli
}
if (startApplyingOpTime && majoritySnapshotOpTime < *startApplyingOpTime) {
stdx::lock_guard lk(_mutex);
- const auto now = getGlobalServiceContext()->getFastClockSource()->now();
+ const auto now = _serviceContext->getFastClockSource()->now();
_excludeDonorHost(
lk,
serverAddress,
@@ -843,7 +843,7 @@ void TenantMigrationRecipientService::Instance::_excludeDonorHost(WithLock,
std::vector<HostAndPort> TenantMigrationRecipientService::Instance::_getExcludedDonorHosts(
WithLock lk) {
- const auto now = getGlobalServiceContext()->getFastClockSource()->now();
+ const auto now = _serviceContext->getFastClockSource()->now();
// Clean up any hosts that have had their exclusion duration expired.
auto itr = std::remove_if(
@@ -890,7 +890,7 @@ SemiFuture<void> TenantMigrationRecipientService::Instance::_initializeStateDoc(
invariant(!_stateDoc.getExpireAt());
}
// Persist the state doc before starting the data sync.
- _stateDoc.setStartAt(getGlobalServiceContext()->getFastClockSource()->now());
+ _stateDoc.setStartAt(_serviceContext->getFastClockSource()->now());
return ExecutorFuture(**_scopedExecutor)
.then([this, self = shared_from_this(), stateDoc = _stateDoc] {
@@ -1700,7 +1700,7 @@ void TenantMigrationRecipientService::Instance::_startOplogFetcher() {
"tenantId"_attr = getTenantId(),
"donorMajorityOpTime"_attr = donorMajorityOpTime,
"startFetchOpTime"_attr = startFetchOpTime);
- const auto now = getGlobalServiceContext()->getFastClockSource()->now();
+ const auto now = _serviceContext->getFastClockSource()->now();
stdx::lock_guard lk(_mutex);
_excludeDonorHost(lk,
@@ -1835,7 +1835,7 @@ void TenantMigrationRecipientService::Instance::_oplogFetcherCallback(Status opl
"error"_attr = oplogFetcherStatus);
stdx::lock_guard lk(_mutex);
- const auto now = getGlobalServiceContext()->getFastClockSource()->now();
+ const auto now = _serviceContext->getFastClockSource()->now();
_excludeDonorHost(lk,
_client->getServerHostAndPort(),
now + Milliseconds(tenantMigrationExcludeDonorHostTimeoutMS));
@@ -2153,7 +2153,7 @@ void TenantMigrationRecipientService::Instance::onMemberImportedFiles(
_membersWhoHaveImportedFiles.insert(host);
// Not reconfig-safe, we must not do a reconfig concurrent with a migration.
if (static_cast<int>(_membersWhoHaveImportedFiles.size()) ==
- repl::ReplicationCoordinator::get(getGlobalServiceContext())
+ repl::ReplicationCoordinator::get(_serviceContext)
->getConfig()
.getNumDataBearingMembers()) {
LOGV2_INFO(6112809,
@@ -2182,7 +2182,7 @@ SemiFuture<void> TenantMigrationRecipientService::Instance::_markStateDocAsGarba
}
_stateDoc.setState(TenantMigrationRecipientStateEnum::kDone);
- _stateDoc.setExpireAt(getGlobalServiceContext()->getFastClockSource()->now() +
+ _stateDoc.setExpireAt(_serviceContext->getFastClockSource()->now() +
Milliseconds{repl::tenantMigrationGarbageCollectionDelayMS.load()});
return ExecutorFuture(**_scopedExecutor)
@@ -2555,7 +2555,7 @@ void TenantMigrationRecipientService::Instance::_setup() {
}();
_sharedData = std::make_unique<TenantMigrationSharedData>(
- getGlobalServiceContext()->getFastClockSource(), getMigrationUUID(), resumePhase);
+ _serviceContext->getFastClockSource(), getMigrationUUID(), resumePhase);
_createOplogBuffer(lk, opCtx);
}
diff --git a/src/mongo/db/s/resharding/resharding_coordinator_service.cpp b/src/mongo/db/s/resharding/resharding_coordinator_service.cpp
index 6586961d4d6..00a5310b176 100644
--- a/src/mongo/db/s/resharding/resharding_coordinator_service.cpp
+++ b/src/mongo/db/s/resharding/resharding_coordinator_service.cpp
@@ -982,7 +982,8 @@ std::shared_ptr<repl::PrimaryOnlyService::Instance> ReshardingCoordinatorService
this,
ReshardingCoordinatorDocument::parse(IDLParserErrorContext("ReshardingCoordinatorStateDoc"),
std::move(initialState)),
- std::make_shared<ReshardingCoordinatorExternalStateImpl>());
+ std::make_shared<ReshardingCoordinatorExternalStateImpl>(),
+ _serviceContext);
}
ExecutorFuture<void> ReshardingCoordinatorService::_rebuildService(
@@ -1028,11 +1029,13 @@ void ReshardingCoordinatorService::abortAllReshardCollection(OperationContext* o
ReshardingCoordinatorService::ReshardingCoordinator::ReshardingCoordinator(
const ReshardingCoordinatorService* coordinatorService,
const ReshardingCoordinatorDocument& coordinatorDoc,
- std::shared_ptr<ReshardingCoordinatorExternalState> externalState)
+ std::shared_ptr<ReshardingCoordinatorExternalState> externalState,
+ ServiceContext* serviceContext)
: PrimaryOnlyService::TypedInstance<ReshardingCoordinator>(),
_id(coordinatorDoc.getReshardingUUID().toBSON()),
_coordinatorService(coordinatorService),
- _metrics{ReshardingMetrics::initializeFrom(coordinatorDoc, getGlobalServiceContext())},
+ _serviceContext(serviceContext),
+ _metrics{ReshardingMetrics::initializeFrom(coordinatorDoc, _serviceContext)},
_metadata(coordinatorDoc.getCommonReshardingMetadata()),
_coordinatorDoc(coordinatorDoc),
_markKilledExecutor(std::make_shared<ThreadPool>([] {
diff --git a/src/mongo/db/s/resharding/resharding_coordinator_service.h b/src/mongo/db/s/resharding/resharding_coordinator_service.h
index ace6e3e1c66..1dc006cafe1 100644
--- a/src/mongo/db/s/resharding/resharding_coordinator_service.h
+++ b/src/mongo/db/s/resharding/resharding_coordinator_service.h
@@ -34,6 +34,7 @@
#include "mongo/db/s/resharding/coordinator_document_gen.h"
#include "mongo/db/s/resharding/resharding_coordinator_observer.h"
#include "mongo/db/s/resharding/resharding_metrics.h"
+#include "mongo/db/service_context.h"
#include "mongo/platform/mutex.h"
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_collection.h"
@@ -195,7 +196,7 @@ public:
static constexpr StringData kServiceName = "ReshardingCoordinatorService"_sd;
explicit ReshardingCoordinatorService(ServiceContext* serviceContext)
- : PrimaryOnlyService(serviceContext) {}
+ : PrimaryOnlyService(serviceContext), _serviceContext(serviceContext) {}
~ReshardingCoordinatorService() = default;
class ReshardingCoordinator;
@@ -234,6 +235,8 @@ public:
private:
ExecutorFuture<void> _rebuildService(std::shared_ptr<executor::ScopedTaskExecutor> executor,
const CancellationToken& token) override;
+
+ ServiceContext* _serviceContext;
};
class ReshardingCoordinatorService::ReshardingCoordinator final
@@ -242,7 +245,8 @@ public:
explicit ReshardingCoordinator(
const ReshardingCoordinatorService* coordinatorService,
const ReshardingCoordinatorDocument& coordinatorDoc,
- std::shared_ptr<ReshardingCoordinatorExternalState> externalState);
+ std::shared_ptr<ReshardingCoordinatorExternalState> externalState,
+ ServiceContext* serviceContext);
~ReshardingCoordinator() = default;
SemiFuture<void> run(std::shared_ptr<executor::ScopedTaskExecutor> executor,
@@ -515,6 +519,8 @@ private:
// The primary-only service instance corresponding to the coordinator instance. Not owned.
const ReshardingCoordinatorService* const _coordinatorService;
+ ServiceContext* _serviceContext;
+
std::shared_ptr<ReshardingMetrics> _metrics;
// The in-memory representation of the immutable portion of the document in
diff --git a/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp b/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp
index 54b686ef632..fc4c6b722d9 100644
--- a/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_coordinator_service_test.cpp
@@ -44,6 +44,7 @@
#include "mongo/db/s/resharding/resharding_service_test_helpers.h"
#include "mongo/db/s/resharding/resharding_util.h"
#include "mongo/db/s/transaction_coordinator_service.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/session_catalog_mongod.h"
#include "mongo/idl/server_parameter_test_util.h"
#include "mongo/logv2/log.h"
@@ -110,15 +111,19 @@ class ExternalStateForTest : public ReshardingCoordinatorExternalState {
class ReshardingCoordinatorServiceForTest : public ReshardingCoordinatorService {
public:
explicit ReshardingCoordinatorServiceForTest(ServiceContext* serviceContext)
- : ReshardingCoordinatorService(serviceContext) {}
+ : ReshardingCoordinatorService(serviceContext), _serviceContext(serviceContext) {}
std::shared_ptr<PrimaryOnlyService::Instance> constructInstance(BSONObj initialState) override {
return std::make_shared<ReshardingCoordinator>(
this,
ReshardingCoordinatorDocument::parse(
IDLParserErrorContext("ReshardingCoordinatorStateDoc"), std::move(initialState)),
- std::make_shared<ExternalStateForTest>());
+ std::make_shared<ExternalStateForTest>(),
+ _serviceContext);
}
+
+private:
+ ServiceContext* _serviceContext;
};
class ReshardingCoordinatorServiceTest : public ConfigServerTestFixture {
diff --git a/src/mongo/db/s/resharding/resharding_donor_service.cpp b/src/mongo/db/s/resharding/resharding_donor_service.cpp
index 9bc249cd378..ac4f30d216c 100644
--- a/src/mongo/db/s/resharding/resharding_donor_service.cpp
+++ b/src/mongo/db/s/resharding/resharding_donor_service.cpp
@@ -204,16 +204,19 @@ std::shared_ptr<repl::PrimaryOnlyService::Instance> ReshardingDonorService::cons
return std::make_shared<DonorStateMachine>(
this,
ReshardingDonorDocument::parse({"DonorStateMachine"}, initialState),
- std::make_unique<ExternalStateImpl>());
+ std::make_unique<ExternalStateImpl>(),
+ _serviceContext);
}
ReshardingDonorService::DonorStateMachine::DonorStateMachine(
const ReshardingDonorService* donorService,
const ReshardingDonorDocument& donorDoc,
- std::unique_ptr<DonorStateMachineExternalState> externalState)
+ std::unique_ptr<DonorStateMachineExternalState> externalState,
+ ServiceContext* serviceContext)
: repl::PrimaryOnlyService::TypedInstance<DonorStateMachine>(),
_donorService(donorService),
- _metrics{ReshardingMetrics::initializeFrom(donorDoc, getGlobalServiceContext())},
+ _serviceContext(serviceContext),
+ _metrics{ReshardingMetrics::initializeFrom(donorDoc, _serviceContext)},
_metadata{donorDoc.getCommonReshardingMetadata()},
_recipientShardIds{donorDoc.getRecipientShards()},
_donorCtx{donorDoc.getMutableState()},
@@ -231,7 +234,7 @@ ReshardingDonorService::DonorStateMachine::DonorStateMachine(
<< "resharding_donor"
<< "collection" << _metadata.getSourceNss().toString())),
_isAlsoRecipient([&] {
- auto myShardId = _externalState->myShardId(getGlobalServiceContext());
+ auto myShardId = _externalState->myShardId(_serviceContext);
return std::find(_recipientShardIds.begin(), _recipientShardIds.end(), myShardId) !=
_recipientShardIds.end();
}()) {
diff --git a/src/mongo/db/s/resharding/resharding_donor_service.h b/src/mongo/db/s/resharding/resharding_donor_service.h
index db19a0eec8e..9bf06760f82 100644
--- a/src/mongo/db/s/resharding/resharding_donor_service.h
+++ b/src/mongo/db/s/resharding/resharding_donor_service.h
@@ -33,6 +33,7 @@
#include "mongo/db/repl/primary_only_service.h"
#include "mongo/db/s/resharding/donor_document_gen.h"
#include "mongo/db/s/resharding/resharding_metrics.h"
+#include "mongo/db/service_context.h"
#include "mongo/s/resharding/type_collection_fields_gen.h"
namespace mongo {
@@ -42,7 +43,7 @@ public:
static constexpr StringData kServiceName = "ReshardingDonorService"_sd;
explicit ReshardingDonorService(ServiceContext* serviceContext)
- : PrimaryOnlyService(serviceContext) {}
+ : PrimaryOnlyService(serviceContext), _serviceContext(serviceContext) {}
~ReshardingDonorService() = default;
class DonorStateMachine;
@@ -66,6 +67,9 @@ public:
const std::vector<const Instance*>& existingInstances) override {}
std::shared_ptr<PrimaryOnlyService::Instance> constructInstance(BSONObj initialState) override;
+
+private:
+ ServiceContext* _serviceContext;
};
/**
@@ -77,7 +81,8 @@ class ReshardingDonorService::DonorStateMachine final
public:
explicit DonorStateMachine(const ReshardingDonorService* donorService,
const ReshardingDonorDocument& donorDoc,
- std::unique_ptr<DonorStateMachineExternalState> externalState);
+ std::unique_ptr<DonorStateMachineExternalState> externalState,
+ ServiceContext* serviceContext);
~DonorStateMachine() = default;
@@ -220,6 +225,8 @@ private:
// The primary-only service instance corresponding to the donor instance. Not owned.
const ReshardingDonorService* const _donorService;
+ ServiceContext* const _serviceContext;
+
std::unique_ptr<ReshardingMetrics> _metrics;
// The in-memory representation of the immutable portion of the document in
diff --git a/src/mongo/db/s/resharding/resharding_donor_service_test.cpp b/src/mongo/db/s/resharding/resharding_donor_service_test.cpp
index 604e171bbb4..92f848d2d17 100644
--- a/src/mongo/db/s/resharding/resharding_donor_service_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_donor_service_test.cpp
@@ -51,6 +51,7 @@
#include "mongo/db/s/resharding/resharding_donor_service.h"
#include "mongo/db/s/resharding/resharding_service_test_helpers.h"
#include "mongo/db/s/resharding/resharding_util.h"
+#include "mongo/db/service_context.h"
#include "mongo/logv2/log.h"
#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/unittest/death_test.h"
@@ -104,14 +105,18 @@ public:
class ReshardingDonorServiceForTest : public ReshardingDonorService {
public:
explicit ReshardingDonorServiceForTest(ServiceContext* serviceContext)
- : ReshardingDonorService(serviceContext) {}
+ : ReshardingDonorService(serviceContext), _serviceContext(serviceContext) {}
std::shared_ptr<PrimaryOnlyService::Instance> constructInstance(BSONObj initialState) override {
return std::make_shared<DonorStateMachine>(
this,
ReshardingDonorDocument::parse({"ReshardingDonorServiceForTest"}, initialState),
- std::make_unique<ExternalStateForTest>());
+ std::make_unique<ExternalStateForTest>(),
+ _serviceContext);
}
+
+private:
+ ServiceContext* _serviceContext;
};
class ReshardingDonorServiceTest : public repl::PrimaryOnlyServiceMongoDTest {
diff --git a/src/mongo/db/s/resharding/resharding_recipient_service.cpp b/src/mongo/db/s/resharding/resharding_recipient_service.cpp
index b0f40e06551..21b3042fef6 100644
--- a/src/mongo/db/s/resharding/resharding_recipient_service.cpp
+++ b/src/mongo/db/s/resharding/resharding_recipient_service.cpp
@@ -180,17 +180,20 @@ std::shared_ptr<repl::PrimaryOnlyService::Instance> ReshardingRecipientService::
this,
ReshardingRecipientDocument::parse({"RecipientStateMachine"}, initialState),
std::make_unique<RecipientStateMachineExternalStateImpl>(),
- ReshardingDataReplication::make);
+ ReshardingDataReplication::make,
+ _serviceContext);
}
ReshardingRecipientService::RecipientStateMachine::RecipientStateMachine(
const ReshardingRecipientService* recipientService,
const ReshardingRecipientDocument& recipientDoc,
std::unique_ptr<RecipientStateMachineExternalState> externalState,
- ReshardingDataReplicationFactory dataReplicationFactory)
+ ReshardingDataReplicationFactory dataReplicationFactory,
+ ServiceContext* serviceContext)
: repl::PrimaryOnlyService::TypedInstance<RecipientStateMachine>(),
_recipientService{recipientService},
- _metrics{ReshardingMetrics::initializeFrom(recipientDoc, getGlobalServiceContext())},
+ _serviceContext(serviceContext),
+ _metrics{ReshardingMetrics::initializeFrom(recipientDoc, _serviceContext)},
_metadata{recipientDoc.getCommonReshardingMetadata()},
_minimumOperationDuration{Milliseconds{recipientDoc.getMinimumOperationDurationMillis()}},
_recipientCtx{recipientDoc.getMutableState()},
@@ -210,7 +213,7 @@ ReshardingRecipientService::RecipientStateMachine::RecipientStateMachine(
<< "resharding_recipient"
<< "collection" << _metadata.getSourceNss().toString())),
_isAlsoDonor([&]() {
- auto myShardId = _externalState->myShardId(getGlobalServiceContext());
+ auto myShardId = _externalState->myShardId(_serviceContext);
return std::find_if(_donorShards.begin(),
_donorShards.end(),
[&](const DonorShardFetchTimestamp& donor) {
diff --git a/src/mongo/db/s/resharding/resharding_recipient_service.h b/src/mongo/db/s/resharding/resharding_recipient_service.h
index b6717a2080c..8ccf3938ebf 100644
--- a/src/mongo/db/s/resharding/resharding_recipient_service.h
+++ b/src/mongo/db/s/resharding/resharding_recipient_service.h
@@ -36,6 +36,7 @@
#include "mongo/db/s/resharding/resharding_metrics.h"
#include "mongo/db/s/resharding/resharding_oplog_applier_metrics.h"
#include "mongo/db/s/resharding/resharding_util.h"
+#include "mongo/db/service_context.h"
#include "mongo/s/resharding/type_collection_fields_gen.h"
#include "mongo/util/concurrency/thread_pool.h"
@@ -46,7 +47,7 @@ public:
static constexpr StringData kServiceName = "ReshardingRecipientService"_sd;
explicit ReshardingRecipientService(ServiceContext* serviceContext)
- : PrimaryOnlyService(serviceContext) {}
+ : PrimaryOnlyService(serviceContext), _serviceContext(serviceContext) {}
~ReshardingRecipientService() = default;
class RecipientStateMachine;
@@ -76,6 +77,9 @@ public:
OperationContext* opCtx) {
return getAllInstances(opCtx);
}
+
+private:
+ ServiceContext* _serviceContext;
};
/**
@@ -108,7 +112,8 @@ public:
const ReshardingRecipientService* recipientService,
const ReshardingRecipientDocument& recipientDoc,
std::unique_ptr<RecipientStateMachineExternalState> externalState,
- ReshardingDataReplicationFactory dataReplicationFactory);
+ ReshardingDataReplicationFactory dataReplicationFactory,
+ ServiceContext* serviceContext);
~RecipientStateMachine() = default;
@@ -291,6 +296,8 @@ private:
// The primary-only service instance corresponding to the recipient instance. Not owned.
const ReshardingRecipientService* const _recipientService;
+ ServiceContext* _serviceContext;
+
std::unique_ptr<ReshardingMetrics> _metrics;
ReshardingApplierMetricsMap _applierMetricsMap;
diff --git a/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp b/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp
index 191cd76c2c6..26217cee42f 100644
--- a/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp
@@ -47,6 +47,7 @@
#include "mongo/db/s/resharding/resharding_recipient_service.h"
#include "mongo/db/s/resharding/resharding_recipient_service_external_state.h"
#include "mongo/db/s/resharding/resharding_service_test_helpers.h"
+#include "mongo/db/service_context.h"
#include "mongo/idl/server_parameter_test_util.h"
#include "mongo/logv2/log.h"
#include "mongo/unittest/death_test.h"
@@ -196,7 +197,7 @@ public:
class ReshardingRecipientServiceForTest : public ReshardingRecipientService {
public:
explicit ReshardingRecipientServiceForTest(ServiceContext* serviceContext)
- : ReshardingRecipientService(serviceContext) {}
+ : ReshardingRecipientService(serviceContext), _serviceContext(serviceContext) {}
std::shared_ptr<repl::PrimaryOnlyService::Instance> constructInstance(
BSONObj initialState) override {
@@ -204,8 +205,12 @@ public:
this,
ReshardingRecipientDocument::parse({"ReshardingRecipientServiceForTest"}, initialState),
std::make_unique<ExternalStateForTest>(),
- [](auto...) { return std::make_unique<DataReplicationForTest>(); });
+ [](auto...) { return std::make_unique<DataReplicationForTest>(); },
+ _serviceContext);
}
+
+private:
+ ServiceContext* _serviceContext;
};
/**