[CDRIVER-573] Update "not master" and "node is recovering" behavior Created: 12/Mar/15  Updated: 26/Oct/17  Resolved: 25/Oct/17

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.9.0

Type: Improvement Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Unassigned
Resolution: Done Votes: 0
Labels: SDAM
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CDRIVER-2228 All writes retryable support Closed
Duplicate
is duplicated by CDRIVER-2311 Treat "not master" errors like networ... Closed
Related
is related to CDRIVER-438 Implement Server Discovery And Monito... Closed
Epic Link: Cdriver MongoDB 3.6 Support

 Description   

Obey Server Discovery and Monitoring Spec's rules for parsing and responding to "not master" errors: mark the server Unknown as if it were a network error. Detect these errors in the topology scanner's async command callback and in mongoc_cluster_run_command_monitored / mongoc_cluster_run_command_internal.

This has been a missing feature since we implemented SDAM in libmongoc
1.2.0. It's now urgent to fix because Retryable Writes depends on this
feature. Otherwise during a stepdown, the driver might try a write
against a former primary, get a "not master" error, and try again with
the same server. Marking it Unknown ensures we re-scan the topology.



 Comments   
Comment by Githook User [ 26/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-573 fix shadowed declaration
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/2cd8fc7c5c0a446c0e585454af744ec91cbf15ac

Comment by Githook User [ 25/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-573 update change stream test

Now that a "not master" error invalidates a server connection, the
driver no longer sends killCursors after a change stream is interrupted
by "not master".
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/9fdaa04ab0a9d6aed28de28147421e56aaa5126b

Comment by Githook User [ 25/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-573 "not master" err invalidates server

Server Discovery and Monitoring Spec: a "not master" or "node is
recovering" error from any command marks the server Unknown.

This has been a missing feature since we implemented SDAM in libmongoc
1.2.0. It's now urgent to fix because Retryable Writes depends on this
feature. Otherwise during a stepdown, the driver might try a write
against a former primary, get a "not master" error, and try again with
the same server. Marking it Unknown ensures we re-scan the topology.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/69c8a8a0e1b5fdda4bd7d89b425e6b71028f361e

Comment by A. Jesse Jiryu Davis [ 05/Oct/17 ]

Required for Retryable Writes.

Comment by A. Jesse Jiryu Davis [ 17/Mar/15 ]

The work is in or near calls to mongoc_topology_invalidate_server: the function should take the bson_error_t of the error that is causing invalidation.

If the topology is in single-threaded mode, mongoc_topology_invalidate_server should check if the error is a "not master" error specifically (not a network error nor "node is recovering") according to SDAM's rules:

https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring-tests.rst#parsing-not-master-and-node-is-recovering-errors

If it is a "not master" error, the topology re-checks the server inline, before returning the original error to the caller.

The scanner is currently built to fan out and scan all servers in the topology; it needs a feature to scan one server.

If the topology is in multi-threaded mode, the background thread should be awakened by mongoc_topology_invalidate_server and ideally scans that server, soon.

Generated at Wed Feb 07 21:09:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.