Skip to content

Commit 0364ae7

Browse files
committed
tweak txn: comment out intro examples for now since duplciate of retry examples and need to incorporate mongo shell examples
1 parent 4498525 commit 0364ae7

File tree

5 files changed

+72
-42
lines changed

5 files changed

+72
-42
lines changed

source/core/transactions.txt

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -134,39 +134,21 @@ Transactions and Security
134134
If using ``$external`` authentication users (i.e. Kerberos, LDAP,
135135
x.509 users), the usernames cannot be greater than 10k bytes.
136136

137-
Transactions and Locks
138-
----------------------
139-
140-
By default, transactions waits ``5`` milliseconds to acquire locks
141-
required by the operations in the transaction. If the transaction
142-
cannot acquire its required locks within the ``5`` milliseconds, the
143-
transaction aborts.
144-
145-
.. include:: /includes/extracts/transactions-operations-catalog-tip.rst
146-
147-
You can use the :parameter:`maxTransactionLockRequestTimeoutMillis`
148-
parameter to adjust how long transactions wait to acquire locks.
149-
150-
You can also use operation-specific timeout by setting
151-
:parameter:`maxTransactionLockRequestTimeoutMillis` to ``-1``.
152-
153-
Transactions release all locks upon abort or commit.
154-
155137
Transactions and Sessions
156138
-------------------------
157139

158140
Transactions are associated with a session. That is, you start a
159141
transaction for a session. At any given time, you can have at most one
160142
open transaction for a session.
161143

162-
If a session ends and it has an open transaction, the transaction
163-
aborts.
164-
165144
.. important::
166145

167146
When using the drivers, you **must** pass the session to each
168-
operation in the transaction. For more information, see
169-
:ref:`transactions-drivers`.
147+
operation in the transaction.
148+
149+
If a session ends and it has an open transaction, the transaction
150+
aborts.
151+
170152

171153
.. _transactions-drivers:
172154

@@ -177,17 +159,11 @@ Clients require MongoDB drivers updated for MongoDB 4.0.
177159

178160
.. include:: /includes/list-4.0-drivers.rst
179161

180-
The following example assumes that the collections exists.
181-
182162
.. important::
183163

184-
To associate read and write operations with a transaction, you **must**
185-
pass the session to each operation in the transaction.
186-
187-
188-
.. include:: /includes/driver-examples/driver-example-transactions-intro-1.rst
189-
190-
Note that the session is passed to each operation in the transaction.
164+
To associate read and write operations with a transaction, you
165+
**must** pass the session to each operation in the transaction. For
166+
examples, see :ref:`transactions-retry`.
191167

192168
Transactions and the ``mongo`` Shell
193169
------------------------------------
@@ -376,6 +352,25 @@ transaction commit at the transaction start.
376352
:readconcern:`"majority"` read concern provides no guarantees that
377353
read operations read majority-committed data.
378354

355+
356+
Transactions and Locks
357+
----------------------
358+
359+
By default, transactions waits ``5`` milliseconds to acquire locks
360+
required by the operations in the transaction. If the transaction
361+
cannot acquire its required locks within the ``5`` milliseconds, the
362+
transaction aborts.
363+
364+
.. include:: /includes/extracts/transactions-operations-catalog-tip.rst
365+
366+
You can use the :parameter:`maxTransactionLockRequestTimeoutMillis`
367+
parameter to adjust how long transactions wait to acquire locks.
368+
369+
You can also use operation-specific timeout by setting
370+
:parameter:`maxTransactionLockRequestTimeoutMillis` to ``-1``.
371+
372+
Transactions release all locks upon abort or commit.
373+
379374
.. toctree::
380375
:hidden:
381376
:titlesonly:

source/includes/driver-examples/driver-example-transactions-retry-1.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
3030
- id: python
3131
content: |
32+
33+
.. important::
34+
35+
To associate read and write operations with a transaction, you **must**
36+
pass the session to each operation in the transaction.
37+
3238
.. class:: copyable-code
3339
.. literalinclude:: /driver-examples/test_examples.py
3440
:language: python
@@ -38,8 +44,12 @@
3844

3945
- id: java-sync
4046
content: |
41-
.. code-block:: javascript
47+
.. important::
4248

49+
To associate read and write operations with a transaction, you **must**
50+
pass the session to each operation in the transaction.
51+
52+
.. code-block:: javascript
4353
4454
void runTransactionWithRetry(Runnable transactional) {
4555
while (true) {
@@ -61,6 +71,12 @@
6171
6272
- id: nodejs
6373
content: |
74+
75+
.. important::
76+
77+
To associate read and write operations with a transaction, you **must**
78+
pass the session to each operation in the transaction.
79+
6480
.. class:: copyable-code
6581
.. literalinclude:: /driver-examples/node-promises-examples.js
6682
:language: javascript

source/includes/driver-examples/driver-example-transactions-retry-2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
3030
- id: python
3131
content: |
32+
3233
.. class:: copyable-code
3334
.. literalinclude:: /driver-examples/test_examples.py
3435
:language: python

source/includes/driver-examples/driver-example-transactions-retry-3.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@
7979
8080
- id: python
8181
content: |
82+
.. important::
83+
84+
To associate read and write operations with a transaction, you **must**
85+
pass the session to each operation in the transaction.
86+
8287
.. class:: copyable-code
8388
.. literalinclude:: /driver-examples/test_examples.py
8489
:language: python
@@ -89,6 +94,11 @@
8994
- id: java-sync
9095
content: |
9196

97+
.. important::
98+
99+
To associate read and write operations with a transaction, you **must**
100+
pass the session to each operation in the transaction.
101+
92102
.. code-block:: java
93103
94104
void runTransactionWithRetry(Runnable transactional) {
@@ -153,6 +163,11 @@
153163
154164
- id: nodejs
155165
content: |
166+
.. important::
167+
168+
To associate read and write operations with a transaction, you **must**
169+
pass the session to each operation in the transaction.
170+
156171
.. class:: copyable-code
157172
.. literalinclude:: /driver-examples/node-promises-examples.js
158173
:language: javascript

source/includes/list-4.0-drivers.rst

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
- Java 3.8.0
1+
.. list-table::
2+
:class: index-table
23

3-
- Python 3.7.0
4+
* - Java 3.8.0
45

5-
- C 1.11.0
6+
Python 3.7.0
67

7-
- C# 2.7
8+
C 1.11.0
89

9-
- Node 3.1.0
10+
- C# 2.7
1011

11-
- Ruby 2.6.0
12+
Node 3.1.0
1213

13-
- Perl 2.0.0
14+
Ruby 2.6.0
1415

15-
- PHPC 1.5.0
16+
- Perl 2.0.0
1617

17-
- Scala 2.4.0
18+
PHPC 1.5.0
19+
20+
Scala 2.4.0

0 commit comments

Comments
 (0)