summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordi Serra Torrens <jordi.serra-torrens@mongodb.com>2023-04-19 14:25:23 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-21 10:47:54 +0000
commit59c38fbccc7961e7f62cf8f75ce383d71ae06832 (patch)
tree1ce8b3fc5d8197d21f0a27055d9b11edb885245d
parent9492eecdf7aa22b3455d802d288820e0083ebd7c (diff)
downloadmongo-59c38fbccc7961e7f62cf8f75ce383d71ae06832.tar.gz
SERVER-76273 Make SessionCatalogMigrationDestination's opCtxs interruptible on stepdown
(cherry picked from commit 2049bdcaf27aa5a06b8c7b3c552d7b19e303b3c5)
-rw-r--r--src/mongo/db/s/session_catalog_migration_destination.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/s/session_catalog_migration_destination.cpp b/src/mongo/db/s/session_catalog_migration_destination.cpp
index 5ea8c1f5413..ae9eec23cc2 100644
--- a/src/mongo/db/s/session_catalog_migration_destination.cpp
+++ b/src/mongo/db/s/session_catalog_migration_destination.cpp
@@ -287,6 +287,7 @@ void SessionCatalogMigrationDestination::_retrieveSessionStateFromSource(Service
auto uniqueCtx = CancelableOperationContext(
cc().makeOperationContext(), _cancellationToken, executor);
auto opCtx = uniqueCtx.get();
+ opCtx->setAlwaysInterruptAtStepDownOrUp_UNSAFE();
nextBatch = getNextSessionOplogBatch(opCtx, _fromShard, _migrationSessionId);
oplogArray = BSONArray{nextBatch[kOplogField].Obj()};
@@ -367,6 +368,7 @@ void SessionCatalogMigrationDestination::_retrieveSessionStateFromSource(Service
auto executor = Grid::get(service)->getExecutorPool()->getFixedExecutor();
auto uniqueOpCtx =
CancelableOperationContext(cc().makeOperationContext(), _cancellationToken, executor);
+ uniqueOpCtx->setAlwaysInterruptAtStepDownOrUp_UNSAFE();
uassertStatusOK(
waitForWriteConcern(uniqueOpCtx.get(), lastResult.oplogTime, kMajorityWC, &unusedWCResult));
@@ -436,6 +438,8 @@ SessionCatalogMigrationDestination::_processSessionOplog(const BSONObj& oplogBSO
auto uniqueOpCtx =
CancelableOperationContext(cc().makeOperationContext(), cancellationToken, executor);
auto opCtx = uniqueOpCtx.get();
+ opCtx->setAlwaysInterruptAtStepDownOrUp_UNSAFE();
+
{
auto lk = stdx::lock_guard(*opCtx->getClient());
opCtx->setLogicalSessionId(result.sessionId);