summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishnu Kaushik <vishnu.kaushik@mongodb.com>2021-06-21 17:12:36 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-21 22:34:30 +0000
commit2d0a51a52385cb01e4bba0170270daaa349cc99b (patch)
tree45dc6bc092eb3157b7109f7628c07601ec25e541
parent89ed94739e87e5378f663c196a16790feb95abb3 (diff)
downloadmongo-2d0a51a52385cb01e4bba0170270daaa349cc99b.tar.gz
SERVER-57877 TenantOplogApplier operations must be interruptible on step down / step up
-rw-r--r--src/mongo/db/repl/tenant_oplog_applier.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/repl/tenant_oplog_applier.cpp b/src/mongo/db/repl/tenant_oplog_applier.cpp
index 32dec4dbe1a..7ca766859e9 100644
--- a/src/mongo/db/repl/tenant_oplog_applier.cpp
+++ b/src/mongo/db/repl/tenant_oplog_applier.cpp
@@ -411,6 +411,10 @@ TenantOplogApplier::OpTimePair TenantOplogApplier::_writeNoOpEntries(
// All other oplog entries.
std::vector<TenantNoOpEntry> nonSessionOps;
+ // The 'opCtx' must be interruptible on stepdown and stepup to avoid a deadlock situation with
+ // the RSTL.
+ opCtx->setAlwaysInterruptAtStepDownOrUp();
+
// Prevent the node from being able to change state when reserving oplog slots and writing
// entries.
AutoGetOplog oplogWrite(opCtx, OplogAccessMode::kWrite);
@@ -531,6 +535,8 @@ void TenantOplogApplier::_writeSessionNoOpsForRange(
// forward.
repl::ReplClientInfo::forClient(opCtx->getClient()).clearLastOp();
+ opCtx->setAlwaysInterruptAtStepDownOrUp();
+
// All the ops will have the same session, so we can retain the scopedSession throughout
// the loop, except when invalidated by multi-document transactions. This allows us to
// track the statements in a retryable write.
@@ -845,6 +851,8 @@ void TenantOplogApplier::_writeNoOpsForRange(OpObserver* opObserver,
// forward.
repl::ReplClientInfo::forClient(opCtx->getClient()).clearLastOp();
+ opCtx->setAlwaysInterruptAtStepDownOrUp();
+
AutoGetOplog oplogWrite(opCtx.get(), OplogAccessMode::kWrite);
writeConflictRetry(
opCtx.get(), "writeTenantNoOps", NamespaceString::kRsOplogNamespace.ns(), [&] {