Skip to content

Commit 4ad7a4d

Browse files
committed
add txn and ddl behavior to prod considerations
1 parent f2b9916 commit 4ad7a4d

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

source/core/transactions-production-consideration.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,36 @@ transaction operations.
6363

6464
.. include:: /includes/extracts/transactions-operations-catalog-tip.rst
6565

66+
.. _txn-prod-considerations-ddl:
67+
68+
Pending DDL Operations and Transactions
69+
---------------------------------------
70+
71+
If a multi-document transaction is in progress, new DDL operations that
72+
affect the same database(s) wait behind the transaction. While these
73+
pending DDL operations exist, new transactions that access the same
74+
database as the pending DDL operations cannot obtain the required locks
75+
and will abort after waiting
76+
:parameter:`maxTransactionLockRequestTimeoutMillis`. In addition, new
77+
non-transaction operations that access the same database will block
78+
until they reach their ``maxTimeMS`` limit.
79+
80+
To illustrate, compare the following two situations:
81+
82+
Consider a situation where an in-progress transaction performs various
83+
CRUD operations on the ``employees`` collection in the ``hr`` database.
84+
While that transaction is in progress, a separate transaction that
85+
accesses the ``foobar`` collection in the ``hr`` database can start and
86+
complete.
87+
88+
However, consider a situation where an in-progress transaction performs
89+
various CRUD operations on the ``employees`` collection in the ``hr``
90+
database and a separate DDL operation is issued to create an index on
91+
the ``fluffy`` collection in the ``hr`` database. The DDL operation
92+
waits for the transaction to finish.
93+
94+
While the DDL operation is pending, a new transaction attempts to
95+
access the ``foobar`` collection in the ``hr`` database. If the DDL
96+
operation remains pending for
97+
:parameter:`maxTransactionLockRequestTimeoutMillis`, the new
98+
transaction aborts.

source/core/transactions.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ Restricted Operations
119119

120120
.. include:: /includes/extracts/transactions-operations-restrictions.rst
121121

122+
.. seealso:: :ref:`txn-prod-considerations-ddl`
123+
122124
Transactions and Security
123125
-------------------------
124126

@@ -352,7 +354,6 @@ transaction commit at the transaction start.
352354
:readconcern:`"majority"` read concern provides no guarantees that
353355
read operations read majority-committed data.
354356

355-
356357
Transactions and Locks
357358
----------------------
358359

0 commit comments

Comments
 (0)