summaryrefslogtreecommitdiff
path: root/src/mongo/db/s
diff options
context:
space:
mode:
authorGeorge Wangensteen <george.wangensteen@mongodb.com>2020-12-04 04:19:56 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-04 07:10:14 +0000
commitda77452821c355346d873a6b31160c101adc60de (patch)
tree31bd1abd879bbfe2755fc927be7dfed947eae606 /src/mongo/db/s
parent24223334fac1d746f8483cb10eacc4d95e7fcf7c (diff)
downloadmongo-da77452821c355346d873a6b31160c101adc60de.tar.gz
SERVER-50656 Add cancellation support to WaitForMajorityService
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r--src/mongo/db/s/collection_sharding_runtime_test.cpp2
-rw-r--r--src/mongo/db/s/migration_util_test.cpp2
-rw-r--r--src/mongo/db/s/range_deletion_util.cpp2
-rw-r--r--src/mongo/db/s/range_deletion_util_test.cpp2
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp1
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h2
-rw-r--r--src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp2
-rw-r--r--src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp2
-rw-r--r--src/mongo/db/s/resharding_destined_recipient_test.cpp2
-rw-r--r--src/mongo/db/s/transaction_coordinator.cpp5
-rw-r--r--src/mongo/db/s/transaction_coordinator_test_fixture.cpp2
11 files changed, 13 insertions, 11 deletions
diff --git a/src/mongo/db/s/collection_sharding_runtime_test.cpp b/src/mongo/db/s/collection_sharding_runtime_test.cpp
index 1779b75b60b..db87d219711 100644
--- a/src/mongo/db/s/collection_sharding_runtime_test.cpp
+++ b/src/mongo/db/s/collection_sharding_runtime_test.cpp
@@ -188,7 +188,7 @@ class CollectionShardingRuntimeWithRangeDeleterTest : public CollectionShardingR
public:
void setUp() override {
ShardServerTestFixture::setUp();
- WaitForMajorityService::get(getServiceContext()).setUp(getServiceContext());
+ WaitForMajorityService::get(getServiceContext()).startup(getServiceContext());
// Set up replication coordinator to be primary and have no replication delay.
auto replCoord = std::make_unique<repl::ReplicationCoordinatorMock>(getServiceContext());
replCoord->setCanAcceptNonLocalWrites(true);
diff --git a/src/mongo/db/s/migration_util_test.cpp b/src/mongo/db/s/migration_util_test.cpp
index fbe7cf9a40d..1058c7e83a0 100644
--- a/src/mongo/db/s/migration_util_test.cpp
+++ b/src/mongo/db/s/migration_util_test.cpp
@@ -349,7 +349,7 @@ public:
configTargeterMock()->setFindHostReturnValue(kConfigHostAndPort);
- WaitForMajorityService::get(getServiceContext()).setUp(getServiceContext());
+ WaitForMajorityService::get(getServiceContext()).startup(getServiceContext());
// Set up 2 default shards.
for (const auto& shard : kShardList) {
diff --git a/src/mongo/db/s/range_deletion_util.cpp b/src/mongo/db/s/range_deletion_util.cpp
index 1c2189e7177..1468b2a74c9 100644
--- a/src/mongo/db/s/range_deletion_util.cpp
+++ b/src/mongo/db/s/range_deletion_util.cpp
@@ -407,7 +407,7 @@ ExecutorFuture<void> waitForDeletionsToMajorityReplicate(
// Asynchronously wait for majority write concern.
return WaitForMajorityService::get(opCtx->getServiceContext())
- .waitUntilMajority(clientOpTime)
+ .waitUntilMajority(clientOpTime, CancelationToken::uncancelable())
.thenRunOn(executor);
});
}
diff --git a/src/mongo/db/s/range_deletion_util_test.cpp b/src/mongo/db/s/range_deletion_util_test.cpp
index 12b5e11546d..94088b7751a 100644
--- a/src/mongo/db/s/range_deletion_util_test.cpp
+++ b/src/mongo/db/s/range_deletion_util_test.cpp
@@ -57,7 +57,7 @@ public:
void setUp() override {
ShardServerTestFixture::setUp();
- WaitForMajorityService::get(getServiceContext()).setUp(getServiceContext());
+ WaitForMajorityService::get(getServiceContext()).startup(getServiceContext());
// Set up replication coordinator to be primary and have no replication delay.
auto replCoord = std::make_unique<repl::ReplicationCoordinatorMock>(getServiceContext());
replCoord->setCanAcceptNonLocalWrites(true);
diff --git a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp
index a582302f029..686fb22b23e 100644
--- a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp
@@ -76,7 +76,6 @@ TEST_F(ReshardingDonorRecipientCommonInternalsTest,
assertRecipientDocMatchesReshardingFields(metadata, reshardingFields, recipientDoc);
}
-
TEST_F(ReshardingDonorRecipientCommonTest, CreateDonorServiceInstance) {
OperationContext* opCtx = operationContext();
auto metadata = makeShardedMetadataForOriginalCollection(opCtx, kThisShard);
diff --git a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h
index a0bdb181523..2e7ef3c48b2 100644
--- a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h
+++ b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h
@@ -212,7 +212,7 @@ public:
void setUp() override {
ShardServerTestFixture::setUp();
- WaitForMajorityService::get(getServiceContext()).setUp(getServiceContext());
+ WaitForMajorityService::get(getServiceContext()).startup(getServiceContext());
_registry = repl::PrimaryOnlyServiceRegistry::get(getServiceContext());
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 2b9aed54b82..4e8189d6238 100644
--- a/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp
@@ -104,7 +104,7 @@ public:
shardTargeter->setFindHostReturnValue(makeHostAndPort(shardId));
}
- WaitForMajorityService::get(getServiceContext()).setUp(getServiceContext());
+ WaitForMajorityService::get(getServiceContext()).startup(getServiceContext());
// onStepUp() relies on the storage interface to create the config.transactions table.
repl::StorageInterface::set(getServiceContext(),
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 db10b0a6bf6..36d05e65692 100644
--- a/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp
@@ -114,7 +114,7 @@ class ReshardingTxnClonerTest : public ShardServerTestFixture {
shardTargeter->setFindHostReturnValue(makeHostAndPort(shardId));
}
- WaitForMajorityService::get(getServiceContext()).setUp(getServiceContext());
+ WaitForMajorityService::get(getServiceContext()).startup(getServiceContext());
// onStepUp() relies on the storage interface to create the config.transactions table.
repl::StorageInterface::set(getServiceContext(),
diff --git a/src/mongo/db/s/resharding_destined_recipient_test.cpp b/src/mongo/db/s/resharding_destined_recipient_test.cpp
index 7f64d66cdbd..4fe39db2dcb 100644
--- a/src/mongo/db/s/resharding_destined_recipient_test.cpp
+++ b/src/mongo/db/s/resharding_destined_recipient_test.cpp
@@ -105,7 +105,7 @@ public:
configTargeterMock()->setFindHostReturnValue(kConfigHostAndPort);
- WaitForMajorityService::get(getServiceContext()).setUp(getServiceContext());
+ WaitForMajorityService::get(getServiceContext()).startup(getServiceContext());
for (const auto& shard : kShardList) {
std::unique_ptr<RemoteCommandTargeterMock> targeter(
diff --git a/src/mongo/db/s/transaction_coordinator.cpp b/src/mongo/db/s/transaction_coordinator.cpp
index 1e84a79aee2..384e4cffeda 100644
--- a/src/mongo/db/s/transaction_coordinator.cpp
+++ b/src/mongo/db/s/transaction_coordinator.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/vector_clock_mutable.h"
#include "mongo/logv2/log.h"
#include "mongo/s/grid.h"
+#include "mongo/util/cancelation.h"
#include "mongo/util/fail_point.h"
namespace mongo {
@@ -58,7 +59,9 @@ ExecutorFuture<void> waitForMajorityWithHangFailpoint(ServiceContext* service,
repl::OpTime opTime) {
auto executor = Grid::get(service)->getExecutorPool()->getFixedExecutor();
auto waitForWC = [service, executor](repl::OpTime opTime) {
- return WaitForMajorityService::get(service).waitUntilMajority(opTime).thenRunOn(executor);
+ return WaitForMajorityService::get(service)
+ .waitUntilMajority(opTime, CancelationToken::uncancelable())
+ .thenRunOn(executor);
};
if (auto sfp = failpoint.scoped(); MONGO_unlikely(sfp.isActive())) {
diff --git a/src/mongo/db/s/transaction_coordinator_test_fixture.cpp b/src/mongo/db/s/transaction_coordinator_test_fixture.cpp
index 560dc51524b..0beec9178f4 100644
--- a/src/mongo/db/s/transaction_coordinator_test_fixture.cpp
+++ b/src/mongo/db/s/transaction_coordinator_test_fixture.cpp
@@ -66,7 +66,7 @@ void TransactionCoordinatorTestFixture::setUp() {
shardTargeter->setFindHostReturnValue(makeHostAndPort(shardId));
}
- WaitForMajorityService::get(getServiceContext()).setUp(getServiceContext());
+ WaitForMajorityService::get(getServiceContext()).startup(getServiceContext());
}
void TransactionCoordinatorTestFixture::tearDown() {