Skip to content

Commit

Permalink
SPEC-1298 Add "connectionError" as a valid reason for ConnectionCheck…
Browse files Browse the repository at this point in the history
…OutFailedEvent (#561)

Add a prose test for ConnectionCheckOutFailedEvent(reason="connectionError")
Add a spec test for ConnectionCheckOutFailedEvent(reason="poolClosed")
  • Loading branch information
ShaneHarvey committed Jul 4, 2019
1 parent 21fcfb1 commit ef782f2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 12 deletions.
Expand Up @@ -9,8 +9,8 @@ Connection Monitoring and Pooling
:Status: Accepted
:Type: Standards
:Minimum Server Version: N/A
:Last Modified: January 22, 2019
:Version: 1.0.0
:Last Modified: June 11, 2019
:Version: 1.1.0

.. contents::

Expand Down Expand Up @@ -401,12 +401,16 @@ A Connection MUST NOT be checked out until it is readyToUse. In addition, the Po
# This must be done in all drivers
leave wait queue
# If the connection has not been connected yet, the connection
# (TCP, TLS, handshake, compression, and auth) must be performed
# before the connection is returned. This MUST NOT block other threads
# from acquiring connections.
if connection is not readyToUse:
# If the connection has not been connected yet, the connection
# (TCP, TLS, handshake, compression, and auth) must be performed
# before the connection is returned. This MUST NOT block other threads
# from acquiring connections.
if connection is not readyToUse:
try:
set up connection
except set up connection error:
emit ConnectionCheckOutFailedEvent(reason="error")
throw
mark connection as in use
emit ConnectionCheckedOutEvent
Expand Down Expand Up @@ -598,8 +602,9 @@ Events
* A reason explaining why connection check out failed.
* Can be implemented as a string or enum.
* Current valid values are:
* - "poolClosed": The pool was previously closed, and cannot provide new connections
* - "timeout": The connection check out attempt exceeded the specified timeout
* - "poolClosed": The pool was previously closed, and cannot provide new connections
* - "timeout": The connection check out attempt exceeded the specified timeout
* - "connectionError": The connection check out attempt experienced an error while setting up a new connection
*/
reason: string|Enum;
}
Expand Down Expand Up @@ -729,3 +734,8 @@ Add support for OP_MSG exhaustAllowed

Exhaust Cursors may require changes to how we close connections in the future, specifically to add a way to close and remove from its pool a connection which has unread exhaust messages.


Change log
==========

:2019-06-06: Add "connectionError" as a valid reason for ConnectionCheckOutFailedEvent
2 changes: 2 additions & 0 deletions source/connection-monitoring-and-pooling/tests/README.rst
Expand Up @@ -154,3 +154,5 @@ The following tests have not yet been automated, but MUST still be tested
#. All ConnectionPoolOptions MUST be the same for all pools created by a MongoClient
#. A user MUST be able to specify all ConnectionPoolOptions via a URI string
#. A user MUST be able to subscribe to Connection Monitoring Events in a manner idiomatic to their language and driver
#. When a check out attempt fails because connection set up throws an error,
assert that a ConnectionCheckOutFailedEvent with reason="connectionError" is emitted.
Expand Up @@ -28,23 +28,37 @@
"address": 42,
"options": 42
},
{
"type": "ConnectionCheckOutStarted",
"address": 42
},
{
"type": "ConnectionCheckedOut",
"address": 42,
"connectionId": 42
},
{
"type": "ConnectionCheckedIn",
"address": 42,
"connectionId": 42
},
{
"type": "ConnectionPoolClosed",
"address": 42
},
{
"type": "ConnectionCheckOutStarted",
"address": 42
},
{
"type": "ConnectionCheckOutFailed",
"address": 42,
"reason": "poolClosed"
}
],
"ignore": [
"ConnectionCreated",
"ConnectionReady",
"ConnectionClosed",
"ConnectionCheckOutStarted"
"ConnectionClosed"
]
}
Expand Up @@ -15,14 +15,22 @@ events:
- type: ConnectionPoolCreated
address: 42
options: 42
- type: ConnectionCheckOutStarted
address: 42
- type: ConnectionCheckedOut
address: 42
connectionId: 42
- type: ConnectionCheckedIn
address: 42
connectionId: 42
- type: ConnectionPoolClosed
address: 42
- type: ConnectionCheckOutStarted
address: 42
- type: ConnectionCheckOutFailed
address: 42
reason: poolClosed
ignore:
- ConnectionCreated
- ConnectionReady
- ConnectionClosed
- ConnectionCheckOutStarted

0 comments on commit ef782f2

Please sign in to comment.