mongo 2.4.3 → 2.5.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -2
- data.tar.gz.sig +0 -0
- data/lib/mongo.rb +3 -2
- data/lib/mongo/auth/cr.rb +6 -4
- data/lib/mongo/auth/cr/conversation.rb +33 -17
- data/lib/mongo/auth/ldap.rb +4 -2
- data/lib/mongo/auth/ldap/conversation.rb +19 -9
- data/lib/mongo/auth/scram.rb +7 -4
- data/lib/mongo/auth/scram/conversation.rb +62 -24
- data/lib/mongo/auth/user.rb +10 -0
- data/lib/mongo/auth/user/view.rb +44 -22
- data/lib/mongo/auth/x509.rb +4 -2
- data/lib/mongo/auth/x509/conversation.rb +19 -9
- data/lib/mongo/bulk_write.rb +33 -27
- data/lib/mongo/bulk_write/combineable.rb +5 -0
- data/lib/mongo/bulk_write/transformable.rb +2 -0
- data/lib/mongo/bulk_write/validatable.rb +4 -0
- data/lib/mongo/client.rb +123 -12
- data/lib/mongo/cluster.rb +52 -11
- data/lib/mongo/cluster/app_metadata.rb +8 -2
- data/lib/mongo/cluster/cursor_reaper.rb +0 -1
- data/lib/mongo/cluster/topology.rb +1 -1
- data/lib/mongo/collection.rb +114 -27
- data/lib/mongo/collection/view.rb +8 -2
- data/lib/mongo/collection/view/aggregation.rb +11 -7
- data/lib/mongo/collection/view/builder/aggregation.rb +5 -1
- data/lib/mongo/collection/view/builder/find_command.rb +5 -3
- data/lib/mongo/collection/view/builder/map_reduce.rb +11 -3
- data/lib/mongo/collection/view/builder/op_query.rb +1 -1
- data/lib/mongo/collection/view/change_stream.rb +160 -0
- data/lib/mongo/collection/view/change_stream/retryable.rb +57 -0
- data/lib/mongo/collection/view/iterable.rb +11 -10
- data/lib/mongo/collection/view/map_reduce.rb +22 -18
- data/lib/mongo/collection/view/readable.rb +51 -37
- data/lib/mongo/collection/view/writable.rb +72 -40
- data/lib/mongo/cursor.rb +25 -4
- data/lib/mongo/cursor/builder/get_more_command.rb +4 -2
- data/lib/mongo/database.rb +22 -11
- data/lib/mongo/database/view.rb +16 -12
- data/lib/mongo/error.rb +5 -0
- data/lib/mongo/error/invalid_session.rb +36 -0
- data/lib/mongo/error/missing_resume_token.rb +39 -0
- data/lib/mongo/error/operation_failure.rb +17 -0
- data/lib/mongo/error/parser.rb +3 -2
- data/lib/mongo/error/unknown_payload_type.rb +41 -0
- data/lib/mongo/error/unsupported_array_filters.rb +51 -0
- data/lib/mongo/error/unsupported_message_type.rb +23 -0
- data/lib/mongo/grid/fs_bucket.rb +5 -4
- data/lib/mongo/grid/stream/read.rb +3 -2
- data/lib/mongo/grid/stream/write.rb +2 -2
- data/lib/mongo/index/view.rb +35 -25
- data/lib/mongo/monitoring/event/secure.rb +14 -0
- data/lib/mongo/operation.rb +16 -0
- data/lib/mongo/operation/commands.rb +1 -0
- data/lib/mongo/operation/commands/aggregate.rb +9 -5
- data/lib/mongo/operation/commands/aggregate/result.rb +1 -1
- data/lib/mongo/operation/commands/collections_info.rb +6 -6
- data/lib/mongo/operation/commands/command.rb +2 -1
- data/lib/mongo/operation/commands/create.rb +6 -2
- data/lib/mongo/operation/commands/drop.rb +6 -2
- data/lib/mongo/operation/commands/drop_database.rb +6 -2
- data/lib/mongo/operation/commands/explain.rb +27 -0
- data/lib/mongo/operation/commands/explain/result.rb +52 -0
- data/lib/mongo/operation/commands/indexes.rb +1 -1
- data/lib/mongo/operation/commands/list_collections.rb +1 -1
- data/lib/mongo/operation/commands/list_collections/result.rb +1 -1
- data/lib/mongo/operation/commands/list_indexes.rb +1 -1
- data/lib/mongo/operation/commands/list_indexes/result.rb +1 -1
- data/lib/mongo/operation/commands/map_reduce.rb +8 -4
- data/lib/mongo/operation/commands/map_reduce/result.rb +13 -1
- data/lib/mongo/operation/commands/user_query.rb +1 -1
- data/lib/mongo/operation/commands/users_info.rb +6 -2
- data/lib/mongo/operation/executable.rb +4 -1
- data/lib/mongo/operation/read_preference.rb +10 -5
- data/lib/mongo/operation/result.rb +26 -2
- data/lib/mongo/operation/specifiable.rb +13 -1
- data/lib/mongo/operation/uses_command_op_msg.rb +47 -0
- data/lib/mongo/operation/write/bulk/bulkable.rb +4 -1
- data/lib/mongo/operation/write/bulk/insert/result.rb +4 -4
- data/lib/mongo/operation/write/command/create_index.rb +6 -1
- data/lib/mongo/operation/write/command/delete.rb +28 -4
- data/lib/mongo/operation/write/command/drop_index.rb +6 -1
- data/lib/mongo/operation/write/command/insert.rb +22 -18
- data/lib/mongo/operation/write/command/update.rb +24 -9
- data/lib/mongo/operation/write/command/writable.rb +14 -1
- data/lib/mongo/operation/write/insert.rb +4 -1
- data/lib/mongo/operation/write/insert/result.rb +2 -2
- data/lib/mongo/operation/write/update.rb +7 -1
- data/lib/mongo/operation/write/write_command_enabled.rb +20 -3
- data/lib/mongo/protocol.rb +3 -0
- data/lib/mongo/protocol/bit_vector.rb +2 -2
- data/lib/mongo/protocol/compressed.rb +135 -0
- data/lib/mongo/protocol/delete.rb +8 -6
- data/lib/mongo/protocol/get_more.rb +8 -6
- data/lib/mongo/protocol/insert.rb +8 -6
- data/lib/mongo/protocol/kill_cursors.rb +8 -6
- data/lib/mongo/protocol/message.rb +31 -3
- data/lib/mongo/protocol/msg.rb +172 -0
- data/lib/mongo/protocol/query.rb +26 -6
- data/lib/mongo/protocol/registry.rb +76 -0
- data/lib/mongo/protocol/reply.rb +10 -5
- data/lib/mongo/protocol/serializers.rb +224 -0
- data/lib/mongo/protocol/update.rb +8 -6
- data/lib/mongo/retryable.rb +4 -2
- data/lib/mongo/server.rb +6 -3
- data/lib/mongo/server/connectable.rb +1 -1
- data/lib/mongo/server/connection.rb +30 -8
- data/lib/mongo/server/description.rb +25 -1
- data/lib/mongo/server/description/features.rb +4 -1
- data/lib/mongo/server/monitor.rb +5 -0
- data/lib/mongo/server/monitor/connection.rb +50 -2
- data/lib/mongo/server_selector/nearest.rb +10 -4
- data/lib/mongo/server_selector/primary.rb +20 -0
- data/lib/mongo/server_selector/primary_preferred.rb +10 -4
- data/lib/mongo/server_selector/secondary.rb +10 -4
- data/lib/mongo/server_selector/secondary_preferred.rb +24 -4
- data/lib/mongo/session.rb +180 -0
- data/lib/mongo/session/server_session.rb +73 -0
- data/lib/mongo/session/session_pool.rb +161 -0
- data/lib/mongo/uri.rb +11 -0
- data/lib/mongo/version.rb +1 -1
- data/mongo.gemspec +2 -1
- data/spec/mongo/auth/cr_spec.rb +12 -0
- data/spec/mongo/auth/ldap_spec.rb +2 -0
- data/spec/mongo/auth/scram/conversation_spec.rb +6 -6
- data/spec/mongo/auth/scram_spec.rb +25 -1
- data/spec/mongo/auth/user/view_spec.rb +268 -76
- data/spec/mongo/auth/x509_spec.rb +2 -0
- data/spec/mongo/bulk_write_spec.rb +435 -5
- data/spec/mongo/client_spec.rb +356 -39
- data/spec/mongo/cluster/app_metadata_spec.rb +2 -2
- data/spec/mongo/cluster_spec.rb +176 -0
- data/spec/mongo/collection/view/aggregation_spec.rb +33 -12
- data/spec/mongo/collection/view/builder/find_command_spec.rb +46 -6
- data/spec/mongo/collection/view/change_stream_spec.rb +814 -0
- data/spec/mongo/collection/view/map_reduce_spec.rb +94 -17
- data/spec/mongo/collection/view/readable_spec.rb +3 -12
- data/spec/mongo/collection_spec.rb +1048 -42
- data/spec/mongo/cursor/builder/get_more_command_spec.rb +19 -0
- data/spec/mongo/cursor_spec.rb +2 -2
- data/spec/mongo/database_spec.rb +50 -1
- data/spec/mongo/grid/fs_bucket_spec.rb +225 -137
- data/spec/mongo/grid/stream/read_spec.rb +2 -2
- data/spec/mongo/index/view_spec.rb +146 -8
- data/spec/mongo/monitoring/event/secure_spec.rb +42 -0
- data/spec/mongo/operation/read/query_spec.rb +2 -1
- data/spec/mongo/operation/specifiable_spec.rb +2 -2
- data/spec/mongo/operation/write/command/delete_spec.rb +96 -13
- data/spec/mongo/operation/write/command/insert_spec.rb +111 -12
- data/spec/mongo/operation/write/command/update_spec.rb +93 -10
- data/spec/mongo/operation/write/delete_spec.rb +1 -1
- data/spec/mongo/operation/write/insert_spec.rb +1 -1
- data/spec/mongo/operation/write/update_spec.rb +1 -1
- data/spec/mongo/protocol/compressed_spec.rb +66 -0
- data/spec/mongo/protocol/delete_spec.rb +14 -0
- data/spec/mongo/protocol/get_more_spec.rb +14 -0
- data/spec/mongo/protocol/insert_spec.rb +14 -0
- data/spec/mongo/protocol/kill_cursors_spec.rb +14 -0
- data/spec/mongo/protocol/msg_spec.rb +499 -0
- data/spec/mongo/protocol/query_spec.rb +45 -0
- data/spec/mongo/protocol/registry_spec.rb +31 -0
- data/spec/mongo/protocol/reply_spec.rb +14 -0
- data/spec/mongo/protocol/update_spec.rb +14 -0
- data/spec/mongo/retryable_spec.rb +6 -2
- data/spec/mongo/sdam_spec.rb +4 -0
- data/spec/mongo/server/connection_spec.rb +4 -2
- data/spec/mongo/server/description_spec.rb +28 -1
- data/spec/mongo/session/server_session_spec.rb +16 -0
- data/spec/mongo/session/session_pool_spec.rb +194 -0
- data/spec/mongo/uri_spec.rb +31 -2
- data/spec/spec_helper.rb +104 -0
- data/spec/support/authorization.rb +6 -1
- data/spec/support/crud.rb +3 -1
- data/spec/support/crud/write.rb +6 -1
- data/spec/support/crud_tests/write/findOneAndUpdate-arrayFilters.yml +69 -0
- data/spec/support/crud_tests/write/updateMany-arrayFilters.yml +63 -0
- data/spec/support/crud_tests/write/updateOne-arrayFilters.yml +109 -0
- data/spec/support/sdam/rs/discover_arbiters.yml +1 -1
- data/spec/support/sdam/rs/discover_passives.yml +2 -2
- data/spec/support/sdam/rs/discover_primary.yml +1 -1
- data/spec/support/sdam/rs/discover_secondary.yml +1 -1
- data/spec/support/sdam/rs/discovery.yml +4 -4
- data/spec/support/sdam/rs/equal_electionids.yml +1 -0
- data/spec/support/sdam/rs/ghost_discovered.yml +1 -1
- data/spec/support/sdam/rs/hosts_differ_from_seeds.yml +1 -1
- data/spec/support/sdam/rs/ls_timeout.yml +88 -0
- data/spec/support/sdam/rs/member_reconfig.yml +2 -2
- data/spec/support/sdam/rs/member_standalone.yml +2 -2
- data/spec/support/sdam/rs/new_primary.yml +2 -2
- data/spec/support/sdam/rs/new_primary_new_electionid.yml +3 -0
- data/spec/support/sdam/rs/new_primary_new_setversion.yml +3 -0
- data/spec/support/sdam/rs/new_primary_wrong_set_name.yml +2 -2
- data/spec/support/sdam/rs/non_rs_member.yml +1 -1
- data/spec/support/sdam/rs/normalize_case.yml +1 -1
- data/spec/support/sdam/rs/null_election_id.yml +4 -0
- data/spec/support/sdam/rs/primary_becomes_standalone.yml +2 -2
- data/spec/support/sdam/rs/primary_changes_set_name.yml +2 -2
- data/spec/support/sdam/rs/primary_disconnect.yml +2 -2
- data/spec/support/sdam/rs/primary_disconnect_electionid.yml +5 -0
- data/spec/support/sdam/rs/primary_disconnect_setversion.yml +5 -0
- data/spec/support/sdam/rs/primary_hint_from_secondary_with_mismatched_me.yml +58 -0
- data/spec/support/sdam/rs/primary_reports_new_member.yml +4 -4
- data/spec/support/sdam/rs/primary_to_no_primary_mismatched_me.yml +2 -2
- data/spec/support/sdam/rs/primary_wrong_set_name.yml +1 -1
- data/spec/support/sdam/rs/response_from_removed.yml +2 -2
- data/spec/support/sdam/rs/rsother_discovered.yml +1 -1
- data/spec/support/sdam/rs/sec_not_auth.yml +1 -1
- data/spec/support/sdam/rs/secondary_wrong_set_name.yml +1 -1
- data/spec/support/sdam/rs/secondary_wrong_set_name_with_primary.yml +2 -2
- data/spec/support/sdam/rs/setversion_without_electionid.yml +2 -0
- data/spec/support/sdam/rs/stepdown_change_set_name.yml +2 -2
- data/spec/support/sdam/rs/unexpected_mongos.yml +1 -1
- data/spec/support/sdam/rs/use_setversion_without_electionid.yml +3 -0
- data/spec/support/sdam/rs/wrong_set_name.yml +1 -1
- data/spec/support/sdam/sharded/ls_timeout_mongos.yml +97 -0
- data/spec/support/sdam/sharded/mongos_disconnect.yml +3 -3
- data/spec/support/sdam/sharded/multiple_mongoses.yml +1 -1
- data/spec/support/sdam/sharded/non_mongos_removed.yml +1 -1
- data/spec/support/sdam/sharded/normalize_uri_case.yml +1 -1
- data/spec/support/sdam/single/direct_connection_external_ip.yml +1 -1
- data/spec/support/sdam/single/direct_connection_mongos.yml +1 -1
- data/spec/support/sdam/single/direct_connection_rsarbiter.yml +1 -1
- data/spec/support/sdam/single/direct_connection_rsprimary.yml +1 -1
- data/spec/support/sdam/single/direct_connection_rssecondary.yml +1 -1
- data/spec/support/sdam/single/direct_connection_slave.yml +1 -1
- data/spec/support/sdam/single/direct_connection_standalone.yml +1 -1
- data/spec/support/sdam/single/ls_timeout_standalone.yml +35 -0
- data/spec/support/sdam/single/not_ok_response.yml +1 -1
- data/spec/support/sdam/single/standalone_removed.yml +1 -1
- data/spec/support/sdam/single/unavailable_seed.yml +1 -1
- data/spec/support/server_discovery_and_monitoring.rb +4 -0
- data/spec/support/shared/session.rb +236 -0
- metadata +53 -15
- metadata.gz.sig +0 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
description: "Parse logicalSessionTimeoutMinutes from standalone"
|
2
|
+
|
3
|
+
uri: "mongodb://a"
|
4
|
+
|
5
|
+
phases: [
|
6
|
+
|
7
|
+
{
|
8
|
+
responses: [
|
9
|
+
|
10
|
+
["a:27017", {
|
11
|
+
|
12
|
+
ok: 1,
|
13
|
+
ismaster: true,
|
14
|
+
logicalSessionTimeoutMinutes: 7,
|
15
|
+
minWireVersion: 0,
|
16
|
+
maxWireVersion: 6
|
17
|
+
}]
|
18
|
+
],
|
19
|
+
|
20
|
+
outcome: {
|
21
|
+
|
22
|
+
servers: {
|
23
|
+
|
24
|
+
"a:27017": {
|
25
|
+
|
26
|
+
type: "Standalone",
|
27
|
+
setName:
|
28
|
+
}
|
29
|
+
},
|
30
|
+
topologyType: "Single",
|
31
|
+
logicalSessionTimeoutMinutes: 7,
|
32
|
+
setName:
|
33
|
+
}
|
34
|
+
}
|
35
|
+
]
|
@@ -163,6 +163,9 @@ module Mongo
|
|
163
163
|
# @return [ String ] topology_type The expected cluster topology type.
|
164
164
|
attr_reader :topology_type
|
165
165
|
|
166
|
+
# @return [ Integer, nil ] logical_session_timeout The expected logical session timeout.
|
167
|
+
attr_reader :logical_session_timeout
|
168
|
+
|
166
169
|
# Create the new outcome.
|
167
170
|
#
|
168
171
|
# @example Create the new outcome.
|
@@ -175,6 +178,7 @@ module Mongo
|
|
175
178
|
@servers = process_servers(outcome['servers']) if outcome['servers']
|
176
179
|
@set_name = outcome['setName']
|
177
180
|
@topology_type = outcome['topologyType']
|
181
|
+
@logical_session_timeout = outcome['logicalSessionTimeoutMinutes']
|
178
182
|
@events = process_events(outcome['events']) if outcome['events']
|
179
183
|
end
|
180
184
|
|
@@ -0,0 +1,236 @@
|
|
1
|
+
shared_examples 'an operation using a session' do
|
2
|
+
|
3
|
+
describe 'operation execution', if: sessions_enabled? do
|
4
|
+
|
5
|
+
context 'when the session is created from the same client used for the operation' do
|
6
|
+
|
7
|
+
let(:session) do
|
8
|
+
client.start_session
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:server_session) do
|
12
|
+
session.instance_variable_get(:@server_session)
|
13
|
+
end
|
14
|
+
|
15
|
+
let!(:before_last_use) do
|
16
|
+
server_session.last_use
|
17
|
+
end
|
18
|
+
|
19
|
+
let!(:before_operation_time) do
|
20
|
+
(session.instance_variable_get(:@operation_time) || 0)
|
21
|
+
end
|
22
|
+
|
23
|
+
let!(:operation_result) do
|
24
|
+
operation
|
25
|
+
end
|
26
|
+
|
27
|
+
after do
|
28
|
+
session.end_session
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'updates the last use value' do
|
32
|
+
expect(server_session.last_use).not_to eq(before_last_use)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'updates the operation time value' do
|
36
|
+
expect(session.instance_variable_get(:@operation_time)).not_to eq(before_operation_time)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'does not close the session when the operation completes' do
|
40
|
+
expect(session.ended?).to be(false)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when a session from another client is provided' do
|
45
|
+
|
46
|
+
let(:session) do
|
47
|
+
client.start_session
|
48
|
+
end
|
49
|
+
|
50
|
+
let(:client) do
|
51
|
+
authorized_client.with(read: { mode: :secondary })
|
52
|
+
end
|
53
|
+
|
54
|
+
let(:operation_result) do
|
55
|
+
operation
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'raises an exception' do
|
59
|
+
expect {
|
60
|
+
operation_result
|
61
|
+
}.to raise_exception(Mongo::Error::InvalidSession)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'when the session is ended before it is used' do
|
66
|
+
|
67
|
+
let(:session) do
|
68
|
+
client.start_session
|
69
|
+
end
|
70
|
+
|
71
|
+
before do
|
72
|
+
session.end_session
|
73
|
+
end
|
74
|
+
|
75
|
+
let(:operation_result) do
|
76
|
+
operation
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'raises an exception' do
|
80
|
+
expect {
|
81
|
+
operation_result
|
82
|
+
}.to raise_exception(Mongo::Error::InvalidSession)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
shared_examples 'a failed operation using a session' do
|
89
|
+
|
90
|
+
context 'when the operation fails', if: sessions_enabled? do
|
91
|
+
|
92
|
+
let!(:before_last_use) do
|
93
|
+
session.instance_variable_get(:@server_session).last_use
|
94
|
+
end
|
95
|
+
|
96
|
+
let!(:before_operation_time) do
|
97
|
+
(session.instance_variable_get(:@operation_time) || 0)
|
98
|
+
end
|
99
|
+
|
100
|
+
let!(:operation_result) do
|
101
|
+
begin; failed_operation; rescue => e; e; end
|
102
|
+
end
|
103
|
+
|
104
|
+
let(:session) do
|
105
|
+
client.start_session
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'raises an error' do
|
109
|
+
expect([Mongo::Error::OperationFailure,
|
110
|
+
Mongo::Error::BulkWriteError]).to include(operation_result.class)
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'updates the last use value' do
|
114
|
+
expect(session.instance_variable_get(:@server_session).last_use).not_to eq(before_last_use)
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'updates the operation time value' do
|
118
|
+
expect(session.instance_variable_get(:@operation_time)).not_to eq(before_operation_time)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
shared_examples 'an operation updating cluster time' do
|
124
|
+
|
125
|
+
let(:cluster) do
|
126
|
+
client.cluster
|
127
|
+
end
|
128
|
+
|
129
|
+
let(:client) do
|
130
|
+
authorized_client.with(heartbeat_frequency: 100).tap do |cl|
|
131
|
+
cl.subscribe(Mongo::Monitoring::COMMAND, subscriber)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
let(:subscriber) do
|
136
|
+
EventSubscriber.new
|
137
|
+
end
|
138
|
+
|
139
|
+
after do
|
140
|
+
client.close
|
141
|
+
end
|
142
|
+
|
143
|
+
context 'when the command is run once' do
|
144
|
+
|
145
|
+
context 'when the server is version 3.6' do
|
146
|
+
|
147
|
+
context 'when the server is a mongos', if: (sharded? && sessions_enabled?) do
|
148
|
+
|
149
|
+
let!(:reply_cluster_time) do
|
150
|
+
operation
|
151
|
+
subscriber.succeeded_events[-1].reply['$clusterTime']
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'updates the cluster time of the cluster' do
|
155
|
+
expect(cluster.cluster_time).to eq(reply_cluster_time)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
context 'when the server is not a mongos', if: (!sharded? && sessions_enabled?) do
|
160
|
+
|
161
|
+
let(:before_cluster_time) do
|
162
|
+
client.cluster.cluster_time
|
163
|
+
end
|
164
|
+
|
165
|
+
let!(:reply_cluster_time) do
|
166
|
+
operation
|
167
|
+
subscriber.succeeded_events[-1].reply['$clusterTime']
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'does not update the cluster time of the cluster' do
|
171
|
+
expect(before_cluster_time).to eq(before_cluster_time)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
context 'when the server is less than version 3.6', if: !sessions_enabled? do
|
177
|
+
|
178
|
+
let(:before_cluster_time) do
|
179
|
+
client.cluster.cluster_time
|
180
|
+
end
|
181
|
+
|
182
|
+
let!(:reply_cluster_time) do
|
183
|
+
operation
|
184
|
+
subscriber.succeeded_events[-1].reply['$clusterTime']
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'does not update the cluster time of the cluster' do
|
188
|
+
expect(before_cluster_time).to eq(before_cluster_time)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
context 'when the command is run twice' do
|
194
|
+
|
195
|
+
let!(:reply_cluster_time) do
|
196
|
+
operation
|
197
|
+
subscriber.succeeded_events[-1].reply['$clusterTime']
|
198
|
+
end
|
199
|
+
|
200
|
+
let(:second_command_cluster_time) do
|
201
|
+
second_operation
|
202
|
+
subscriber.started_events[-1].command['$clusterTime']
|
203
|
+
end
|
204
|
+
|
205
|
+
context 'when the server is a mongos', if: (sharded? && sessions_enabled?) do
|
206
|
+
|
207
|
+
it 'includes the received cluster time in the second command' do
|
208
|
+
expect(second_command_cluster_time).to eq(reply_cluster_time)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
context 'when the server is not a mongos', if: (!sharded? && sessions_enabled?) do
|
213
|
+
|
214
|
+
let(:before_cluster_time) do
|
215
|
+
client.cluster.cluster_time
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'does not update the cluster time of the cluster' do
|
219
|
+
second_command_cluster_time
|
220
|
+
expect(before_cluster_time).to eq(before_cluster_time)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
context 'when the server is less than version 3.6', if: !sessions_enabled? do
|
226
|
+
|
227
|
+
let(:before_cluster_time) do
|
228
|
+
client.cluster.cluster_time
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'does not update the cluster time of the cluster' do
|
232
|
+
operation
|
233
|
+
expect(before_cluster_time).to eq(before_cluster_time)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -32,28 +32,22 @@ cert_chain:
|
|
32
32
|
JORAC0isugdrjOh+7HDizWC+9xpvSdKSuNso9bVKO3czaBeR+i+IA43wWeUliq95
|
33
33
|
5mp49lUwPrMEh694iPac5m+oxYlcU5U+sUyArQXg+lk=
|
34
34
|
-----END CERTIFICATE-----
|
35
|
-
date: 2017-
|
35
|
+
date: 2017-09-28 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: bson
|
39
39
|
requirement: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - '='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 4.
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 5.0.0
|
43
|
+
version: 4.3.0.beta
|
47
44
|
type: :runtime
|
48
45
|
prerelease: false
|
49
46
|
version_requirements: !ruby/object:Gem::Requirement
|
50
47
|
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 4.2.1
|
54
|
-
- - "<"
|
48
|
+
- - '='
|
55
49
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
50
|
+
version: 4.3.0.beta
|
57
51
|
description: A Ruby driver for MongoDB
|
58
52
|
email: mongodb-dev@googlegroups.com
|
59
53
|
executables:
|
@@ -112,6 +106,8 @@ files:
|
|
112
106
|
- lib/mongo/collection/view/builder/map_reduce.rb
|
113
107
|
- lib/mongo/collection/view/builder/modifiers.rb
|
114
108
|
- lib/mongo/collection/view/builder/op_query.rb
|
109
|
+
- lib/mongo/collection/view/change_stream.rb
|
110
|
+
- lib/mongo/collection/view/change_stream/retryable.rb
|
115
111
|
- lib/mongo/collection/view/explainable.rb
|
116
112
|
- lib/mongo/collection/view/immutable.rb
|
117
113
|
- lib/mongo/collection/view/iterable.rb
|
@@ -144,6 +140,7 @@ files:
|
|
144
140
|
- lib/mongo/error/invalid_nonce.rb
|
145
141
|
- lib/mongo/error/invalid_replacement_document.rb
|
146
142
|
- lib/mongo/error/invalid_server_preference.rb
|
143
|
+
- lib/mongo/error/invalid_session.rb
|
147
144
|
- lib/mongo/error/invalid_signature.rb
|
148
145
|
- lib/mongo/error/invalid_update_document.rb
|
149
146
|
- lib/mongo/error/invalid_uri.rb
|
@@ -151,6 +148,7 @@ files:
|
|
151
148
|
- lib/mongo/error/max_bson_size.rb
|
152
149
|
- lib/mongo/error/max_message_size.rb
|
153
150
|
- lib/mongo/error/missing_file_chunk.rb
|
151
|
+
- lib/mongo/error/missing_resume_token.rb
|
154
152
|
- lib/mongo/error/multi_index_drop.rb
|
155
153
|
- lib/mongo/error/need_primary_server.rb
|
156
154
|
- lib/mongo/error/no_server_available.rb
|
@@ -161,8 +159,11 @@ files:
|
|
161
159
|
- lib/mongo/error/unchangeable_collection_option.rb
|
162
160
|
- lib/mongo/error/unexpected_chunk_length.rb
|
163
161
|
- lib/mongo/error/unexpected_response.rb
|
162
|
+
- lib/mongo/error/unknown_payload_type.rb
|
163
|
+
- lib/mongo/error/unsupported_array_filters.rb
|
164
164
|
- lib/mongo/error/unsupported_collation.rb
|
165
165
|
- lib/mongo/error/unsupported_features.rb
|
166
|
+
- lib/mongo/error/unsupported_message_type.rb
|
166
167
|
- lib/mongo/event.rb
|
167
168
|
- lib/mongo/event/description_changed.rb
|
168
169
|
- lib/mongo/event/listeners.rb
|
@@ -213,6 +214,8 @@ files:
|
|
213
214
|
- lib/mongo/operation/commands/create.rb
|
214
215
|
- lib/mongo/operation/commands/drop.rb
|
215
216
|
- lib/mongo/operation/commands/drop_database.rb
|
217
|
+
- lib/mongo/operation/commands/explain.rb
|
218
|
+
- lib/mongo/operation/commands/explain/result.rb
|
216
219
|
- lib/mongo/operation/commands/find.rb
|
217
220
|
- lib/mongo/operation/commands/find/result.rb
|
218
221
|
- lib/mongo/operation/commands/get_more.rb
|
@@ -241,6 +244,7 @@ files:
|
|
241
244
|
- lib/mongo/operation/result.rb
|
242
245
|
- lib/mongo/operation/specifiable.rb
|
243
246
|
- lib/mongo/operation/takes_write_concern.rb
|
247
|
+
- lib/mongo/operation/uses_command_op_msg.rb
|
244
248
|
- lib/mongo/operation/write.rb
|
245
249
|
- lib/mongo/operation/write/bulk.rb
|
246
250
|
- lib/mongo/operation/write/bulk/bulkable.rb
|
@@ -281,12 +285,15 @@ files:
|
|
281
285
|
- lib/mongo/options/redacted.rb
|
282
286
|
- lib/mongo/protocol.rb
|
283
287
|
- lib/mongo/protocol/bit_vector.rb
|
288
|
+
- lib/mongo/protocol/compressed.rb
|
284
289
|
- lib/mongo/protocol/delete.rb
|
285
290
|
- lib/mongo/protocol/get_more.rb
|
286
291
|
- lib/mongo/protocol/insert.rb
|
287
292
|
- lib/mongo/protocol/kill_cursors.rb
|
288
293
|
- lib/mongo/protocol/message.rb
|
294
|
+
- lib/mongo/protocol/msg.rb
|
289
295
|
- lib/mongo/protocol/query.rb
|
296
|
+
- lib/mongo/protocol/registry.rb
|
290
297
|
- lib/mongo/protocol/reply.rb
|
291
298
|
- lib/mongo/protocol/serializers.rb
|
292
299
|
- lib/mongo/protocol/update.rb
|
@@ -313,6 +320,9 @@ files:
|
|
313
320
|
- lib/mongo/server_selector/secondary.rb
|
314
321
|
- lib/mongo/server_selector/secondary_preferred.rb
|
315
322
|
- lib/mongo/server_selector/selectable.rb
|
323
|
+
- lib/mongo/session.rb
|
324
|
+
- lib/mongo/session/server_session.rb
|
325
|
+
- lib/mongo/session/session_pool.rb
|
316
326
|
- lib/mongo/socket.rb
|
317
327
|
- lib/mongo/socket/ssl.rb
|
318
328
|
- lib/mongo/socket/tcp.rb
|
@@ -356,6 +366,7 @@ files:
|
|
356
366
|
- spec/mongo/collection/view/builder/flags_spec.rb
|
357
367
|
- spec/mongo/collection/view/builder/modifiers_spec.rb
|
358
368
|
- spec/mongo/collection/view/builder/op_query_spec.rb
|
369
|
+
- spec/mongo/collection/view/change_stream_spec.rb
|
359
370
|
- spec/mongo/collection/view/explainable_spec.rb
|
360
371
|
- spec/mongo/collection/view/immutable_spec.rb
|
361
372
|
- spec/mongo/collection/view/map_reduce_spec.rb
|
@@ -418,11 +429,14 @@ files:
|
|
418
429
|
- spec/mongo/operation/write/update_spec.rb
|
419
430
|
- spec/mongo/operation/write/update_user_spec.rb
|
420
431
|
- spec/mongo/options/redacted_spec.rb
|
432
|
+
- spec/mongo/protocol/compressed_spec.rb
|
421
433
|
- spec/mongo/protocol/delete_spec.rb
|
422
434
|
- spec/mongo/protocol/get_more_spec.rb
|
423
435
|
- spec/mongo/protocol/insert_spec.rb
|
424
436
|
- spec/mongo/protocol/kill_cursors_spec.rb
|
437
|
+
- spec/mongo/protocol/msg_spec.rb
|
425
438
|
- spec/mongo/protocol/query_spec.rb
|
439
|
+
- spec/mongo/protocol/registry_spec.rb
|
426
440
|
- spec/mongo/protocol/reply_spec.rb
|
427
441
|
- spec/mongo/protocol/update_spec.rb
|
428
442
|
- spec/mongo/retryable_spec.rb
|
@@ -446,6 +460,8 @@ files:
|
|
446
460
|
- spec/mongo/server_selector/secondary_spec.rb
|
447
461
|
- spec/mongo/server_selector_spec.rb
|
448
462
|
- spec/mongo/server_spec.rb
|
463
|
+
- spec/mongo/session/server_session_spec.rb
|
464
|
+
- spec/mongo/session/session_pool_spec.rb
|
449
465
|
- spec/mongo/shell_examples_spec.rb
|
450
466
|
- spec/mongo/socket/ssl_spec.rb
|
451
467
|
- spec/mongo/socket/unix_spec.rb
|
@@ -505,6 +521,7 @@ files:
|
|
505
521
|
- spec/support/crud_tests/write/findOneAndReplace-upsert.yml
|
506
522
|
- spec/support/crud_tests/write/findOneAndReplace-upsert_pre_2.6.yml
|
507
523
|
- spec/support/crud_tests/write/findOneAndReplace.yml
|
524
|
+
- spec/support/crud_tests/write/findOneAndUpdate-arrayFilters.yml
|
508
525
|
- spec/support/crud_tests/write/findOneAndUpdate-collation.yml
|
509
526
|
- spec/support/crud_tests/write/findOneAndUpdate.yml
|
510
527
|
- spec/support/crud_tests/write/insertMany.yml
|
@@ -513,9 +530,11 @@ files:
|
|
513
530
|
- spec/support/crud_tests/write/replaceOne-pre_2.6.yml
|
514
531
|
- spec/support/crud_tests/write/replaceOne-upsert.yml
|
515
532
|
- spec/support/crud_tests/write/replaceOne.yml
|
533
|
+
- spec/support/crud_tests/write/updateMany-arrayFilters.yml
|
516
534
|
- spec/support/crud_tests/write/updateMany-collation.yml
|
517
535
|
- spec/support/crud_tests/write/updateMany-pre_2.6.yml
|
518
536
|
- spec/support/crud_tests/write/updateMany.yml
|
537
|
+
- spec/support/crud_tests/write/updateOne-arrayFilters.yml
|
519
538
|
- spec/support/crud_tests/write/updateOne-collation.yml
|
520
539
|
- spec/support/crud_tests/write/updateOne-pre_2.6.yml
|
521
540
|
- spec/support/crud_tests/write/updateOne.yml
|
@@ -568,6 +587,7 @@ files:
|
|
568
587
|
- spec/support/sdam/rs/equal_electionids.yml
|
569
588
|
- spec/support/sdam/rs/ghost_discovered.yml
|
570
589
|
- spec/support/sdam/rs/hosts_differ_from_seeds.yml
|
590
|
+
- spec/support/sdam/rs/ls_timeout.yml
|
571
591
|
- spec/support/sdam/rs/member_reconfig.yml
|
572
592
|
- spec/support/sdam/rs/member_standalone.yml
|
573
593
|
- spec/support/sdam/rs/new_primary.yml
|
@@ -582,6 +602,7 @@ files:
|
|
582
602
|
- spec/support/sdam/rs/primary_disconnect.yml
|
583
603
|
- spec/support/sdam/rs/primary_disconnect_electionid.yml
|
584
604
|
- spec/support/sdam/rs/primary_disconnect_setversion.yml
|
605
|
+
- spec/support/sdam/rs/primary_hint_from_secondary_with_mismatched_me.yml
|
585
606
|
- spec/support/sdam/rs/primary_mismatched_me.yml
|
586
607
|
- spec/support/sdam/rs/primary_reports_new_member.yml
|
587
608
|
- spec/support/sdam/rs/primary_to_no_primary_mismatched_me.yml
|
@@ -598,6 +619,7 @@ files:
|
|
598
619
|
- spec/support/sdam/rs/unexpected_mongos.yml
|
599
620
|
- spec/support/sdam/rs/use_setversion_without_electionid.yml
|
600
621
|
- spec/support/sdam/rs/wrong_set_name.yml
|
622
|
+
- spec/support/sdam/sharded/ls_timeout_mongos.yml
|
601
623
|
- spec/support/sdam/sharded/mongos_disconnect.yml
|
602
624
|
- spec/support/sdam/sharded/multiple_mongoses.yml
|
603
625
|
- spec/support/sdam/sharded/non_mongos_removed.yml
|
@@ -610,6 +632,7 @@ files:
|
|
610
632
|
- spec/support/sdam/single/direct_connection_rssecondary.yml
|
611
633
|
- spec/support/sdam/single/direct_connection_slave.yml
|
612
634
|
- spec/support/sdam/single/direct_connection_standalone.yml
|
635
|
+
- spec/support/sdam/single/ls_timeout_standalone.yml
|
613
636
|
- spec/support/sdam/single/not_ok_response.yml
|
614
637
|
- spec/support/sdam/single/standalone_removed.yml
|
615
638
|
- spec/support/sdam/single/unavailable_seed.yml
|
@@ -657,6 +680,7 @@ files:
|
|
657
680
|
- spec/support/server_selection_rtt.rb
|
658
681
|
- spec/support/shared/protocol.rb
|
659
682
|
- spec/support/shared/server_selector.rb
|
683
|
+
- spec/support/shared/session.rb
|
660
684
|
- spec/support/travis.rb
|
661
685
|
homepage: http://www.mongodb.org
|
662
686
|
licenses:
|
@@ -673,12 +697,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
673
697
|
version: '0'
|
674
698
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
675
699
|
requirements:
|
676
|
-
- - "
|
700
|
+
- - ">"
|
677
701
|
- !ruby/object:Gem::Version
|
678
|
-
version:
|
702
|
+
version: 1.3.1
|
679
703
|
requirements: []
|
680
704
|
rubyforge_project:
|
681
|
-
rubygems_version: 2.
|
705
|
+
rubygems_version: 2.6.11
|
682
706
|
signing_key:
|
683
707
|
specification_version: 4
|
684
708
|
summary: Ruby driver for MongoDB
|
@@ -715,6 +739,7 @@ test_files:
|
|
715
739
|
- spec/mongo/collection/view/builder/flags_spec.rb
|
716
740
|
- spec/mongo/collection/view/builder/modifiers_spec.rb
|
717
741
|
- spec/mongo/collection/view/builder/op_query_spec.rb
|
742
|
+
- spec/mongo/collection/view/change_stream_spec.rb
|
718
743
|
- spec/mongo/collection/view/explainable_spec.rb
|
719
744
|
- spec/mongo/collection/view/immutable_spec.rb
|
720
745
|
- spec/mongo/collection/view/map_reduce_spec.rb
|
@@ -777,11 +802,14 @@ test_files:
|
|
777
802
|
- spec/mongo/operation/write/update_spec.rb
|
778
803
|
- spec/mongo/operation/write/update_user_spec.rb
|
779
804
|
- spec/mongo/options/redacted_spec.rb
|
805
|
+
- spec/mongo/protocol/compressed_spec.rb
|
780
806
|
- spec/mongo/protocol/delete_spec.rb
|
781
807
|
- spec/mongo/protocol/get_more_spec.rb
|
782
808
|
- spec/mongo/protocol/insert_spec.rb
|
783
809
|
- spec/mongo/protocol/kill_cursors_spec.rb
|
810
|
+
- spec/mongo/protocol/msg_spec.rb
|
784
811
|
- spec/mongo/protocol/query_spec.rb
|
812
|
+
- spec/mongo/protocol/registry_spec.rb
|
785
813
|
- spec/mongo/protocol/reply_spec.rb
|
786
814
|
- spec/mongo/protocol/update_spec.rb
|
787
815
|
- spec/mongo/retryable_spec.rb
|
@@ -805,6 +833,8 @@ test_files:
|
|
805
833
|
- spec/mongo/server_selector/secondary_spec.rb
|
806
834
|
- spec/mongo/server_selector_spec.rb
|
807
835
|
- spec/mongo/server_spec.rb
|
836
|
+
- spec/mongo/session/server_session_spec.rb
|
837
|
+
- spec/mongo/session/session_pool_spec.rb
|
808
838
|
- spec/mongo/shell_examples_spec.rb
|
809
839
|
- spec/mongo/socket/ssl_spec.rb
|
810
840
|
- spec/mongo/socket/unix_spec.rb
|
@@ -864,6 +894,7 @@ test_files:
|
|
864
894
|
- spec/support/crud_tests/write/findOneAndReplace-upsert.yml
|
865
895
|
- spec/support/crud_tests/write/findOneAndReplace-upsert_pre_2.6.yml
|
866
896
|
- spec/support/crud_tests/write/findOneAndReplace.yml
|
897
|
+
- spec/support/crud_tests/write/findOneAndUpdate-arrayFilters.yml
|
867
898
|
- spec/support/crud_tests/write/findOneAndUpdate-collation.yml
|
868
899
|
- spec/support/crud_tests/write/findOneAndUpdate.yml
|
869
900
|
- spec/support/crud_tests/write/insertMany.yml
|
@@ -872,9 +903,11 @@ test_files:
|
|
872
903
|
- spec/support/crud_tests/write/replaceOne-pre_2.6.yml
|
873
904
|
- spec/support/crud_tests/write/replaceOne-upsert.yml
|
874
905
|
- spec/support/crud_tests/write/replaceOne.yml
|
906
|
+
- spec/support/crud_tests/write/updateMany-arrayFilters.yml
|
875
907
|
- spec/support/crud_tests/write/updateMany-collation.yml
|
876
908
|
- spec/support/crud_tests/write/updateMany-pre_2.6.yml
|
877
909
|
- spec/support/crud_tests/write/updateMany.yml
|
910
|
+
- spec/support/crud_tests/write/updateOne-arrayFilters.yml
|
878
911
|
- spec/support/crud_tests/write/updateOne-collation.yml
|
879
912
|
- spec/support/crud_tests/write/updateOne-pre_2.6.yml
|
880
913
|
- spec/support/crud_tests/write/updateOne.yml
|
@@ -927,6 +960,7 @@ test_files:
|
|
927
960
|
- spec/support/sdam/rs/equal_electionids.yml
|
928
961
|
- spec/support/sdam/rs/ghost_discovered.yml
|
929
962
|
- spec/support/sdam/rs/hosts_differ_from_seeds.yml
|
963
|
+
- spec/support/sdam/rs/ls_timeout.yml
|
930
964
|
- spec/support/sdam/rs/member_reconfig.yml
|
931
965
|
- spec/support/sdam/rs/member_standalone.yml
|
932
966
|
- spec/support/sdam/rs/new_primary.yml
|
@@ -941,6 +975,7 @@ test_files:
|
|
941
975
|
- spec/support/sdam/rs/primary_disconnect.yml
|
942
976
|
- spec/support/sdam/rs/primary_disconnect_electionid.yml
|
943
977
|
- spec/support/sdam/rs/primary_disconnect_setversion.yml
|
978
|
+
- spec/support/sdam/rs/primary_hint_from_secondary_with_mismatched_me.yml
|
944
979
|
- spec/support/sdam/rs/primary_mismatched_me.yml
|
945
980
|
- spec/support/sdam/rs/primary_reports_new_member.yml
|
946
981
|
- spec/support/sdam/rs/primary_to_no_primary_mismatched_me.yml
|
@@ -957,6 +992,7 @@ test_files:
|
|
957
992
|
- spec/support/sdam/rs/unexpected_mongos.yml
|
958
993
|
- spec/support/sdam/rs/use_setversion_without_electionid.yml
|
959
994
|
- spec/support/sdam/rs/wrong_set_name.yml
|
995
|
+
- spec/support/sdam/sharded/ls_timeout_mongos.yml
|
960
996
|
- spec/support/sdam/sharded/mongos_disconnect.yml
|
961
997
|
- spec/support/sdam/sharded/multiple_mongoses.yml
|
962
998
|
- spec/support/sdam/sharded/non_mongos_removed.yml
|
@@ -969,6 +1005,7 @@ test_files:
|
|
969
1005
|
- spec/support/sdam/single/direct_connection_rssecondary.yml
|
970
1006
|
- spec/support/sdam/single/direct_connection_slave.yml
|
971
1007
|
- spec/support/sdam/single/direct_connection_standalone.yml
|
1008
|
+
- spec/support/sdam/single/ls_timeout_standalone.yml
|
972
1009
|
- spec/support/sdam/single/not_ok_response.yml
|
973
1010
|
- spec/support/sdam/single/standalone_removed.yml
|
974
1011
|
- spec/support/sdam/single/unavailable_seed.yml
|
@@ -1016,4 +1053,5 @@ test_files:
|
|
1016
1053
|
- spec/support/server_selection_rtt.rb
|
1017
1054
|
- spec/support/shared/protocol.rb
|
1018
1055
|
- spec/support/shared/server_selector.rb
|
1056
|
+
- spec/support/shared/session.rb
|
1019
1057
|
- spec/support/travis.rb
|