mongo 2.18.0 → 2.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mongo/bulk_write.rb +7 -5
- data/lib/mongo/client.rb +1 -1
- data/lib/mongo/collection/view/writable.rb +0 -2
- data/lib/mongo/collection.rb +150 -45
- data/lib/mongo/crypt/auto_encrypter.rb +30 -9
- data/lib/mongo/crypt/binding.rb +93 -1
- data/lib/mongo/crypt/explicit_encrypter.rb +5 -1
- data/lib/mongo/crypt/handle.rb +33 -0
- data/lib/mongo/crypt/kms.rb +0 -1
- data/lib/mongo/cursor.rb +6 -1
- data/lib/mongo/error/invalid_read_option.rb +1 -1
- data/lib/mongo/operation/aggregate.rb +1 -2
- data/lib/mongo/operation/collections_info.rb +3 -15
- data/lib/mongo/operation/command.rb +1 -2
- data/lib/mongo/operation/count.rb +1 -2
- data/lib/mongo/operation/create.rb +1 -2
- data/lib/mongo/operation/create_index.rb +1 -2
- data/lib/mongo/operation/create_user.rb +1 -2
- data/lib/mongo/operation/delete.rb +0 -1
- data/lib/mongo/operation/distinct.rb +1 -2
- data/lib/mongo/operation/drop.rb +1 -2
- data/lib/mongo/operation/drop_database.rb +1 -2
- data/lib/mongo/operation/drop_index.rb +1 -2
- data/lib/mongo/operation/explain.rb +1 -3
- data/lib/mongo/operation/find/builder.rb +0 -1
- data/lib/mongo/operation/find.rb +1 -3
- data/lib/mongo/operation/get_more.rb +1 -3
- data/lib/mongo/operation/indexes.rb +1 -17
- data/lib/mongo/operation/insert.rb +0 -1
- data/lib/mongo/operation/kill_cursors.rb +1 -2
- data/lib/mongo/operation/list_collections.rb +1 -2
- data/lib/mongo/operation/map_reduce.rb +1 -2
- data/lib/mongo/operation/parallel_scan.rb +1 -2
- data/lib/mongo/operation/remove_user.rb +1 -2
- data/lib/mongo/operation/shared/{polymorphic_operation.rb → op_msg_executable.rb} +11 -6
- data/lib/mongo/operation/shared/sessions_supported.rb +7 -3
- data/lib/mongo/operation/update.rb +0 -1
- data/lib/mongo/operation/update_user.rb +1 -2
- data/lib/mongo/operation/users_info.rb +1 -2
- data/lib/mongo/operation/write_command.rb +1 -2
- data/lib/mongo/operation.rb +1 -3
- data/lib/mongo/protocol.rb +0 -3
- data/lib/mongo/query_cache.rb +20 -20
- data/lib/mongo/session.rb +1 -1
- data/lib/mongo/version.rb +1 -1
- data/spec/README.md +5 -1
- data/spec/integration/bulk_write_spec.rb +16 -0
- data/spec/integration/command_spec.rb +1 -23
- data/spec/integration/ocsp_verifier_spec.rb +2 -0
- data/spec/mongo/client_construction_spec.rb +4 -4
- data/spec/mongo/collection_crud_spec.rb +56 -0
- data/spec/mongo/collection_spec.rb +11 -1
- data/spec/mongo/crypt/auto_encrypter_spec.rb +41 -6
- data/spec/mongo/crypt/binding/version_spec.rb +8 -0
- data/spec/mongo/crypt/handle_spec.rb +102 -0
- data/spec/mongo/crypt/kms_spec.rb +12 -9
- data/spec/mongo/cursor_spec.rb +50 -0
- data/spec/shared/lib/mrss/event_subscriber.rb +15 -5
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-errorLabels.yml +3 -0
- data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey.yml +3 -3
- data/spec/spec_tests/data/sdam_integration/hello-command-error.yml +6 -14
- data/spec/spec_tests/data/sdam_integration/hello-network-error.yml +4 -14
- data/spec/spec_tests/data/sdam_integration/hello-timeout.yml +8 -14
- data/spec/spec_tests/data/transactions_unified/do-not-retry-read-in-transaction.yml +64 -0
- data/spec/spec_tests/data/transactions_unified/retryable-abort-handshake.yml +118 -0
- data/spec/spec_tests/data/transactions_unified/retryable-commit-handshake.yml +118 -0
- data/spec/support/certificates/retrieve-atlas-cert +38 -0
- data/spec/support/spec_config.rb +4 -0
- data.tar.gz.sig +0 -0
- metadata +1133 -1178
- metadata.gz.sig +0 -0
- data/lib/mongo/operation/aggregate/command.rb +0 -55
- data/lib/mongo/operation/collections_info/command.rb +0 -48
- data/lib/mongo/operation/command/command.rb +0 -41
- data/lib/mongo/operation/count/command.rb +0 -47
- data/lib/mongo/operation/create/command.rb +0 -47
- data/lib/mongo/operation/create_index/command.rb +0 -61
- data/lib/mongo/operation/create_user/command.rb +0 -46
- data/lib/mongo/operation/delete/command.rb +0 -52
- data/lib/mongo/operation/distinct/command.rb +0 -47
- data/lib/mongo/operation/drop/command.rb +0 -41
- data/lib/mongo/operation/drop_database/command.rb +0 -41
- data/lib/mongo/operation/drop_index/command.rb +0 -45
- data/lib/mongo/operation/explain/command.rb +0 -58
- data/lib/mongo/operation/explain/legacy.rb +0 -52
- data/lib/mongo/operation/find/builder/legacy.rb +0 -123
- data/lib/mongo/operation/find/command.rb +0 -51
- data/lib/mongo/operation/find/legacy/result.rb +0 -46
- data/lib/mongo/operation/find/legacy.rb +0 -52
- data/lib/mongo/operation/get_more/command.rb +0 -43
- data/lib/mongo/operation/get_more/legacy.rb +0 -39
- data/lib/mongo/operation/indexes/command.rb +0 -42
- data/lib/mongo/operation/indexes/legacy.rb +0 -48
- data/lib/mongo/operation/insert/command.rb +0 -55
- data/lib/mongo/operation/kill_cursors/command.rb +0 -48
- data/lib/mongo/operation/list_collections/command.rb +0 -46
- data/lib/mongo/operation/map_reduce/command.rb +0 -51
- data/lib/mongo/operation/parallel_scan/command.rb +0 -57
- data/lib/mongo/operation/remove_user/command.rb +0 -46
- data/lib/mongo/operation/shared/op_msg_or_command.rb +0 -41
- data/lib/mongo/operation/shared/op_msg_or_find_command.rb +0 -44
- data/lib/mongo/operation/update/command.rb +0 -53
- data/lib/mongo/operation/update_user/command.rb +0 -45
- data/lib/mongo/operation/users_info/command.rb +0 -46
- data/lib/mongo/operation/write_command/command.rb +0 -51
- data/lib/mongo/protocol/delete.rb +0 -172
- data/lib/mongo/protocol/insert.rb +0 -181
- data/lib/mongo/protocol/update.rb +0 -214
- data/spec/mongo/operation/delete/command_spec.rb +0 -115
- data/spec/mongo/operation/find/legacy_spec.rb +0 -131
- data/spec/mongo/operation/get_more_spec.rb +0 -63
- data/spec/mongo/operation/insert/command_spec.rb +0 -118
- data/spec/mongo/operation/update/command_spec.rb +0 -122
- data/spec/mongo/protocol/delete_spec.rb +0 -185
- data/spec/mongo/protocol/insert_spec.rb +0 -179
- data/spec/mongo/protocol/update_spec.rb +0 -204
@@ -745,6 +745,9 @@ tests:
|
|
745
745
|
databaseName: *database0
|
746
746
|
|
747
747
|
- description: change stream resumes after StaleShardVersion
|
748
|
+
runOnRequirements:
|
749
|
+
# StaleShardVersion is obsolete as of 6.1 and is no longer marked as resumable.
|
750
|
+
- maxServerVersion: "6.0.99"
|
748
751
|
operations:
|
749
752
|
- name: failPoint
|
750
753
|
object: testRunner
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# commands sort the resulting documents in ascending order by the single-element
|
3
3
|
# keyAltNames array to ensure alphabetic order by original KMS provider as
|
4
4
|
# defined in initialData.
|
5
|
-
description: rewrapManyDataKey
|
5
|
+
description: rewrapManyDataKey
|
6
6
|
|
7
7
|
schemaVersion: "1.8"
|
8
8
|
|
@@ -50,7 +50,7 @@ initialData:
|
|
50
50
|
region: us-east-1
|
51
51
|
- _id: &azure_key_id { $binary: { base64: YXp1cmVhenVyZWF6dXJlYQ==, subType: "04" } }
|
52
52
|
keyAltNames: ["azure_key"]
|
53
|
-
keyMaterial: { $binary: { base64:
|
53
|
+
keyMaterial: { $binary: { base64: pr01l7qDygUkFE/0peFwpnNlv3iIy8zrQK38Q9i12UCN2jwZHDmfyx8wokiIKMb9kAleeY+vnt3Cf1MKu9kcDmI+KxbNDd+V3ytAAGzOVLDJr77CiWjF9f8ntkXRHrAY9WwnVDANYkDwXlyU0Y2GQFTiW65jiQhUtYLYH63Tk48SsJuQvnWw1Q+PzY8ga+QeVec8wbcThwtm+r2IHsCFnc72Gv73qq7weISw+O4mN08z3wOp5FOS2ZM3MK7tBGmPdBcktW7F8ODGsOQ1FU53OrWUnyX2aTi2ftFFFMWVHqQo7EYuBZHru8RRODNKMyQk0BFfKovAeTAVRv9WH9QU7g==, subType: "00" } }
|
54
54
|
creationDate: { $date: { $numberLong: "1641024000000" } }
|
55
55
|
updateDate: { $date: { $numberLong: "1641024000000" } }
|
56
56
|
status: 1
|
@@ -72,7 +72,7 @@ initialData:
|
|
72
72
|
keyName: key-name-csfle
|
73
73
|
- _id: &kmip_key_id { $binary: { base64: a21pcGttaXBrbWlwa21pcA==, subType: "04" } }
|
74
74
|
keyAltNames: ["kmip_key"]
|
75
|
-
keyMaterial: { $binary: { base64:
|
75
|
+
keyMaterial: { $binary: { base64: CklVctHzke4mcytd0TxGqvepkdkQN8NUF4+jV7aZQITAKdz6WjdDpq3lMt9nSzWGG2vAEfvRb3mFEVjV57qqGqxjq2751gmiMRHXz0btStbIK3mQ5xbY9kdye4tsixlCryEwQONr96gwlwKKI9Nubl9/8+uRF6tgYjje7Q7OjauEf1SrJwKcoQ3WwnjZmEqAug0kImCpJ/irhdqPzivRiA==, subType: "00" } }
|
76
76
|
creationDate: { $date: { $numberLong: "1641024000000" } }
|
77
77
|
updateDate: { $date: { $numberLong: "1641024000000" } }
|
78
78
|
status: 1
|
@@ -86,9 +86,9 @@ tests:
|
|
86
86
|
documents:
|
87
87
|
- _id: 1
|
88
88
|
- _id: 2
|
89
|
-
# Configure the next streaming hello check to fail with a command
|
90
|
-
#
|
91
|
-
#
|
89
|
+
# Configure the next streaming hello check to fail with a command error.
|
90
|
+
# Must use "times: 2" here. For a longer on explanation on why, check out
|
91
|
+
# https://jira.mongodb.org/browse/RUBY-3050.
|
92
92
|
- name: configureFailPoint
|
93
93
|
object: testRunner
|
94
94
|
arguments:
|
@@ -121,17 +121,9 @@ tests:
|
|
121
121
|
documents:
|
122
122
|
- _id: 3
|
123
123
|
- _id: 4
|
124
|
-
#
|
125
|
-
|
126
|
-
|
127
|
-
arguments:
|
128
|
-
event: ServerMarkedUnknownEvent
|
129
|
-
count: 1
|
130
|
-
- name: assertEventCount
|
131
|
-
object: testRunner
|
132
|
-
arguments:
|
133
|
-
event: PoolClearedEvent
|
134
|
-
count: 1
|
124
|
+
# We cannot assert the server was marked Unknown and pool was cleared an
|
125
|
+
# exact number of times because the RTT hello may have triggered this
|
126
|
+
# failpoint one or many times as well.
|
135
127
|
|
136
128
|
expectations:
|
137
129
|
- command_started_event:
|
@@ -44,16 +44,6 @@ tests:
|
|
44
44
|
# We cannot assert the server was marked Unknown and pool was cleared an
|
45
45
|
# exact number of times because the RTT hello may or may not have
|
46
46
|
# triggered this failpoint as well.
|
47
|
-
# - name: assertEventCount
|
48
|
-
# object: testRunner
|
49
|
-
# arguments:
|
50
|
-
# event: ServerMarkedUnknownEvent
|
51
|
-
# count: 1
|
52
|
-
# - name: assertEventCount
|
53
|
-
# object: testRunner
|
54
|
-
# arguments:
|
55
|
-
# event: PoolClearedEvent
|
56
|
-
# count: 1
|
57
47
|
|
58
48
|
expectations:
|
59
49
|
- command_started_event:
|
@@ -86,8 +76,8 @@ tests:
|
|
86
76
|
- _id: 1
|
87
77
|
- _id: 2
|
88
78
|
# Configure the next streaming hello check to fail with a non-timeout
|
89
|
-
# network error.
|
90
|
-
#
|
79
|
+
# network error. Must use "times: 2" here. For a longer on explanation
|
80
|
+
# on why, check out https://jira.mongodb.org/browse/RUBY-3050.
|
91
81
|
- name: configureFailPoint
|
92
82
|
object: testRunner
|
93
83
|
arguments:
|
@@ -118,8 +108,8 @@ tests:
|
|
118
108
|
- _id: 3
|
119
109
|
- _id: 4
|
120
110
|
# We cannot assert the server was marked Unknown and pool was cleared an
|
121
|
-
# exact number of times because the RTT hello may
|
122
|
-
#
|
111
|
+
# exact number of times because the RTT hello may have triggered this
|
112
|
+
# failpoint one or many times as well.
|
123
113
|
# - name: assertEventCount
|
124
114
|
# object: testRunner
|
125
115
|
# arguments:
|
@@ -86,14 +86,16 @@ tests:
|
|
86
86
|
documents:
|
87
87
|
- _id: 1
|
88
88
|
- _id: 2
|
89
|
-
# Configure the next streaming hello check to fail with a timeout
|
90
|
-
# Use times:
|
89
|
+
# Configure the next streaming hello check to fail with a timeout.
|
90
|
+
# Use "times: 4" to increase the probability that the Monitor check times
|
91
|
+
# out since the RTT hello may trigger this failpoint one or many times as
|
92
|
+
# well.
|
91
93
|
- name: configureFailPoint
|
92
94
|
object: testRunner
|
93
95
|
arguments:
|
94
96
|
failPoint:
|
95
97
|
configureFailPoint: failCommand
|
96
|
-
mode: { times:
|
98
|
+
mode: { times: 4 }
|
97
99
|
data:
|
98
100
|
failCommands: ["hello", "isMaster"]
|
99
101
|
appName: timeoutMonitorCheckTest
|
@@ -121,17 +123,9 @@ tests:
|
|
121
123
|
documents:
|
122
124
|
- _id: 3
|
123
125
|
- _id: 4
|
124
|
-
#
|
125
|
-
|
126
|
-
|
127
|
-
arguments:
|
128
|
-
event: ServerMarkedUnknownEvent
|
129
|
-
count: 1
|
130
|
-
- name: assertEventCount
|
131
|
-
object: testRunner
|
132
|
-
arguments:
|
133
|
-
event: PoolClearedEvent
|
134
|
-
count: 1
|
126
|
+
# We cannot assert the server was marked Unknown and pool was cleared an
|
127
|
+
# exact number of times because the RTT hello may have triggered this
|
128
|
+
# failpoint one or many times as well.
|
135
129
|
|
136
130
|
expectations:
|
137
131
|
- command_started_event:
|
@@ -0,0 +1,64 @@
|
|
1
|
+
description: "do not retry read in a transaction"
|
2
|
+
|
3
|
+
schemaVersion: "1.4"
|
4
|
+
|
5
|
+
runOnRequirements:
|
6
|
+
- minServerVersion: "4.0.0"
|
7
|
+
topologies: [ replicaset ]
|
8
|
+
- minServerVersion: "4.2.0"
|
9
|
+
topologies: [ sharded, load-balanced ]
|
10
|
+
|
11
|
+
createEntities:
|
12
|
+
- client:
|
13
|
+
id: &client0 client0
|
14
|
+
useMultipleMongoses: false
|
15
|
+
observeEvents: [commandStartedEvent]
|
16
|
+
uriOptions: { retryReads: true }
|
17
|
+
- database:
|
18
|
+
id: &database0 database0
|
19
|
+
client: *client0
|
20
|
+
databaseName: &databaseName retryable-read-in-transaction-test
|
21
|
+
- collection:
|
22
|
+
id: &collection0 collection0
|
23
|
+
database: *database0
|
24
|
+
collectionName: &collectionName coll
|
25
|
+
- session:
|
26
|
+
id: &session0 session0
|
27
|
+
client: *client0
|
28
|
+
|
29
|
+
tests:
|
30
|
+
- description: "find does not retry in a transaction"
|
31
|
+
operations:
|
32
|
+
|
33
|
+
- name: startTransaction
|
34
|
+
object: *session0
|
35
|
+
|
36
|
+
- name: failPoint # fail the following find command
|
37
|
+
object: testRunner
|
38
|
+
arguments:
|
39
|
+
client: *client0
|
40
|
+
failPoint:
|
41
|
+
configureFailPoint: failCommand
|
42
|
+
mode: { times: 1 }
|
43
|
+
data:
|
44
|
+
failCommands: [find]
|
45
|
+
closeConnection: true
|
46
|
+
|
47
|
+
- name: find
|
48
|
+
object: *collection0
|
49
|
+
arguments:
|
50
|
+
filter: {}
|
51
|
+
session: *session0
|
52
|
+
expectError:
|
53
|
+
isError: true
|
54
|
+
errorLabelsContain: ["TransientTransactionError"]
|
55
|
+
expectEvents:
|
56
|
+
- client: *client0
|
57
|
+
events:
|
58
|
+
- commandStartedEvent:
|
59
|
+
command:
|
60
|
+
find: *collectionName
|
61
|
+
filter: {}
|
62
|
+
startTransaction: true
|
63
|
+
commandName: find
|
64
|
+
databaseName: *databaseName
|
@@ -0,0 +1,118 @@
|
|
1
|
+
description: "retryable abortTransaction on handshake errors"
|
2
|
+
|
3
|
+
schemaVersion: "1.4"
|
4
|
+
|
5
|
+
runOnRequirements:
|
6
|
+
- minServerVersion: "4.2"
|
7
|
+
topologies: [replicaset, sharded, load-balanced]
|
8
|
+
serverless: "forbid"
|
9
|
+
auth: true
|
10
|
+
|
11
|
+
createEntities:
|
12
|
+
- client:
|
13
|
+
id: &client0 client0
|
14
|
+
useMultipleMongoses: false
|
15
|
+
observeEvents: [commandStartedEvent, connectionCheckOutStartedEvent]
|
16
|
+
- database:
|
17
|
+
id: &database0 database0
|
18
|
+
client: *client0
|
19
|
+
databaseName: &databaseName retryable-handshake-tests
|
20
|
+
- collection:
|
21
|
+
id: &collection0 collection0
|
22
|
+
database: *database0
|
23
|
+
collectionName: &collectionName coll
|
24
|
+
- session:
|
25
|
+
# This session will be used to execute the transaction
|
26
|
+
id: &session0 session0
|
27
|
+
client: *client0
|
28
|
+
- session:
|
29
|
+
# This session will be used to create the failPoint, and empty the pool
|
30
|
+
id: &session1 session1
|
31
|
+
client: *client0
|
32
|
+
|
33
|
+
initialData:
|
34
|
+
- collectionName: *collectionName
|
35
|
+
databaseName: *databaseName
|
36
|
+
documents:
|
37
|
+
- { _id: 1, x: 11 }
|
38
|
+
|
39
|
+
tests:
|
40
|
+
- description: "AbortTransaction succeeds after handshake network error"
|
41
|
+
skipReason: "DRIVERS-2032: Pinned servers need to be checked if they are still selectable"
|
42
|
+
operations:
|
43
|
+
|
44
|
+
- name: startTransaction
|
45
|
+
object: *session0
|
46
|
+
|
47
|
+
- name: insertOne
|
48
|
+
object: *collection0
|
49
|
+
arguments:
|
50
|
+
session: *session0
|
51
|
+
document: { _id: 2, x: 22 }
|
52
|
+
|
53
|
+
# The following failPoint and ping utilize session1 so that
|
54
|
+
# the transaction won't be failed by the intentional erroring of ping
|
55
|
+
# and it will have an empty pool when it goes to run abortTransaction
|
56
|
+
- name: failPoint # fail the next connection establishment
|
57
|
+
object: testRunner
|
58
|
+
arguments:
|
59
|
+
client: *client0
|
60
|
+
session: *session1
|
61
|
+
failPoint:
|
62
|
+
configureFailPoint: failCommand
|
63
|
+
mode: { times: 2 }
|
64
|
+
data:
|
65
|
+
# use saslContinue here to avoid SDAM errors
|
66
|
+
# this failPoint itself will create a usable connection in the connection pool
|
67
|
+
# so we run a ping (with closeConnection: true) in order to discard the connection
|
68
|
+
# before testing that abortTransaction will fail a handshake but will get retried
|
69
|
+
failCommands: [saslContinue, ping]
|
70
|
+
closeConnection: true
|
71
|
+
|
72
|
+
- name: runCommand
|
73
|
+
object: *database0
|
74
|
+
arguments:
|
75
|
+
commandName: ping
|
76
|
+
command: { ping: 1 }
|
77
|
+
session: *session1
|
78
|
+
expectError:
|
79
|
+
isError: true
|
80
|
+
|
81
|
+
- name: abortTransaction
|
82
|
+
object: *session0
|
83
|
+
|
84
|
+
expectEvents:
|
85
|
+
- client: *client0
|
86
|
+
eventType: cmap
|
87
|
+
events:
|
88
|
+
- { connectionCheckOutStartedEvent: {} } # startTransaction
|
89
|
+
- { connectionCheckOutStartedEvent: {} } # insertOne
|
90
|
+
- { connectionCheckOutStartedEvent: {} } # failPoint
|
91
|
+
- { connectionCheckOutStartedEvent: {} } # abortTransaction
|
92
|
+
- { connectionCheckOutStartedEvent: {} } # abortTransaction retry
|
93
|
+
- client: *client0
|
94
|
+
events:
|
95
|
+
- commandStartedEvent:
|
96
|
+
command:
|
97
|
+
insert: *collectionName
|
98
|
+
documents: [{ _id: 2, x: 22 }]
|
99
|
+
startTransaction: true
|
100
|
+
commandName: insert
|
101
|
+
databaseName: *databaseName
|
102
|
+
- commandStartedEvent:
|
103
|
+
command:
|
104
|
+
ping: 1
|
105
|
+
databaseName: *databaseName
|
106
|
+
- commandStartedEvent:
|
107
|
+
command:
|
108
|
+
abortTransaction: 1
|
109
|
+
lsid:
|
110
|
+
$$sessionLsid: *session0
|
111
|
+
commandName: abortTransaction
|
112
|
+
databaseName: admin
|
113
|
+
|
114
|
+
outcome:
|
115
|
+
- collectionName: *collectionName
|
116
|
+
databaseName: *databaseName
|
117
|
+
documents:
|
118
|
+
- { _id: 1, x: 11 }
|
@@ -0,0 +1,118 @@
|
|
1
|
+
description: "retryable commitTransaction on handshake errors"
|
2
|
+
|
3
|
+
schemaVersion: "1.4"
|
4
|
+
|
5
|
+
runOnRequirements:
|
6
|
+
- minServerVersion: "4.2"
|
7
|
+
topologies: [replicaset, sharded, load-balanced]
|
8
|
+
serverless: "forbid"
|
9
|
+
auth: true
|
10
|
+
|
11
|
+
createEntities:
|
12
|
+
- client:
|
13
|
+
id: &client0 client0
|
14
|
+
useMultipleMongoses: false
|
15
|
+
observeEvents: [commandStartedEvent, connectionCheckOutStartedEvent]
|
16
|
+
uriOptions: { retryWrites: false } # commitTransaction is retryable regardless of this option being set
|
17
|
+
- database:
|
18
|
+
id: &database0 database0
|
19
|
+
client: *client0
|
20
|
+
databaseName: &databaseName retryable-handshake-tests
|
21
|
+
- collection:
|
22
|
+
id: &collection0 collection0
|
23
|
+
database: *database0
|
24
|
+
collectionName: &collectionName coll
|
25
|
+
- session:
|
26
|
+
id: &session0 session0
|
27
|
+
client: *client0
|
28
|
+
- session:
|
29
|
+
id: &session1 session1
|
30
|
+
client: *client0
|
31
|
+
|
32
|
+
initialData:
|
33
|
+
- collectionName: *collectionName
|
34
|
+
databaseName: *databaseName
|
35
|
+
documents:
|
36
|
+
- { _id: 1, x: 11 }
|
37
|
+
|
38
|
+
tests:
|
39
|
+
- description: "CommitTransaction succeeds after handshake network error"
|
40
|
+
skipReason: "DRIVERS-2032: Pinned servers need to be checked if they are still selectable"
|
41
|
+
operations:
|
42
|
+
|
43
|
+
- name: startTransaction
|
44
|
+
object: *session0
|
45
|
+
|
46
|
+
- name: insertOne
|
47
|
+
object: *collection0
|
48
|
+
arguments:
|
49
|
+
session: *session0
|
50
|
+
document: { _id: 2, x: 22 }
|
51
|
+
|
52
|
+
# The following failPoint and ping utilize session1 so that
|
53
|
+
# the transaction won't be failed by the intentional erroring of ping
|
54
|
+
# and it will have an empty pool when it goes to run commitTransaction
|
55
|
+
- name: failPoint # fail the next connection establishment
|
56
|
+
object: testRunner
|
57
|
+
arguments:
|
58
|
+
client: *client0
|
59
|
+
session: *session1
|
60
|
+
failPoint:
|
61
|
+
configureFailPoint: failCommand
|
62
|
+
mode: { times: 2 }
|
63
|
+
data:
|
64
|
+
# use saslContinue here to avoid SDAM errors
|
65
|
+
# this failPoint itself will create a usable connection in the connection pool
|
66
|
+
# so we run a ping (that also fails) in order to discard the connection
|
67
|
+
# before testing that commitTransaction gets retried
|
68
|
+
failCommands: [saslContinue, ping]
|
69
|
+
closeConnection: true
|
70
|
+
|
71
|
+
- name: runCommand
|
72
|
+
object: *database0
|
73
|
+
arguments:
|
74
|
+
commandName: ping
|
75
|
+
command: { ping: 1 }
|
76
|
+
session: *session1
|
77
|
+
expectError:
|
78
|
+
isError: true
|
79
|
+
|
80
|
+
- name: commitTransaction
|
81
|
+
object: *session0
|
82
|
+
|
83
|
+
expectEvents:
|
84
|
+
- client: *client0
|
85
|
+
eventType: cmap
|
86
|
+
events:
|
87
|
+
- { connectionCheckOutStartedEvent: {} } # startTransaction
|
88
|
+
- { connectionCheckOutStartedEvent: {} } # insertOne
|
89
|
+
- { connectionCheckOutStartedEvent: {} } # failPoint
|
90
|
+
- { connectionCheckOutStartedEvent: {} } # commitTransaction
|
91
|
+
- { connectionCheckOutStartedEvent: {} } # commitTransaction retry
|
92
|
+
- client: *client0
|
93
|
+
events:
|
94
|
+
- commandStartedEvent:
|
95
|
+
command:
|
96
|
+
insert: *collectionName
|
97
|
+
documents: [{ _id: 2, x: 22 }]
|
98
|
+
startTransaction: true
|
99
|
+
commandName: insert
|
100
|
+
databaseName: *databaseName
|
101
|
+
- commandStartedEvent:
|
102
|
+
command:
|
103
|
+
ping: 1
|
104
|
+
databaseName: *databaseName
|
105
|
+
- commandStartedEvent:
|
106
|
+
command:
|
107
|
+
commitTransaction: 1
|
108
|
+
lsid:
|
109
|
+
$$sessionLsid: *session0
|
110
|
+
commandName: commitTransaction
|
111
|
+
databaseName: admin
|
112
|
+
|
113
|
+
outcome:
|
114
|
+
- collectionName: *collectionName
|
115
|
+
databaseName: *databaseName
|
116
|
+
documents:
|
117
|
+
- { _id: 1, x: 11 }
|
118
|
+
- { _id: 2, x: 22 } # The write was still applied
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
host = 'freecluster-shard-00-00-oztdp.mongodb-dev.net'
|
6
|
+
|
7
|
+
output = `openssl s_client -showcerts -servername #{host} -connect #{host}:27017 </dev/null`
|
8
|
+
|
9
|
+
if output.empty?
|
10
|
+
raise 'Something bad happened'
|
11
|
+
end
|
12
|
+
|
13
|
+
certs = output.scan(/(-----BEGIN CERTIFICATE(.|\n)+?END CERTIFICATE-----)/)
|
14
|
+
cert, ca_cert = certs.map { |g| g.first }
|
15
|
+
|
16
|
+
Dir.mktmpdir do |path|
|
17
|
+
cert_path = File.join(path, 'cert.pem')
|
18
|
+
File.open(cert_path, 'w') do |f|
|
19
|
+
f << cert
|
20
|
+
end
|
21
|
+
output = `openssl x509 -noout -text -in #{cert_path}`
|
22
|
+
File.open('atlas-ocsp.crt', 'w') do |f|
|
23
|
+
f << output
|
24
|
+
f << "\n"
|
25
|
+
f << cert
|
26
|
+
end
|
27
|
+
|
28
|
+
cert_path = File.join(path, 'cert.pem')
|
29
|
+
File.open(cert_path, 'w') do |f|
|
30
|
+
f << ca_cert
|
31
|
+
end
|
32
|
+
output = `openssl x509 -noout -text -in #{cert_path}`
|
33
|
+
File.open('atlas-ocsp-ca.crt', 'w') do |f|
|
34
|
+
f << output
|
35
|
+
f << "\n"
|
36
|
+
f << ca_cert
|
37
|
+
end
|
38
|
+
end
|
data/spec/support/spec_config.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|