Skip to content

Commit 2e19107

Browse files
committed
chore: add spec changes
1 parent 44df7d7 commit 2e19107

File tree

387 files changed

+5270
-901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

387 files changed

+5270
-901
lines changed

test/spec/server-discovery-and-monitoring/errors/error_handling_handshake.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"a:27017",
1010
{
1111
"ok": 1,
12-
"ismaster": true,
12+
"helloOk": true,
13+
"isWritablePrimary": true,
1314
"hosts": [
1415
"a:27017"
1516
],

test/spec/server-discovery-and-monitoring/errors/error_handling_handshake.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ phases:
55
responses:
66
- - a:27017
77
- ok: 1
8-
ismaster: true
8+
helloOk: true
9+
isWritablePrimary: true
910
hosts:
1011
- a:27017
1112
setName: rs

test/spec/server-discovery-and-monitoring/errors/generate-error-tests.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ def write_test(filename, data):
3535
ERR_CODES = {
3636
'InterruptedAtShutdown': (11600,),
3737
'InterruptedDueToReplStateChange': (11602,),
38-
'NotMasterOrSecondary': (13436,),
38+
'NotPrimaryOrSecondary': (13436,),
3939
'PrimarySteppedDown': (189,),
4040
'ShutdownInProgress': (91,),
41-
'NotMaster': (10107,),
42-
'NotMasterNoSlaveOk': (13435,),
41+
'NotWritablePrimary': (10107,),
42+
'NotPrimaryNoSecondaryOk': (13435,),
43+
'LegacyNotPrimary': (10058,),
4344
}
4445

4546

@@ -129,6 +130,7 @@ def create_stale_generation_tests():
129130
# Stale network errors
130131
for network_error_type, when in itertools.product(
131132
['network', 'timeout'], WHEN):
133+
error_name = network_error_type
132134
test_name = f'stale-generation-{when}-{network_error_type}'
133135
stale_error = STALE_GENERATION_NETWORK_ERROR.format(**locals())
134136
data = tmp.format(**locals())
@@ -137,7 +139,7 @@ def create_stale_generation_tests():
137139

138140
def create_pre_42_tests():
139141
tmp = template('pre-42.yml.template')
140-
# All "not master"/"node is recovering" clear the pool on <4.2
142+
# All "not writable primary"/"node is recovering" clear the pool on <4.2
141143
for error_name in ERR_CODES:
142144
test_name = f'pre-42-{error_name}'
143145
error_code, = ERR_CODES[error_name]

test/spec/server-discovery-and-monitoring/errors/non-stale-network-error.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"a:27017",
1010
{
1111
"ok": 1,
12-
"ismaster": true,
12+
"helloOk": true,
13+
"isWritablePrimary": true,
1314
"hosts": [
1415
"a:27017"
1516
],

test/spec/server-discovery-and-monitoring/errors/non-stale-network-error.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ phases:
55
responses:
66
- - a:27017
77
- ok: 1
8-
ismaster: true
8+
helloOk: true
9+
isWritablePrimary: true
910
hosts:
1011
- a:27017
1112
setName: rs

test/spec/server-discovery-and-monitoring/errors/non-stale-network-timeout-error.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"a:27017",
1010
{
1111
"ok": 1,
12-
"ismaster": true,
12+
"helloOk": true,
13+
"isWritablePrimary": true,
1314
"hosts": [
1415
"a:27017"
1516
],

test/spec/server-discovery-and-monitoring/errors/non-stale-network-timeout-error.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ phases:
55
responses:
66
- - a:27017
77
- ok: 1
8-
ismaster: true
8+
helloOk: true
9+
isWritablePrimary: true
910
hosts:
1011
- a:27017
1112
setName: rs

test/spec/server-discovery-and-monitoring/errors/non-stale-topologyVersion-greater-InterruptedAtShutdown.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"a:27017",
1010
{
1111
"ok": 1,
12-
"ismaster": true,
12+
"helloOk": true,
13+
"isWritablePrimary": true,
1314
"hosts": [
1415
"a:27017"
1516
],

test/spec/server-discovery-and-monitoring/errors/non-stale-topologyVersion-greater-InterruptedAtShutdown.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ phases:
66
responses:
77
- - a:27017
88
- ok: 1
9-
ismaster: true
9+
helloOk: true
10+
isWritablePrimary: true
1011
hosts:
1112
- a:27017
1213
setName: rs

test/spec/server-discovery-and-monitoring/errors/non-stale-topologyVersion-greater-InterruptedDueToReplStateChange.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"a:27017",
1010
{
1111
"ok": 1,
12-
"ismaster": true,
12+
"helloOk": true,
13+
"isWritablePrimary": true,
1314
"hosts": [
1415
"a:27017"
1516
],

test/spec/server-discovery-and-monitoring/errors/non-stale-topologyVersion-greater-InterruptedDueToReplStateChange.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ phases:
66
responses:
77
- - a:27017
88
- ok: 1
9-
ismaster: true
9+
helloOk: true
10+
isWritablePrimary: true
1011
hosts:
1112
- a:27017
1213
setName: rs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"description": "Non-stale topologyVersion greater LegacyNotPrimary error",
3+
"uri": "mongodb://a/?replicaSet=rs",
4+
"phases": [
5+
{
6+
"description": "Primary A is discovered",
7+
"responses": [
8+
[
9+
"a:27017",
10+
{
11+
"ok": 1,
12+
"helloOk": true,
13+
"isWritablePrimary": true,
14+
"hosts": [
15+
"a:27017"
16+
],
17+
"setName": "rs",
18+
"minWireVersion": 0,
19+
"maxWireVersion": 9,
20+
"topologyVersion": {
21+
"processId": {
22+
"$oid": "000000000000000000000001"
23+
},
24+
"counter": {
25+
"$numberLong": "1"
26+
}
27+
}
28+
}
29+
]
30+
],
31+
"outcome": {
32+
"servers": {
33+
"a:27017": {
34+
"type": "RSPrimary",
35+
"setName": "rs",
36+
"topologyVersion": {
37+
"processId": {
38+
"$oid": "000000000000000000000001"
39+
},
40+
"counter": {
41+
"$numberLong": "1"
42+
}
43+
},
44+
"pool": {
45+
"generation": 0
46+
}
47+
}
48+
},
49+
"topologyType": "ReplicaSetWithPrimary",
50+
"logicalSessionTimeoutMinutes": null,
51+
"setName": "rs"
52+
}
53+
},
54+
{
55+
"description": "Non-stale topologyVersion greater LegacyNotPrimary error marks server Unknown",
56+
"applicationErrors": [
57+
{
58+
"address": "a:27017",
59+
"when": "afterHandshakeCompletes",
60+
"maxWireVersion": 9,
61+
"type": "command",
62+
"response": {
63+
"ok": 0,
64+
"errmsg": "LegacyNotPrimary",
65+
"code": 10058,
66+
"topologyVersion": {
67+
"processId": {
68+
"$oid": "000000000000000000000001"
69+
},
70+
"counter": {
71+
"$numberLong": "2"
72+
}
73+
}
74+
}
75+
}
76+
],
77+
"outcome": {
78+
"servers": {
79+
"a:27017": {
80+
"type": "Unknown",
81+
"topologyVersion": {
82+
"processId": {
83+
"$oid": "000000000000000000000001"
84+
},
85+
"counter": {
86+
"$numberLong": "2"
87+
}
88+
},
89+
"pool": {
90+
"generation": 0
91+
}
92+
}
93+
},
94+
"topologyType": "ReplicaSetNoPrimary",
95+
"logicalSessionTimeoutMinutes": null,
96+
"setName": "rs"
97+
}
98+
}
99+
]
100+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Autogenerated tests for SDAM error handling, see generate-error-tests.py
2+
description: Non-stale topologyVersion greater LegacyNotPrimary error
3+
uri: mongodb://a/?replicaSet=rs
4+
phases:
5+
- description: Primary A is discovered
6+
responses:
7+
- - a:27017
8+
- ok: 1
9+
helloOk: true
10+
isWritablePrimary: true
11+
hosts:
12+
- a:27017
13+
setName: rs
14+
minWireVersion: 0
15+
maxWireVersion: 9
16+
topologyVersion: &topologyVersion_1_1
17+
processId:
18+
"$oid": '000000000000000000000001'
19+
counter:
20+
"$numberLong": '1'
21+
outcome: &outcome
22+
servers:
23+
a:27017:
24+
type: RSPrimary
25+
setName: rs
26+
topologyVersion: *topologyVersion_1_1
27+
pool:
28+
generation: 0
29+
topologyType: ReplicaSetWithPrimary
30+
logicalSessionTimeoutMinutes: null
31+
setName: rs
32+
33+
- description: Non-stale topologyVersion greater LegacyNotPrimary error marks server Unknown
34+
applicationErrors:
35+
- address: a:27017
36+
when: afterHandshakeCompletes
37+
maxWireVersion: 9
38+
type: command
39+
response:
40+
ok: 0
41+
errmsg: LegacyNotPrimary
42+
code: 10058
43+
topologyVersion:
44+
processId:
45+
"$oid": '000000000000000000000001'
46+
counter:
47+
"$numberLong": "2"
48+
outcome:
49+
servers:
50+
a:27017:
51+
type: Unknown
52+
topologyVersion:
53+
processId:
54+
"$oid": '000000000000000000000001'
55+
counter:
56+
"$numberLong": "2"
57+
pool:
58+
generation: 0
59+
topologyType: ReplicaSetNoPrimary
60+
logicalSessionTimeoutMinutes: null
61+
setName: rs
+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "Non-stale topologyVersion greater NotMasterNoSlaveOk error",
2+
"description": "Non-stale topologyVersion greater NotPrimaryNoSecondaryOk error",
33
"uri": "mongodb://a/?replicaSet=rs",
44
"phases": [
55
{
@@ -9,7 +9,8 @@
99
"a:27017",
1010
{
1111
"ok": 1,
12-
"ismaster": true,
12+
"helloOk": true,
13+
"isWritablePrimary": true,
1314
"hosts": [
1415
"a:27017"
1516
],
@@ -51,7 +52,7 @@
5152
}
5253
},
5354
{
54-
"description": "Non-stale topologyVersion greater NotMasterNoSlaveOk error marks server Unknown",
55+
"description": "Non-stale topologyVersion greater NotPrimaryNoSecondaryOk error marks server Unknown",
5556
"applicationErrors": [
5657
{
5758
"address": "a:27017",
@@ -60,7 +61,7 @@
6061
"type": "command",
6162
"response": {
6263
"ok": 0,
63-
"errmsg": "NotMasterNoSlaveOk",
64+
"errmsg": "NotPrimaryNoSecondaryOk",
6465
"code": 13435,
6566
"topologyVersion": {
6667
"processId": {
+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Autogenerated tests for SDAM error handling, see generate-error-tests.py
2-
description: Non-stale topologyVersion greater NotMasterNoSlaveOk error
2+
description: Non-stale topologyVersion greater NotPrimaryNoSecondaryOk error
33
uri: mongodb://a/?replicaSet=rs
44
phases:
55
- description: Primary A is discovered
66
responses:
77
- - a:27017
88
- ok: 1
9-
ismaster: true
9+
helloOk: true
10+
isWritablePrimary: true
1011
hosts:
1112
- a:27017
1213
setName: rs
@@ -29,15 +30,15 @@ phases:
2930
logicalSessionTimeoutMinutes: null
3031
setName: rs
3132

32-
- description: Non-stale topologyVersion greater NotMasterNoSlaveOk error marks server Unknown
33+
- description: Non-stale topologyVersion greater NotPrimaryNoSecondaryOk error marks server Unknown
3334
applicationErrors:
3435
- address: a:27017
3536
when: afterHandshakeCompletes
3637
maxWireVersion: 9
3738
type: command
3839
response:
3940
ok: 0
40-
errmsg: NotMasterNoSlaveOk
41+
errmsg: NotPrimaryNoSecondaryOk
4142
code: 13435
4243
topologyVersion:
4344
processId:
+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "Non-stale topologyVersion greater NotMasterOrSecondary error",
2+
"description": "Non-stale topologyVersion greater NotPrimaryOrSecondary error",
33
"uri": "mongodb://a/?replicaSet=rs",
44
"phases": [
55
{
@@ -9,7 +9,8 @@
99
"a:27017",
1010
{
1111
"ok": 1,
12-
"ismaster": true,
12+
"helloOk": true,
13+
"isWritablePrimary": true,
1314
"hosts": [
1415
"a:27017"
1516
],
@@ -51,7 +52,7 @@
5152
}
5253
},
5354
{
54-
"description": "Non-stale topologyVersion greater NotMasterOrSecondary error marks server Unknown",
55+
"description": "Non-stale topologyVersion greater NotPrimaryOrSecondary error marks server Unknown",
5556
"applicationErrors": [
5657
{
5758
"address": "a:27017",
@@ -60,7 +61,7 @@
6061
"type": "command",
6162
"response": {
6263
"ok": 0,
63-
"errmsg": "NotMasterOrSecondary",
64+
"errmsg": "NotPrimaryOrSecondary",
6465
"code": 13436,
6566
"topologyVersion": {
6667
"processId": {

0 commit comments

Comments
 (0)