Skip to content

Commit 1ff5fac

Browse files
authored
DRIVERS-1896 Clarify server selection process for change stream resume (#1055)
1 parent 3fe68b9 commit 1ff5fac

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

source/change-streams/change-streams.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Change Streams
99
:Status: Accepted
1010
:Type: Standards
1111
:Minimum Server Version: 3.6
12-
:Last Modified: April 23, 2021
13-
:Version: 1.9.2
12+
:Last Modified: September 1, 2021
13+
:Version: 1.9.3
1414

1515
.. contents::
1616

@@ -335,8 +335,8 @@ Driver API
335335
/**
336336
* Allowed values: ‘updateLookup’. When set to ‘updateLookup’, the change notification
337337
* for partial updates will include both a delta describing the changes to the document,
338-
* as well as a copy of the entire document that was changed from some time after the
339-
* change occurred. The default is to not send a value.
338+
* as well as a copy of the entire document that was changed from some time after the
339+
* change occurred. The default is to not send a value.
340340
* For forward compatibility, a driver MUST NOT raise an error when a user provides an
341341
* unknown value. The driver relies on the server to validate this option.
342342
* @note this is an option of the `$changeStream` pipeline stage.
@@ -506,15 +506,15 @@ Drivers MUST use the ``ns`` returned in the ``aggregate`` command to set the ``c
506506
ChangeStream
507507
------------
508508

509-
A ``ChangeStream`` is an abstraction of a `TAILABLE_AWAIT <https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#read>`_ cursor, with support for resumability. Implementors MAY choose to implement a ``ChangeStream`` as an extension of an existing tailable cursor implementation. If the ``ChangeStream`` is implemented as a type which owns a tailable cursor, then the implementor MUST provide a manner of closing the change stream, as well as satisfy the requirements of extending ``Iterable<Document>``. If your language has an idiomatic way of disposing of resources you MAY choose to implement that in addition to, or instead of, an explicit close method.
509+
A ``ChangeStream`` is an abstraction of a `TAILABLE_AWAIT <https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#read>`_ cursor, with support for resumability. Implementors MAY choose to implement a ``ChangeStream`` as an extension of an existing tailable cursor implementation. If the ``ChangeStream`` is implemented as a type which owns a tailable cursor, then the implementor MUST provide a manner of closing the change stream, as well as satisfy the requirements of extending ``Iterable<Document>``. If your language has an idiomatic way of disposing of resources you MAY choose to implement that in addition to, or instead of, an explicit close method.
510510

511511
A change stream MUST track the last resume token, per `Updating the Cached Resume Token`_.
512512

513513
Drivers MUST raise an error on the first document received without a resume token (e.g. the user has removed ``_id`` with a pipeline stage), and close the change stream. The error message SHOULD resemble “Cannot provide resume functionality when the resume token is missing”.
514514

515515
A change stream MUST attempt to resume a single time if it encounters any resumable error per `Resumable Error`_. A change stream MUST NOT attempt to resume on any other type of error.
516516

517-
In addition to tracking a resume token, change streams MUST also track the read preference specified when the change stream was created. In the event of a resumable error, a change stream MUST perform server selection with the original read preference before attempting to resume.
517+
In addition to tracking a resume token, change streams MUST also track the read preference specified when the change stream was created. In the event of a resumable error, a change stream MUST perform server selection with the original read preference using the `rules for server selection <https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.rst#rules-for-server-selection>`_ before attempting to resume.
518518

519519
Single Server Topologies
520520
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -889,3 +889,6 @@ Changelog
889889
+------------+------------------------------------------------------------+
890890
| 2021-04-29 | Added ``load-balanced`` to test topology requirements |
891891
+------------+------------------------------------------------------------+
892+
| 2021-09-01 | Clarified that server selection during resumption should |
893+
| | respect normal server selection rules. |
894+
+------------+------------------------------------------------------------+

0 commit comments

Comments
 (0)