mongo 2.4.0.rc1 → 2.4.0
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 +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mongo/auth/cr/conversation.rb +1 -1
- data/lib/mongo/auth/ldap/conversation.rb +1 -1
- data/lib/mongo/auth/scram/conversation.rb +1 -1
- data/lib/mongo/auth/x509/conversation.rb +4 -2
- data/lib/mongo/client.rb +7 -4
- data/lib/mongo/cluster.rb +55 -5
- data/lib/mongo/cluster/app_metadata.rb +7 -1
- data/lib/mongo/cluster/topology.rb +7 -6
- data/lib/mongo/cluster/topology/replica_set.rb +48 -2
- data/lib/mongo/cluster/topology/sharded.rb +47 -1
- data/lib/mongo/cluster/topology/single.rb +55 -4
- data/lib/mongo/cluster/topology/unknown.rb +65 -9
- data/lib/mongo/error/invalid_server_preference.rb +3 -1
- data/lib/mongo/event.rb +8 -0
- data/lib/mongo/event/description_changed.rb +20 -2
- data/lib/mongo/event/member_discovered.rb +65 -0
- data/lib/mongo/event/primary_elected.rb +3 -1
- data/lib/mongo/event/standalone_discovered.rb +1 -1
- data/lib/mongo/monitoring.rb +41 -0
- data/lib/mongo/monitoring/event.rb +6 -0
- data/lib/mongo/monitoring/event/server_closed.rb +46 -0
- data/lib/mongo/monitoring/event/server_description_changed.rb +58 -0
- data/lib/mongo/monitoring/event/server_opening.rb +46 -0
- data/lib/mongo/monitoring/event/topology_changed.rb +46 -0
- data/lib/mongo/monitoring/event/topology_closed.rb +41 -0
- data/lib/mongo/monitoring/event/topology_opening.rb +41 -0
- data/lib/mongo/monitoring/publishable.rb +12 -0
- data/lib/mongo/monitoring/sdam_log_subscriber.rb +54 -0
- data/lib/mongo/monitoring/server_closed_log_subscriber.rb +30 -0
- data/lib/mongo/monitoring/server_description_changed_log_subscriber.rb +33 -0
- data/lib/mongo/monitoring/server_opening_log_subscriber.rb +30 -0
- data/lib/mongo/monitoring/topology_changed_log_subscriber.rb +40 -0
- data/lib/mongo/monitoring/topology_opening_log_subscriber.rb +30 -0
- data/lib/mongo/server.rb +6 -0
- data/lib/mongo/server/connection.rb +1 -1
- data/lib/mongo/server/description.rb +23 -3
- data/lib/mongo/server/description/inspector.rb +4 -2
- data/lib/mongo/server/description/inspector/description_changed.rb +2 -2
- data/lib/mongo/server/description/inspector/member_discovered.rb +59 -0
- data/lib/mongo/server/description/inspector/primary_elected.rb +2 -0
- data/lib/mongo/server_selector.rb +10 -5
- data/lib/mongo/server_selector/nearest.rb +1 -1
- data/lib/mongo/server_selector/primary_preferred.rb +1 -1
- data/lib/mongo/server_selector/secondary.rb +1 -1
- data/lib/mongo/server_selector/secondary_preferred.rb +1 -1
- data/lib/mongo/server_selector/selectable.rb +24 -12
- data/lib/mongo/uri.rb +1 -1
- data/lib/mongo/version.rb +1 -1
- data/mongo.gemspec +1 -1
- data/spec/mongo/auth/cr_spec.rb +6 -1
- data/spec/mongo/auth/ldap_spec.rb +6 -1
- data/spec/mongo/auth/scram_spec.rb +6 -1
- data/spec/mongo/auth/x509/conversation_spec.rb +69 -0
- data/spec/mongo/auth/x509_spec.rb +9 -4
- data/spec/mongo/client_spec.rb +40 -2
- data/spec/mongo/cluster/topology/replica_set_spec.rb +218 -9
- data/spec/mongo/cluster/topology/sharded_spec.rb +17 -2
- data/spec/mongo/cluster/topology/single_spec.rb +19 -4
- data/spec/mongo/cluster/topology/unknown_spec.rb +19 -1
- data/spec/mongo/cluster/topology_spec.rb +11 -7
- data/spec/mongo/cluster_spec.rb +25 -7
- data/spec/mongo/max_staleness_spec.rb +40 -22
- data/spec/mongo/monitoring_spec.rb +2 -2
- data/spec/mongo/sdam_monitoring_spec.rb +60 -0
- data/spec/mongo/sdam_spec.rb +77 -0
- data/spec/mongo/server/connection_pool_spec.rb +6 -1
- data/spec/mongo/server/connection_spec.rb +6 -1
- data/spec/mongo/server/description_spec.rb +90 -1
- data/spec/mongo/server_selection_spec.rb +7 -6
- data/spec/mongo/server_selector/nearest_spec.rb +7 -7
- data/spec/mongo/server_selector/primary_preferred_spec.rb +7 -7
- data/spec/mongo/server_selector/primary_spec.rb +4 -4
- data/spec/mongo/server_selector/secondary_preferred_spec.rb +6 -6
- data/spec/mongo/server_selector/secondary_spec.rb +6 -6
- data/spec/mongo/server_selector_spec.rb +8 -0
- data/spec/mongo/server_spec.rb +6 -1
- data/spec/mongo/uri_spec.rb +4 -4
- data/spec/spec_helper.rb +2 -0
- data/spec/support/max_staleness/ReplicaSetNoPrimary/Incompatible.yml +4 -4
- data/spec/support/max_staleness/ReplicaSetNoPrimary/LastUpdateTime.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetNoPrimary/Nearest.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetNoPrimary/Nearest2.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetNoPrimary/NoKnownServers.yml +15 -0
- data/spec/support/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred.yml +1 -1
- data/spec/support/max_staleness/ReplicaSetNoPrimary/PrimaryPreferred_tags.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetNoPrimary/Secondary.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred.yml +1 -1
- data/spec/support/max_staleness/ReplicaSetNoPrimary/SecondaryPreferred_tags.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetNoPrimary/ZeroMaxStaleness.yml +23 -0
- data/spec/support/max_staleness/ReplicaSetWithPrimary/Incompatible.yml +4 -4
- data/spec/support/max_staleness/ReplicaSetWithPrimary/LastUpdateTime.yml +5 -5
- data/spec/support/max_staleness/ReplicaSetWithPrimary/{ShortHeartbeartShortMaxStaleness2.yml → LongHeartbeat.yml} +4 -4
- data/spec/support/max_staleness/ReplicaSetWithPrimary/{ShortHeartbeartShortMaxStaleness.yml → LongHeartbeat2.yml} +6 -10
- data/spec/support/max_staleness/ReplicaSetWithPrimary/MaxStalenessTooSmall.yml +3 -2
- data/spec/support/max_staleness/ReplicaSetWithPrimary/MaxStalenessWithModePrimary.yml +2 -2
- data/spec/support/max_staleness/ReplicaSetWithPrimary/Nearest.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetWithPrimary/Nearest2.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetWithPrimary/Nearest_tags.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetWithPrimary/PrimaryPreferred.yml +2 -2
- data/spec/support/max_staleness/ReplicaSetWithPrimary/PrimaryPreferred_incompatible.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred.yml +1 -1
- data/spec/support/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetWithPrimary/SecondaryPreferred_tags2.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetWithPrimary/Secondary_tags.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetWithPrimary/Secondary_tags2.yml +3 -3
- data/spec/support/max_staleness/ReplicaSetWithPrimary/ZeroMaxStaleness.yml +7 -11
- data/spec/support/max_staleness/Sharded/Incompatible.yml +4 -4
- data/spec/support/max_staleness/Sharded/SmallMaxStaleness.yml +10 -2
- data/spec/support/max_staleness/Single/Incompatible.yml +4 -4
- data/spec/support/max_staleness/Single/SmallMaxStaleness.yml +2 -2
- data/spec/support/max_staleness/Unknown/SmallMaxStaleness.yml +14 -0
- data/spec/support/sdam/rs/primary_mismatched_me.yml +2 -2
- data/spec/support/sdam/rs/secondary_mismatched_me.yml +2 -2
- data/spec/support/sdam_monitoring.rb +144 -0
- data/spec/support/sdam_monitoring/replica_set_with_no_primary.yml +112 -0
- data/spec/support/sdam_monitoring/replica_set_with_primary.yml +111 -0
- data/spec/support/sdam_monitoring/replica_set_with_removal.yml +106 -0
- data/spec/support/sdam_monitoring/required_replica_set.yml +84 -0
- data/spec/support/sdam_monitoring/standalone.yml +70 -0
- data/spec/support/server_discovery_and_monitoring.rb +34 -1
- data/spec/support/server_selection.rb +14 -11
- data/spec/support/shared/server_selector.rb +6 -0
- metadata +49 -13
- metadata.gz.sig +0 -0
- data/spec/mongo/server_discovery_and_monitoring_spec.rb +0 -115
@@ -18,7 +18,7 @@ describe Mongo::ServerSelector::Secondary do
|
|
18
18
|
context 'when max_staleness is provided' do
|
19
19
|
|
20
20
|
let(:options) do
|
21
|
-
{ max_staleness:
|
21
|
+
{ max_staleness: 100 }
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'sets the max_staleness option' do
|
@@ -32,7 +32,7 @@ describe Mongo::ServerSelector::Secondary do
|
|
32
32
|
context 'when max staleness is the same' do
|
33
33
|
|
34
34
|
let(:options) do
|
35
|
-
{ max_staleness:
|
35
|
+
{ max_staleness: 90 }
|
36
36
|
end
|
37
37
|
|
38
38
|
let(:other) do
|
@@ -47,7 +47,7 @@ describe Mongo::ServerSelector::Secondary do
|
|
47
47
|
context 'when max staleness is different' do
|
48
48
|
|
49
49
|
let(:other_options) do
|
50
|
-
{ max_staleness:
|
50
|
+
{ max_staleness: 95 }
|
51
51
|
end
|
52
52
|
|
53
53
|
let(:other) do
|
@@ -96,7 +96,7 @@ describe Mongo::ServerSelector::Secondary do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
let(:expected) do
|
99
|
-
{ :mode => 'secondary',
|
99
|
+
{ :mode => 'secondary', maxStalenessSeconds: 60 }
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'returns a read preference formatted for mongos' do
|
@@ -207,8 +207,8 @@ describe Mongo::ServerSelector::Secondary do
|
|
207
207
|
end
|
208
208
|
|
209
209
|
context 'high latency servers' do
|
210
|
-
let(:far_primary) { make_server(:primary, :average_round_trip_time => 100, address: default_address) }
|
211
|
-
let(:far_secondary) { make_server(:secondary, :average_round_trip_time => 113, address: default_address) }
|
210
|
+
let(:far_primary) { make_server(:primary, :average_round_trip_time => 0.100, address: default_address) }
|
211
|
+
let(:far_secondary) { make_server(:secondary, :average_round_trip_time => 0.113, address: default_address) }
|
212
212
|
|
213
213
|
context 'single candidate' do
|
214
214
|
|
@@ -150,9 +150,11 @@ describe Mongo::ServerSelector do
|
|
150
150
|
|
151
151
|
let(:cluster) do
|
152
152
|
double('cluster').tap do |c|
|
153
|
+
allow(c).to receive(:topology).and_return(topology)
|
153
154
|
allow(c).to receive(:servers).and_return(servers)
|
154
155
|
allow(c).to receive(:single?).and_return(false)
|
155
156
|
allow(c).to receive(:sharded?).and_return(false)
|
157
|
+
allow(c).to receive(:unknown?).and_return(false)
|
156
158
|
allow(c).to receive(:scan!).and_return(true)
|
157
159
|
allow(c).to receive(:options).and_return(server_selection_timeout: 0.1)
|
158
160
|
end
|
@@ -179,9 +181,11 @@ describe Mongo::ServerSelector do
|
|
179
181
|
|
180
182
|
let(:cluster) do
|
181
183
|
double('cluster').tap do |c|
|
184
|
+
allow(c).to receive(:topology).and_return(topology)
|
182
185
|
allow(c).to receive(:servers).and_return(servers)
|
183
186
|
allow(c).to receive(:single?).and_return(false)
|
184
187
|
allow(c).to receive(:sharded?).and_return(false)
|
188
|
+
allow(c).to receive(:unknown?).and_return(false)
|
185
189
|
allow(c).to receive(:scan!).and_return(true)
|
186
190
|
allow(c).to receive(:options).and_return(server_selection_timeout: 0)
|
187
191
|
end
|
@@ -220,9 +224,11 @@ describe Mongo::ServerSelector do
|
|
220
224
|
|
221
225
|
let(:cluster) do
|
222
226
|
double('cluster').tap do |c|
|
227
|
+
allow(c).to receive(:topology).and_return(topology)
|
223
228
|
allow(c).to receive(:servers).and_return(servers)
|
224
229
|
allow(c).to receive(:single?).and_return(false)
|
225
230
|
allow(c).to receive(:sharded?).and_return(false)
|
231
|
+
allow(c).to receive(:unknown?).and_return(false)
|
226
232
|
allow(c).to receive(:scan!).and_return(true)
|
227
233
|
allow(c).to receive(:options).and_return(local_threshold: 0.050)
|
228
234
|
end
|
@@ -248,9 +254,11 @@ describe Mongo::ServerSelector do
|
|
248
254
|
|
249
255
|
let(:cluster) do
|
250
256
|
double('cluster').tap do |c|
|
257
|
+
allow(c).to receive(:topology).and_return(topology)
|
251
258
|
allow(c).to receive(:servers).and_return(servers)
|
252
259
|
allow(c).to receive(:single?).and_return(single)
|
253
260
|
allow(c).to receive(:sharded?).and_return(sharded)
|
261
|
+
allow(c).to receive(:unknown?).and_return(false)
|
254
262
|
allow(c).to receive(:scan!).and_return(true)
|
255
263
|
allow(c).to receive(:options).and_return(server_selection_timeout: 0.1)
|
256
264
|
end
|
data/spec/mongo/server_spec.rb
CHANGED
@@ -2,8 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Mongo::Server do
|
4
4
|
|
5
|
+
let(:topology) do
|
6
|
+
double('topology')
|
7
|
+
end
|
8
|
+
|
5
9
|
let(:cluster) do
|
6
10
|
double('cluster').tap do |cl|
|
11
|
+
allow(cl).to receive(:topology).and_return(topology)
|
7
12
|
allow(cl).to receive(:app_metadata).and_return(app_metadata)
|
8
13
|
end
|
9
14
|
end
|
@@ -13,7 +18,7 @@ describe Mongo::Server do
|
|
13
18
|
end
|
14
19
|
|
15
20
|
let(:monitoring) do
|
16
|
-
Mongo::Monitoring.new
|
21
|
+
Mongo::Monitoring.new(monitoring: false)
|
17
22
|
end
|
18
23
|
|
19
24
|
let(:address) do
|
data/spec/mongo/uri_spec.rb
CHANGED
@@ -541,7 +541,7 @@ describe Mongo::URI do
|
|
541
541
|
context 'read preference max staleness option provided' do
|
542
542
|
|
543
543
|
let(:options) do
|
544
|
-
'readPreference=Secondary&
|
544
|
+
'readPreference=Secondary&maxStalenessSeconds=120'
|
545
545
|
end
|
546
546
|
|
547
547
|
let(:read) do
|
@@ -561,7 +561,7 @@ describe Mongo::URI do
|
|
561
561
|
context 'when max staleness is combined with read preference mode primary' do
|
562
562
|
|
563
563
|
let(:options) do
|
564
|
-
'readPreference=primary&
|
564
|
+
'readPreference=primary&maxStalenessSeconds=120'
|
565
565
|
end
|
566
566
|
|
567
567
|
it 'raises an exception when read preference is accessed on the client' do
|
@@ -571,10 +571,10 @@ describe Mongo::URI do
|
|
571
571
|
end
|
572
572
|
end
|
573
573
|
|
574
|
-
context 'when the max staleness value is
|
574
|
+
context 'when the max staleness value is too small' do
|
575
575
|
|
576
576
|
let(:options) do
|
577
|
-
'readPreference=secondary&
|
577
|
+
'readPreference=secondary&maxStalenessSeconds=89'
|
578
578
|
end
|
579
579
|
|
580
580
|
it 'does not raise an exception until the read preference is used' do
|
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,7 @@ TEST_SET = 'ruby-driver-rs'
|
|
2
2
|
COVERAGE_MIN = 90
|
3
3
|
CURRENT_PATH = File.expand_path(File.dirname(__FILE__))
|
4
4
|
SERVER_DISCOVERY_TESTS = Dir.glob("#{CURRENT_PATH}/support/sdam/**/*.yml")
|
5
|
+
SDAM_MONITORING_TESTS = Dir.glob("#{CURRENT_PATH}/support/sdam_monitoring/*.yml")
|
5
6
|
SERVER_SELECTION_RTT_TESTS = Dir.glob("#{CURRENT_PATH}/support/server_selection/rtt/*.yml")
|
6
7
|
SERVER_SELECTION_TESTS = Dir.glob("#{CURRENT_PATH}/support/server_selection/selection/**/*.yml")
|
7
8
|
MAX_STALENESS_TESTS = Dir.glob("#{CURRENT_PATH}/support/max_staleness/**/*.yml")
|
@@ -31,6 +32,7 @@ require 'support/authorization'
|
|
31
32
|
require 'support/server_discovery_and_monitoring'
|
32
33
|
require 'support/server_selection_rtt'
|
33
34
|
require 'support/server_selection'
|
35
|
+
require 'support/sdam_monitoring'
|
34
36
|
require 'support/crud'
|
35
37
|
require 'support/command_monitoring'
|
36
38
|
require 'support/connection_string'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# During server selection,
|
2
|
-
#
|
3
|
-
#
|
1
|
+
# During server selection, clients (drivers or mongos) MUST raise an error if
|
2
|
+
# maxStalenessSeconds is defined and not -1 and any server's ``maxWireVersion``
|
3
|
+
# is less than 5 (`SERVER-23893`_).
|
4
4
|
---
|
5
5
|
topology_description:
|
6
6
|
type: ReplicaSetNoPrimary
|
@@ -21,5 +21,5 @@ topology_description:
|
|
21
21
|
lastWrite: {lastWriteDate: {$numberLong: "1"}}
|
22
22
|
read_preference:
|
23
23
|
mode: Nearest
|
24
|
-
|
24
|
+
maxStalenessSeconds: 120
|
25
25
|
error: true
|
@@ -7,14 +7,14 @@ topology_description:
|
|
7
7
|
type: RSSecondary
|
8
8
|
avg_rtt_ms: 5
|
9
9
|
lastUpdateTime: 1
|
10
|
-
lastWrite: {lastWriteDate: {$numberLong: "
|
10
|
+
lastWrite: {lastWriteDate: {$numberLong: "125002"}}
|
11
11
|
maxWireVersion: 5
|
12
12
|
- &2
|
13
13
|
address: b:27017
|
14
14
|
type: RSSecondary
|
15
15
|
avg_rtt_ms: 50 # Too far.
|
16
16
|
lastUpdateTime: 25002 # Not used when there's no primary.
|
17
|
-
lastWrite: {lastWriteDate: {$numberLong: "2"}} #
|
17
|
+
lastWrite: {lastWriteDate: {$numberLong: "2"}} # 125 sec stale + 25 sec heartbeat <= 150 sec maxStaleness.
|
18
18
|
maxWireVersion: 5
|
19
19
|
- &3
|
20
20
|
address: c:27017
|
@@ -25,7 +25,7 @@ topology_description:
|
|
25
25
|
maxWireVersion: 5
|
26
26
|
read_preference:
|
27
27
|
mode: Nearest
|
28
|
-
|
28
|
+
maxStalenessSeconds: 150
|
29
29
|
suitable_servers:
|
30
30
|
- *1
|
31
31
|
- *2
|
@@ -7,14 +7,14 @@ topology_description:
|
|
7
7
|
type: RSSecondary
|
8
8
|
avg_rtt_ms: 5
|
9
9
|
lastUpdateTime: 0
|
10
|
-
lastWrite: {lastWriteDate: {$numberLong: "
|
10
|
+
lastWrite: {lastWriteDate: {$numberLong: "125002"}}
|
11
11
|
maxWireVersion: 5
|
12
12
|
- &2
|
13
13
|
address: b:27017
|
14
14
|
type: RSSecondary
|
15
15
|
avg_rtt_ms: 50 # Too far.
|
16
16
|
lastUpdateTime: 0
|
17
|
-
lastWrite: {lastWriteDate: {$numberLong: "2"}} #
|
17
|
+
lastWrite: {lastWriteDate: {$numberLong: "2"}} # 125 sec stale + 25 sec heartbeat <= 150 sec maxStaleness.
|
18
18
|
maxWireVersion: 5
|
19
19
|
- &3
|
20
20
|
address: c:27017
|
@@ -25,7 +25,7 @@ topology_description:
|
|
25
25
|
maxWireVersion: 5
|
26
26
|
read_preference:
|
27
27
|
mode: Nearest
|
28
|
-
|
28
|
+
maxStalenessSeconds: 150
|
29
29
|
suitable_servers:
|
30
30
|
- *1
|
31
31
|
- *2
|
@@ -7,14 +7,14 @@ topology_description:
|
|
7
7
|
type: RSSecondary
|
8
8
|
avg_rtt_ms: 50 # Too far.
|
9
9
|
lastUpdateTime: 0
|
10
|
-
lastWrite: {lastWriteDate: {$numberLong: "
|
10
|
+
lastWrite: {lastWriteDate: {$numberLong: "125002"}}
|
11
11
|
maxWireVersion: 5
|
12
12
|
- &2
|
13
13
|
address: b:27017
|
14
14
|
type: RSSecondary
|
15
15
|
avg_rtt_ms: 5
|
16
16
|
lastUpdateTime: 0
|
17
|
-
lastWrite: {lastWriteDate: {$numberLong: "2"}} #
|
17
|
+
lastWrite: {lastWriteDate: {$numberLong: "2"}} # 125 sec stale + 25 sec heartbeat <= 150 sec maxStaleness.
|
18
18
|
maxWireVersion: 5
|
19
19
|
- &3
|
20
20
|
address: c:27017
|
@@ -25,7 +25,7 @@ topology_description:
|
|
25
25
|
maxWireVersion: 5
|
26
26
|
read_preference:
|
27
27
|
mode: Nearest
|
28
|
-
|
28
|
+
maxStalenessSeconds: 150
|
29
29
|
suitable_servers:
|
30
30
|
- *1
|
31
31
|
- *2
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# maxStalenessSeconds must be at least 90 seconds, even with no known servers.
|
2
|
+
---
|
3
|
+
topology_description:
|
4
|
+
type: ReplicaSetNoPrimary
|
5
|
+
servers:
|
6
|
+
- &1
|
7
|
+
address: a:27017
|
8
|
+
type: Unknown
|
9
|
+
- &2
|
10
|
+
address: b:27017
|
11
|
+
type: Unknown
|
12
|
+
read_preference:
|
13
|
+
mode: Nearest
|
14
|
+
maxStalenessSeconds: 1 # Too small.
|
15
|
+
error: true
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# maxStalenessSeconds is applied before tag sets. With tag sets
|
2
2
|
# [{data_center: nyc}, {data_center: tokyo}], if the only node in NYC is stale
|
3
3
|
# then use Tokyo.
|
4
4
|
---
|
@@ -11,7 +11,7 @@ topology_description:
|
|
11
11
|
type: RSSecondary
|
12
12
|
avg_rtt_ms: 5
|
13
13
|
lastUpdateTime: 0
|
14
|
-
lastWrite: {lastWriteDate: {$numberLong: "
|
14
|
+
lastWrite: {lastWriteDate: {$numberLong: "125002"}}
|
15
15
|
maxWireVersion: 5
|
16
16
|
tags:
|
17
17
|
data_center: tokyo # Matches second tag set.
|
@@ -26,7 +26,7 @@ topology_description:
|
|
26
26
|
data_center: nyc
|
27
27
|
read_preference:
|
28
28
|
mode: PrimaryPreferred
|
29
|
-
|
29
|
+
maxStalenessSeconds: 150
|
30
30
|
tag_sets:
|
31
31
|
- data_center: nyc
|
32
32
|
- data_center: tokyo
|
@@ -10,7 +10,7 @@ topology_description:
|
|
10
10
|
avg_rtt_ms: 5
|
11
11
|
lastUpdateTime: 0
|
12
12
|
maxWireVersion: 5
|
13
|
-
lastWrite: {lastWriteDate: {$numberLong: "
|
13
|
+
lastWrite: {lastWriteDate: {$numberLong: "125002"}}
|
14
14
|
tags:
|
15
15
|
data_center: tokyo # No match, but its lastWriteDate is used in estimate.
|
16
16
|
- &2
|
@@ -19,7 +19,7 @@ topology_description:
|
|
19
19
|
avg_rtt_ms: 5
|
20
20
|
lastUpdateTime: 0
|
21
21
|
maxWireVersion: 5
|
22
|
-
lastWrite: {lastWriteDate: {$numberLong: "2"}} #
|
22
|
+
lastWrite: {lastWriteDate: {$numberLong: "2"}} # 125 sec stale + 25 sec heartbeat <= 150 sec maxStaleness.
|
23
23
|
tags:
|
24
24
|
data_center: nyc
|
25
25
|
- &3
|
@@ -42,7 +42,7 @@ topology_description:
|
|
42
42
|
data_center: tokyo # No match.
|
43
43
|
read_preference:
|
44
44
|
mode: Secondary
|
45
|
-
|
45
|
+
maxStalenessSeconds: 150
|
46
46
|
tag_sets:
|
47
47
|
- data_center: nyc
|
48
48
|
suitable_servers:
|
@@ -10,7 +10,7 @@ topology_description:
|
|
10
10
|
avg_rtt_ms: 5
|
11
11
|
lastUpdateTime: 0
|
12
12
|
maxWireVersion: 5
|
13
|
-
lastWrite: {lastWriteDate: {$numberLong: "
|
13
|
+
lastWrite: {lastWriteDate: {$numberLong: "125002"}}
|
14
14
|
tags:
|
15
15
|
data_center: tokyo # No match, but its lastWriteDate is used in estimate.
|
16
16
|
- &2
|
@@ -19,7 +19,7 @@ topology_description:
|
|
19
19
|
avg_rtt_ms: 5
|
20
20
|
lastUpdateTime: 0
|
21
21
|
maxWireVersion: 5
|
22
|
-
lastWrite: {lastWriteDate: {$numberLong: "2"}} #
|
22
|
+
lastWrite: {lastWriteDate: {$numberLong: "2"}} # 125 sec stale + 25 sec heartbeat <= 150 sec maxStaleness.
|
23
23
|
tags:
|
24
24
|
data_center: nyc
|
25
25
|
- &3
|
@@ -42,7 +42,7 @@ topology_description:
|
|
42
42
|
data_center: tokyo # No match.
|
43
43
|
read_preference:
|
44
44
|
mode: SecondaryPreferred
|
45
|
-
|
45
|
+
maxStalenessSeconds: 150
|
46
46
|
tag_sets:
|
47
47
|
- data_center: nyc
|
48
48
|
suitable_servers:
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# maxStalenessSeconds=0 is prohibited.
|
2
|
+
---
|
3
|
+
topology_description:
|
4
|
+
type: ReplicaSetNoPrimary
|
5
|
+
servers:
|
6
|
+
- &1
|
7
|
+
address: a:27017
|
8
|
+
type: RSSecondary
|
9
|
+
avg_rtt_ms: 5
|
10
|
+
lastUpdateTime: 0
|
11
|
+
maxWireVersion: 5
|
12
|
+
lastWrite: {lastWriteDate: {$numberLong: "2"}}
|
13
|
+
- &2
|
14
|
+
address: b:27017
|
15
|
+
type: RSSecondary
|
16
|
+
avg_rtt_ms: 5
|
17
|
+
lastUpdateTime: 0
|
18
|
+
maxWireVersion: 4 # Incompatible.
|
19
|
+
lastWrite: {lastWriteDate: {$numberLong: "1"}}
|
20
|
+
read_preference:
|
21
|
+
mode: Nearest
|
22
|
+
maxStalenessSeconds: 0
|
23
|
+
error: true
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# During server selection,
|
2
|
-
#
|
3
|
-
#
|
1
|
+
# During server selection, clients (drivers or mongos) MUST raise an error if
|
2
|
+
# maxStalenessSeconds is defined and not -1 and any server's ``maxWireVersion``
|
3
|
+
# is less than 5 (`SERVER-23893`_).
|
4
4
|
---
|
5
5
|
topology_description:
|
6
6
|
type: ReplicaSetWithPrimary
|
@@ -21,5 +21,5 @@ topology_description:
|
|
21
21
|
lastWrite: {lastWriteDate: {$numberLong: "1"}}
|
22
22
|
read_preference:
|
23
23
|
mode: Nearest
|
24
|
-
|
24
|
+
maxStalenessSeconds: 120
|
25
25
|
error: true
|
@@ -13,21 +13,21 @@ topology_description:
|
|
13
13
|
address: b:27017
|
14
14
|
type: RSSecondary
|
15
15
|
avg_rtt_ms: 5
|
16
|
-
lastUpdateTime:
|
17
|
-
# Updated
|
18
|
-
#
|
16
|
+
lastUpdateTime: 125001
|
17
|
+
# Updated 125 sec after primary, so 125 sec stale.
|
18
|
+
# 125 sec stale + 25 sec heartbeat <= 150 sec maxStaleness.
|
19
19
|
lastWrite: {lastWriteDate: {$numberLong: "2"}}
|
20
20
|
maxWireVersion: 5
|
21
21
|
- &3
|
22
22
|
address: c:27017
|
23
23
|
type: RSSecondary
|
24
24
|
avg_rtt_ms: 5
|
25
|
-
lastUpdateTime:
|
25
|
+
lastUpdateTime: 125001
|
26
26
|
lastWrite: {lastWriteDate: {$numberLong: "1"}} # Too stale.
|
27
27
|
maxWireVersion: 5
|
28
28
|
read_preference:
|
29
29
|
mode: Nearest
|
30
|
-
|
30
|
+
maxStalenessSeconds: 150
|
31
31
|
suitable_servers:
|
32
32
|
- *1
|
33
33
|
- *2
|
@@ -1,7 +1,7 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# If users configure a longer ``heartbeatFrequencyMS`` than the default,
|
2
|
+
# ``maxStalenessSeconds`` might have a larger minimum.
|
3
3
|
---
|
4
|
-
heartbeatFrequencyMS:
|
4
|
+
heartbeatFrequencyMS: 120000 # 120 seconds.
|
5
5
|
topology_description:
|
6
6
|
type: ReplicaSetWithPrimary
|
7
7
|
servers:
|
@@ -21,7 +21,7 @@ topology_description:
|
|
21
21
|
lastWrite: {lastWriteDate: {$numberLong: "1"}}
|
22
22
|
read_preference:
|
23
23
|
mode: Nearest
|
24
|
-
|
24
|
+
maxStalenessSeconds: 130 # OK, must be 120 + 10 = 130 seconds.
|
25
25
|
suitable_servers:
|
26
26
|
- *1
|
27
27
|
- *2
|