@@ -90,6 +90,11 @@ with sessions.
90
90
91
91
Any network exception writing to or reading from a socket (e.g. a socket timeout or error).
92
92
93
+ ** SDAM**
94
+
95
+ An abbreviated form of "Server Discovery and Monitoring", specification defined in
96
+ [ Server Discovery and Monitoring Specification] ( ../server-discovery-and-monitoring/server-discovery-and-monitoring.md ) .
97
+
93
98
## Specification
94
99
95
100
Drivers currently have no concept of a session. The driver API will be expanded to provide a way for applications to
@@ -710,7 +715,8 @@ expiration.
710
715
711
716
## Gossipping the cluster time
712
717
713
- Drivers MUST gossip the cluster time when connected to a deployment that uses cluster times.
718
+ Drivers MUST gossip the cluster time when connected to a deployment that uses cluster times. However, drivers MUST NOT
719
+ gossip cluster time on SDAM commands.
714
720
715
721
Gossipping the cluster time is a process in which the driver participates in distributing the logical cluster time in a
716
722
deployment. Drivers learn the current cluster time (from a particular server's perspective) in responses they receive
@@ -722,7 +728,7 @@ received from a server.
722
728
723
729
### Receiving the current cluster time
724
730
725
- Drivers MUST examine all responses from the server commands to see if they contain a top level field named
731
+ Drivers MUST examine all non-SDAM responses from the server commands to see if they contain a top level field named
726
732
` $clusterTime ` formatted as follows:
727
733
728
734
``` typescript
@@ -748,8 +754,9 @@ not participate in the comparison.
748
754
749
755
### Sending the highest seen cluster time
750
756
751
- Whenever a driver sends a command to a server it MUST include the highest seen cluster time in a top level field called
752
- ` $clusterTime ` , in the same format as it was received in (but see Gossipping with mixed server versions below).
757
+ Whenever a driver sends a non-SDAM command to a server it MUST include the highest seen cluster time in a top level
758
+ field called ` $clusterTime ` , in the same format as it was received in (but see Gossipping with mixed server versions
759
+ below).
753
760
754
761
### How to compute the ` $clusterTime ` to send to a server
755
762
@@ -791,6 +798,15 @@ the command. A server supports `$clusterTime` when the `maxWireVersion` >= 6.
791
798
792
799
This supports the (presumably short lived) scenario where not all servers have been upgraded to 3.6.
793
800
801
+ ### Do not gossip on SDAM commands
802
+
803
+ Drivers MUST NOT gossip cluster time on SDAM commands. In earlier versions of this spec, drivers did gossip cluster time
804
+ on SDAM commands, however it was discovered that doing so provides little benefit and can result in a loss of
805
+ availability. For example, if the driver attempts to connect to a member of a different replica set, the driver can end
806
+ up with an invalid cluster time. Worse, this invalid cluster time may remain the highest for an indefinite time since
807
+ clocks between different clusters are not synced. This results in all operations failing until the application is
808
+ restarted. To fix this issue we decided it was more robust to stop gossiping on SDAM commands altogether.
809
+
794
810
## Test Plan
795
811
796
812
See the [ README] ( tests/README.md ) for tests.
@@ -918,6 +934,7 @@ has risks that do not justify the potential guaranteed `ServerSession` allocatio
918
934
919
935
## Changelog
920
936
937
+ - 2025-02-24: Drivers MUST NOT gossip $clusterTime on SDAM commands.
921
938
- 2024-05-08: Migrated from reStructuredText to Markdown.
922
939
- 2017-09-13: If causalConsistency option is omitted assume true
923
940
- 2017-09-16: Omit session ID when opening and authenticating a connection
0 commit comments