summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/repl/replication_consistency_markers_impl.cpp7
-rw-r--r--src/mongo/db/s/transaction_coordinator_util.cpp5
2 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/repl/replication_consistency_markers_impl.cpp b/src/mongo/db/repl/replication_consistency_markers_impl.cpp
index df8c3ebdd6d..e7151875651 100644
--- a/src/mongo/db/repl/replication_consistency_markers_impl.cpp
+++ b/src/mongo/db/repl/replication_consistency_markers_impl.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/catalog/collection_options.h"
#include "mongo/db/catalog_raii.h"
#include "mongo/db/concurrency/d_concurrency.h"
+#include "mongo/db/concurrency/lock_state.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/replication_coordinator.h"
@@ -498,6 +499,12 @@ ReplicationConsistencyMarkersImpl::refreshOplogTruncateAfterPointIfPrimary(
}
ON_BLOCK_EXIT([&] { opCtx->recoveryUnit()->setPrepareConflictBehavior(originalBehavior); });
+ // Exempt storage ticket acquisition in order to avoid starving upstream requests waiting
+ // for durability. SERVER-60682 is an example with more pending prepared transactions than
+ // storage tickets; the transaction coordinator could not persist the decision and
+ // had to unnecessarily wait for prepared transactions to expire to make forward progress.
+ SkipTicketAcquisitionForLock skipTicketAcquisition(opCtx);
+
// The locks necessary to write to the oplog truncate after point's collection and read from the
// oplog collection must be taken up front so that the mutex can also be taken around both
// operations without causing deadlocks.
diff --git a/src/mongo/db/s/transaction_coordinator_util.cpp b/src/mongo/db/s/transaction_coordinator_util.cpp
index 0bc0d019c6c..8fa377734ef 100644
--- a/src/mongo/db/s/transaction_coordinator_util.cpp
+++ b/src/mongo/db/s/transaction_coordinator_util.cpp
@@ -36,6 +36,7 @@
#include "mongo/client/remote_command_retry_scheduler.h"
#include "mongo/db/commands/txn_cmds_gen.h"
#include "mongo/db/commands/txn_two_phase_commit_cmds_gen.h"
+#include "mongo/db/concurrency/lock_state.h"
#include "mongo/db/curop.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/ops/write_ops.h"
@@ -411,6 +412,10 @@ Future<repl::OpTime> persistDecision(txn::AsyncWorkScheduler& scheduler,
return scheduler.scheduleWork(
[lsid, txnNumber, participants, decision](OperationContext* opCtx) {
FlowControl::Bypass flowControlBypass(opCtx);
+ // Do not acquire a storage ticket in order to avoid unnecessary serialization
+ // with other prepared transactions that are holding a storage ticket
+ // themselves; see SERVER-60682.
+ SkipTicketAcquisitionForLock skipTicketAcquisition(opCtx);
getTransactionCoordinatorWorkerCurOpRepository()->set(
opCtx, lsid, txnNumber, CoordinatorAction::kWritingDecision);
return persistDecisionBlocking(opCtx, lsid, txnNumber, participants, decision);