Skip to content

Commit 376b98a

Browse files
DRIVERS-1785: clarify ordering of CMAP events when pool is cleared (#1690)
1 parent 152257b commit 376b98a

File tree

9 files changed

+1093
-10
lines changed

9 files changed

+1093
-10
lines changed

source/connection-monitoring-and-pooling/tests/cmap-format/pool-create-min-size-error.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/connection-monitoring-and-pooling/tests/cmap-format/pool-create-min-size-error.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ events:
3030
address: 42
3131
- type: ConnectionCreated
3232
address: 42
33+
- type: ConnectionPoolCleared
34+
address: 42
3335
- type: ConnectionClosed
3436
address: 42
3537
connectionId: 42
3638
reason: error
37-
- type: ConnectionPoolCleared
38-
address: 42
3939
ignore:
4040
- ConnectionPoolCreated

source/server-discovery-and-monitoring/server-discovery-and-monitoring.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,11 +1241,11 @@ if and only if the error is "node is shutting down" or the error originated from
12411241
and [other transient errors](#other-transient-errors) and
12421242
[Why close connections when a node is shutting down?](#why-close-connections-when-a-node-is-shutting-down).)
12431243

1244-
##### Authentication errors
1244+
##### Authentication and Handshake errors
12451245

1246-
If the authentication handshake fails for a connection, drivers MUST mark the server Unknown and clear the server's
1247-
connection pool if the TopologyType is not LoadBalanced. (See
1248-
[Why mark a server Unknown after an auth error?](#why-mark-a-server-unknown-after-an-auth-error))
1246+
If the driver encounters errors when establishing application connections (this includes the initial handshake and
1247+
authentication), the driver MUST mark the server Unknown and clear the server's connection pool if the TopologyType is
1248+
not LoadBalanced. (See [Why mark a server Unknown after an auth error?](#why-mark-a-server-unknown-after-an-auth-error))
12491249

12501250
### Monitoring SDAM events
12511251

source/server-discovery-and-monitoring/tests/unified/pool-clear-application-error.json

Lines changed: 149 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
description: pool-clear-application-error
3+
4+
schemaVersion: "1.4"
5+
6+
runOnRequirements:
7+
# failCommand appName requirements
8+
- minServerVersion: "4.4"
9+
serverless: forbid
10+
topologies: [ single, replicaset, sharded ]
11+
12+
createEntities:
13+
- client:
14+
id: &setupClient setupClient
15+
useMultipleMongoses: false
16+
17+
initialData: &initialData
18+
- collectionName: &collectionName find-network-error
19+
databaseName: &databaseName sdam-tests
20+
documents:
21+
- _id: 1
22+
- _id: 2
23+
24+
tests:
25+
- description: Pool is cleared before application connection is checked into the pool
26+
operations:
27+
- name: failPoint
28+
object: testRunner
29+
arguments:
30+
client: *setupClient
31+
failPoint:
32+
configureFailPoint: failCommand
33+
mode:
34+
times: 1
35+
data:
36+
failCommands:
37+
- find
38+
closeConnection: true
39+
appName: findNetworkErrorTest
40+
- name: createEntities
41+
object: testRunner
42+
arguments:
43+
entities:
44+
- client:
45+
id: &client client
46+
useMultipleMongoses: false
47+
observeEvents:
48+
- poolClearedEvent
49+
- connectionCheckedInEvent
50+
uriOptions:
51+
retryWrites: false
52+
retryReads: false
53+
appname: findNetworkErrorTest
54+
- database:
55+
id: &database database
56+
client: *client
57+
databaseName: *databaseName
58+
- collection:
59+
id: &collection collection
60+
database: *database
61+
collectionName: *collectionName
62+
- name: find
63+
object: *collection
64+
arguments:
65+
filter:
66+
_id: 1
67+
expectError:
68+
isError: true
69+
- name: waitForEvent
70+
object: testRunner
71+
arguments:
72+
client: *client
73+
event:
74+
poolClearedEvent: {}
75+
count: 1
76+
- name: waitForEvent
77+
object: testRunner
78+
arguments:
79+
client: *client
80+
event:
81+
connectionCheckedInEvent: {}
82+
count: 1
83+
expectEvents:
84+
- client: *client
85+
eventType: cmap
86+
events:
87+
- poolClearedEvent: {}
88+
- connectionCheckedInEvent: {}

0 commit comments

Comments
 (0)