@@ -3,13 +3,13 @@ Unified Test Format
3
3
===================
4
4
5
5
:Spec Title: Unified Test Format
6
- :Spec Version: 1.2.3
6
+ :Spec Version: 1.2.4
7
7
:Author: Jeremy Mikola
8
8
:Advisors: Prashant Mital, Isabel Atkinson, Thomas Reggi
9
9
:Status: Accepted
10
10
:Type: Standards
11
11
:Minimum Server Version: N/A
12
- :Last Modified: 2021-03-24
12
+ :Last Modified: 2021-04-08
13
13
14
14
.. contents ::
15
15
@@ -2635,22 +2635,34 @@ sections.
2635
2635
Terminating Open Transactions
2636
2636
`````````````````````````````
2637
2637
2638
- Open transactions can cause tests to block indiscriminately. Test runners SHOULD
2639
- terminate all open transactions at the start of a test suite and after each
2640
- failed test by killing all sessions in the cluster. Using the internal
2641
- MongoClient, execute the ``killAllSessions `` command on either the primary or,
2642
- if connected to a sharded cluster, all mongos servers.
2638
+ Open transactions can cause tests to block indiscriminately. When connected to
2639
+ MongoDB 3.6 or later, test runners SHOULD terminate all open transactions at the
2640
+ start of a test suite and after each failed test by killing all sessions in the
2641
+ cluster. Using the internal MongoClient, execute the ``killAllSessions `` command
2642
+ on either the primary or, if connected to a sharded cluster, all mongos servers.
2643
2643
2644
2644
For example::
2645
2645
2646
2646
db.adminCommand({
2647
2647
killAllSessions: []
2648
2648
});
2649
2649
2650
- The test runner MAY ignore any command failure with error Interrupted(11601) to
2651
- work around `SERVER-38335 `_.
2650
+ The test runner MAY ignore the following command failures:
2651
+
2652
+ - Interrupted(11601) to work around `SERVER-38335 `_.
2653
+ - Unauthorized(13) to work around `SERVER-54216 `_.
2654
+ - CommandNotFound(59) if the command is executed on a pre-3.6 server
2652
2655
2653
2656
.. _SERVER-38335 : https://jira.mongodb.org/browse/SERVER-38335
2657
+ .. _SERVER-54216 : https://jira.mongodb.org/browse/SERVER-54216
2658
+
2659
+ Note that Atlas, by design, does not allow database users to kill sessions
2660
+ belonging to other users. This makes it impossible to guarantee that an existing
2661
+ transaction will not block test execution. To work around this, test runners
2662
+ SHOULD either ignore Unauthorized(13) command failures or avoid calling
2663
+ ``killAllSessions `` altogether when connected to Atlas (e.g. by detecting
2664
+ ``mongodb.net `` in the hostname or allowing the test runner to be configured
2665
+ externally).
2654
2666
2655
2667
2656
2668
StaleDbVersion Errors on Sharded Clusters
@@ -2965,6 +2977,10 @@ spec changes developed in parallel or during the same release cycle.
2965
2977
Change Log
2966
2978
==========
2967
2979
2980
+ :2021-04-08: List additional error codes that may be ignored when calling
2981
+ ``killAllSessions `` and note that the command should not be called
2982
+ when connected to Atlas.
2983
+
2968
2984
:2021-03-22: Split ``serverApi `` into its own section. Note types for ``loop ``
2969
2985
operation arguments. Clarify how ``loop `` iterations are counted
2970
2986
for ``storeIterationsAsEntity ``.
0 commit comments