Skip to content

Conversation

@connorsmacd
Copy link
Collaborator

@connorsmacd connorsmacd commented Oct 14, 2025

CDRIVER-5643
DRIVERS-2798

Summary

This PR implements a spec change that removes cluster time gossiping on SDAM commands. From the Driver Sessions spec:

Drivers MUST NOT gossip cluster time on SDAM commands. In earlier versions of this spec, drivers did gossip cluster time on SDAM commands, however it was discovered that doing so provides little benefit and can result in a loss of availability. For example, if the driver attempts to connect to a member of a different replica set, the driver can end up with an invalid cluster time. Worse, this invalid cluster time may remain the highest for an indefinite time since clocks between different clusters are not synced. This results in all operations failing until the application is restarted. To fix this issue we decided it was more robust to stop gossiping on SDAM commands altogether.

Changes

  • Add a new parameter to mongoc_topology_description_handle_hello to indicate whether or not the cluster time should be updated by the hello.
  • Remove cluster_time from mongoc_topology_scanner_t and mongoc_server_monitor_t.
  • Update calls to mongoc_topology_description_handle_hello accordingly.
  • Add new prose tests.
  • Fix existing tests that expected cluster time to be updated by heartbeats.

Testing

There are two new tests for Driver Sessions Prose Test 20: one for single-threaded clients and another for pooled clients. These can be run with:

test-libmongoc -d --no-fork --match "/server_discovery_and_monitoring/monitoring/no_cluster_time/*"

@connorsmacd connorsmacd changed the title CDRIVER-5643 Stop gossipping cluster time on SDAM CDRIVER-5643 Remove cluster time gossiping on SDAM commands Oct 17, 2025
@connorsmacd connorsmacd marked this pull request as ready for review October 17, 2025 16:15
@connorsmacd connorsmacd requested a review from a team as a code owner October 17, 2025 16:15
Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the use of unacknowledged writes to avoid clusterTime updates in the single-threaded test.

@connorsmacd connorsmacd requested a review from kevinAlbs October 22, 2025 19:10
Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@connorsmacd connorsmacd merged commit b6e30a0 into mongodb:master Oct 28, 2025
40 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants