@@ -24,15 +24,13 @@ The server discovery and monitoring method is specified in four sections. First,
24
24
[ configured] ( #configuration ) . Second, it begins [ monitoring] ( #monitoring ) by calling
25
25
[ hello or legacy hello] ( ../mongodb-handshake/handshake.rst#terms ) on all servers. (Multi-threaded and asynchronous
26
26
monitoring is described first, then single-threaded monitoring.) Third, as hello or legacy hello responses are received
27
- the client [ parses them] ( #parsing-a-hello-or-legacy-hello-response ) , and fourth, it \[ updates its view of the
28
- topology\] (#updates its view of the topology).
27
+ the client [ parses them] ( #parsing-a-hello-or-legacy-hello-response ) , and fourth, it updates its view of the topology.
29
28
30
- Finally, this spec describes how \[ drivers update their topology view in response to errors\] (#drivers update their
31
- topology view in response to errors), and includes generous implementation notes for driver authors.
29
+ Finally, this spec describes how drivers update their topology view in response to errors, and includes generous
30
+ implementation notes for driver authors.
32
31
33
32
This spec does not describe how a client chooses a server for an operation; that is the domain of the Server Selection
34
- Spec. But there is a section describing the \[ interaction between monitoring and server selection\] (#interaction between
35
- monitoring and server selection).
33
+ Spec. But there is a section describing the interaction between monitoring and server selection.
36
34
37
35
There is no discussion of driver architecture and data structures, nor is there any specification of a user-facing API.
38
36
This spec is only concerned with the algorithm for monitoring the server topology.
@@ -206,7 +204,7 @@ Fields:
206
204
increase, as electionId takes precedence in ordering Default null. Part of the (` electionId ` , ` setVersion ` ) tuple.
207
205
- servers: a set of ServerDescription instances. Default contains one server: "localhost:27017", ServerType Unknown.
208
206
- stale: a boolean for single-threaded clients, whether the topology must be re-scanned. (Not related to
209
- maxStalenessSeconds, nor to \[ stale primaries\] (#stale primaries) .)
207
+ maxStalenessSeconds, nor to stale primaries.)
210
208
- compatible: a boolean. False if any server's wire protocol version range is incompatible with the client's. Default
211
209
true.
212
210
- compatibilityError: a string. The error message if "compatible" is false, otherwise null.
@@ -234,13 +232,13 @@ Fields:
234
232
least until
235
233
[ drivers allow applications to use readConcern "afterOptime".] ( ../max-staleness/max-staleness.md#future-feature-to-support-readconcern-afteroptime ) )
236
234
- (=) type: a [ ServerType] ( #servertype ) enum value. Default Unknown.
237
- - (=) minWireVersion, maxWireVersion: the wire protocol version range supported by the server. Both default to 0. \[ Use
238
- min and maxWireVersion only to determine compatibility\ ] (#use min and maxWireVersion only to determine compatibility).
235
+ - (=) minWireVersion, maxWireVersion: the wire protocol version range supported by the server. Both default to 0.
236
+ [ Use min and maxWireVersion only to determine compatibility] ( #checking-wire-protocol- compatibility ) .
239
237
- (=) me: The hostname or IP, and the port number, that this server was configured with in the replica set. Default
240
238
null.
241
239
- (=) hosts, passives, arbiters: Sets of addresses. This server's opinion of the replica set's members, if any. These
242
- [ hostnames are normalized to lower-case] ( #hostnames-are-normalized-to-lower-case ) . Default empty. The client
243
- \[ monitors all three types of servers\] (#monitors all three types of servers) in a replica set.
240
+ [ hostnames are normalized to lower-case] ( #hostnames-are-normalized-to-lower-case ) . Default empty. The client monitors
241
+ all three types of servers in a replica set.
244
242
- (=) tags: map from string to string. Default empty.
245
243
- (=) setName: string or null. Default null.
246
244
- (=) electionId: an ObjectId, if this is a MongoDB 2.6+ replica set member that believes it is primary. See
@@ -575,6 +573,8 @@ Whenever the client checks a server (successfully or not), and regardless of whe
575
573
to the previous server description as defined in [ Server Description Equality] ( #server-description-equality ) , the
576
574
ServerDescription in TopologyDescription.servers MUST be replaced with the new ServerDescription.
577
575
576
+ <span id =" checking-wire-protocol-compatibility " ></span >
577
+
578
578
##### Checking wire protocol compatibility
579
579
580
580
A ServerDescription which is not Unknown is incompatible if:
@@ -960,9 +960,9 @@ See error handling in the [Server Monitoring spec](server-monitoring.rst).
960
960
961
961
#### Application errors
962
962
963
- When processing a network or command error, clients MUST first check the error's \[ generation number\] (#generation
964
- number). If the error's generation number is equal to the pool's generation number then error handling MUST continue
965
- according to [ Network error when reading or writing] ( #network-error-when-reading-or-writing ) or
963
+ When processing a network or command error, clients MUST first check the error's generation number. If the error's
964
+ generation number is equal to the pool's generation number then error handling MUST continue according to
965
+ [ Network error when reading or writing] ( #network-error-when-reading-or-writing ) or
966
966
[ "not writable primary" and "node is recovering"] ( #not-writable-primary-and-node-is-recovering ) . Otherwise, the error is
967
967
considered stale and the client MUST NOT update any topology state. (See
968
968
[ Why ignore errors based on CMAP's generation number?] ( #why-ignore-errors-based-on-cmaps-generation-number ) )
@@ -1275,9 +1275,9 @@ Better to call hello or legacy hello for each new socket, as required by the [Au
1275
1275
hello or legacy hello response associated with that socket for maxWireVersion, maxBsonObjectSize, etc.: all the fields
1276
1276
required to correctly communicate with the server.
1277
1277
1278
- The hello or legacy hello responses received by monitors determine if the topology as a whole \[ is compatible\] (#is
1279
- compatible) with the driver, and which servers are suitable for selection. The monitors' responses should not be used to
1280
- determine how to format wire protocol messages to the servers.
1278
+ The hello or legacy hello responses received by monitors determine if the topology as a whole is compatible with the
1279
+ driver, and which servers are suitable for selection. The monitors' responses should not be used to determine how to
1280
+ format wire protocol messages to the servers.
1281
1281
1282
1282
##### Immutable data
1283
1283
@@ -1667,8 +1667,8 @@ shard.
1667
1667
1668
1668
### Why ignore errors based on CMAP's generation number?
1669
1669
1670
- Using CMAP's \[ generation number\] (#generation number) solves the following race condition among application threads and
1671
- the monitor during error handling:
1670
+ Using CMAP's generation number solves the following race condition among application threads and the monitor during
1671
+ error handling:
1672
1672
1673
1673
1 . Two concurrent writes begin on application threads A and B.
1674
1674
2 . The server restarts.
@@ -1711,7 +1711,7 @@ after its check would happen after the pool was cleared and thus avoid putting i
1711
1711
### What is the purpose of topologyVersion?
1712
1712
1713
1713
[ topologyVersion] ( #topologyversion ) solves the following race condition among application threads and the monitor when
1714
- handling \[ State Change Errors\] (#State Change Errors) :
1714
+ handling State Change Errors:
1715
1715
1716
1716
1 . Two concurrent writes begin on application threads A and B.
1717
1717
2 . The primary steps down.
0 commit comments