Skip to content

Commit 5d5946e

Browse files
p-mongop
andauthored
Fix SPEC-1517 Drivers must run SDAM flow even when server description is equal to the last one (#722)
* Fix SPEC-1517 Drivers must run SDAM flow even when server description is equal to the last one * fix numbering * update changelog * Redistribute new language * Add changelog * Revert "Add changelog" This reverts commit d103c5a. * Revert "Redistribute new language" This reverts commit 65b5e6c. * Revert "update changelog" This reverts commit ff5e660. * remove section per comments * remove rationale per comments * remove wrong spec test * Commit the right test * Remove language relating to topology description equality * Add changelog Co-authored-by: Oleg Pudeyev <p@users.noreply.github.com>
1 parent 356c828 commit 5d5946e

File tree

3 files changed

+249
-14
lines changed

3 files changed

+249
-14
lines changed

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Server Discovery And Monitoring
88
:Advisors: David Golden, Craig Wilson
99
:Status: Accepted
1010
:Type: Standards
11-
:Version: 2.14
12-
:Last Modified: 2019-07-11
11+
:Version: 2.15
12+
:Last Modified: 2020-02-13
1313

1414
.. contents::
1515

@@ -850,19 +850,13 @@ are parsed from the ismaster response in the obvious way.
850850
Server Description Equality
851851
```````````````````````````
852852

853-
For the purposes of updating topology description and publishing SDAM events,
854-
two server descriptions having the same address
855-
MUST be considered equal if and only if the values of
856-
`ServerDescription`_ fields marked (=) are respectively equal.
853+
For the purpose of determining whether to publish SDAM events, two server
854+
descriptions having the same address MUST be considered equal if and only if
855+
the values of `ServerDescription`_ fields marked (=) are respectively equal.
857856

858857
This specification does not prescribe how to compare server descriptions
859858
with different addresses for equality.
860859

861-
Note: Server description for each server MUST be updated (replaced)
862-
every heartbeat. However, new description MUST NOT cause the SDAM flow
863-
to be executed if the new description is equal, as defined in this section,
864-
to the previous description.
865-
866860
Updating the TopologyDescription
867861
''''''''''''''''''''''''''''''''
868862

@@ -957,9 +951,6 @@ the client updates the "compatible" and "compatibilityError" fields
957951
as described above for TopologyType Single.
958952
Otherwise "compatible" is set to true.
959953

960-
If the new server description is equal to the previous server description
961-
as defined in `Server Description Equality`_, stop the processing.
962-
963954
It is possible for a multi-threaded client to receive an ismaster outcome
964955
from a server after the server has been removed from the TopologyDescription.
965956
For example, a monitor begins checking a server "A",
@@ -2440,3 +2431,6 @@ to auto-retry.
24402431
authentication.
24412432

24422433
2019-05-29: Renamed InterruptedDueToStepDown to InterruptedDueToReplStateChange
2434+
2435+
2020-02-13: Drivers must run SDAM flow even when server description is equal
2436+
to the last one.
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
{
2+
"description": "Repeated ismaster response must be processed",
3+
"uri": "mongodb://a,b/?replicaSet=rs",
4+
"phases": [
5+
{
6+
"responses": [
7+
[
8+
"a:27017",
9+
{
10+
"ok": 1,
11+
"ismaster": false,
12+
"secondary": true,
13+
"hidden": true,
14+
"hosts": [
15+
"a:27017",
16+
"c:27017"
17+
],
18+
"setName": "rs",
19+
"minWireVersion": 0,
20+
"maxWireVersion": 6
21+
}
22+
]
23+
],
24+
"outcome": {
25+
"servers": {
26+
"a:27017": {
27+
"type": "RSOther",
28+
"setName": "rs"
29+
},
30+
"b:27017": {
31+
"type": "Unknown"
32+
},
33+
"c:27017": {
34+
"type": "Unknown"
35+
}
36+
},
37+
"topologyType": "ReplicaSetNoPrimary",
38+
"logicalSessionTimeoutMinutes": null,
39+
"setName": "rs"
40+
}
41+
},
42+
{
43+
"responses": [
44+
[
45+
"c:27017",
46+
{
47+
"ok": 1,
48+
"ismaster": true,
49+
"minWireVersion": 0,
50+
"maxWireVersion": 6
51+
}
52+
]
53+
],
54+
"outcome": {
55+
"servers": {
56+
"a:27017": {
57+
"type": "RSOther",
58+
"setName": "rs"
59+
},
60+
"b:27017": {
61+
"type": "Unknown"
62+
}
63+
},
64+
"topologyType": "ReplicaSetNoPrimary",
65+
"logicalSessionTimeoutMinutes": null,
66+
"setName": "rs"
67+
}
68+
},
69+
{
70+
"responses": [
71+
[
72+
"a:27017",
73+
{
74+
"ok": 1,
75+
"ismaster": false,
76+
"secondary": true,
77+
"hidden": true,
78+
"hosts": [
79+
"a:27017",
80+
"c:27017"
81+
],
82+
"setName": "rs",
83+
"minWireVersion": 0,
84+
"maxWireVersion": 6
85+
}
86+
]
87+
],
88+
"outcome": {
89+
"servers": {
90+
"a:27017": {
91+
"type": "RSOther",
92+
"setName": "rs"
93+
},
94+
"b:27017": {
95+
"type": "Unknown"
96+
},
97+
"c:27017": {
98+
"type": "Unknown"
99+
}
100+
},
101+
"topologyType": "ReplicaSetNoPrimary",
102+
"logicalSessionTimeoutMinutes": null,
103+
"setName": "rs"
104+
}
105+
},
106+
{
107+
"responses": [
108+
[
109+
"c:27017",
110+
{
111+
"ok": 1,
112+
"ismaster": true,
113+
"hosts": [
114+
"a:27017",
115+
"c:27017"
116+
],
117+
"setName": "rs",
118+
"minWireVersion": 0,
119+
"maxWireVersion": 6
120+
}
121+
]
122+
],
123+
"outcome": {
124+
"servers": {
125+
"a:27017": {
126+
"type": "RSOther",
127+
"setName": "rs"
128+
},
129+
"c:27017": {
130+
"type": "RSPrimary",
131+
"setName": "rs"
132+
}
133+
},
134+
"topologyType": "ReplicaSetWithPrimary",
135+
"logicalSessionTimeoutMinutes": null,
136+
"setName": "rs"
137+
}
138+
}
139+
]
140+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
description: Repeated ismaster response must be processed
2+
3+
uri: "mongodb://a,b/?replicaSet=rs"
4+
5+
phases:
6+
# Phase 1 - a says it's not primary and suggests c may be the primary
7+
- responses:
8+
-
9+
- "a:27017"
10+
- ok: 1
11+
ismaster: false
12+
secondary: true
13+
hidden: true
14+
hosts: ["a:27017", "c:27017"]
15+
setName: "rs"
16+
minWireVersion: 0
17+
maxWireVersion: 6
18+
outcome:
19+
servers:
20+
"a:27017":
21+
type: "RSOther"
22+
setName: "rs"
23+
24+
"b:27017":
25+
type: Unknown
26+
27+
"c:27017":
28+
type: Unknown
29+
topologyType: "ReplicaSetNoPrimary"
30+
logicalSessionTimeoutMinutes: ~
31+
setName: "rs"
32+
33+
# Phase 2 - c says it's a standalone, is removed
34+
- responses:
35+
-
36+
- "c:27017"
37+
- ok: 1
38+
ismaster: true
39+
minWireVersion: 0
40+
maxWireVersion: 6
41+
outcome:
42+
servers:
43+
"a:27017":
44+
type: "RSOther"
45+
setName: "rs"
46+
47+
"b:27017":
48+
type: Unknown
49+
topologyType: "ReplicaSetNoPrimary"
50+
logicalSessionTimeoutMinutes: ~
51+
setName: "rs"
52+
53+
# Phase 3 - response from a is repeated, and must be processed; c added again
54+
- responses:
55+
-
56+
- "a:27017"
57+
- ok: 1
58+
ismaster: false
59+
secondary: true
60+
hidden: true
61+
hosts: ["a:27017", "c:27017"]
62+
setName: "rs"
63+
minWireVersion: 0
64+
maxWireVersion: 6
65+
outcome:
66+
servers:
67+
"a:27017":
68+
type: "RSOther"
69+
setName: "rs"
70+
71+
"b:27017":
72+
type: Unknown
73+
74+
"c:27017":
75+
type: Unknown
76+
topologyType: "ReplicaSetNoPrimary"
77+
logicalSessionTimeoutMinutes: ~
78+
setName: "rs"
79+
80+
# Phase 4 - c is now a primary
81+
- responses:
82+
-
83+
- "c:27017"
84+
- ok: 1
85+
ismaster: true
86+
hosts: ["a:27017", "c:27017"]
87+
setName: "rs"
88+
minWireVersion: 0
89+
maxWireVersion: 6
90+
outcome:
91+
servers:
92+
"a:27017":
93+
type: "RSOther"
94+
setName: "rs"
95+
96+
"c:27017":
97+
type: RSPrimary
98+
setName: rs
99+
topologyType: "ReplicaSetWithPrimary"
100+
logicalSessionTimeoutMinutes: ~
101+
setName: "rs"

0 commit comments

Comments
 (0)