[CDRIVER-3107] Warn when removing the last server from a topology Created: 30/Apr/19  Updated: 28/Oct/23  Resolved: 24/Jul/19

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

Type: Improvement Priority: Major - P3
Reporter: Jeremy Mikola Assignee: Isabel Atkinson
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-3073 Do not allow empty string for replicaSet Closed
is related to CDRIVER-3068 Topology scanner stuck when changing ... Closed

 Description   

Quoting SDAM: Other Topology Types:

A client SHOULD emit a warning when, in the process of updating its topology description, it removes the last server from the topology.

Emitting a warning could better assist users in catching the following cases that could lead to an empty topology and non-functional application:

  • A typo in the replicaSet URI option
  • Connecting to a standalone server with a replicaSet URI option present. SDAM: Allowed Configuration Combinations allows drivers to support a Single topology type even if the replica set name is not-null, but libmongoc elects not to do that.


 Comments   
Comment by Githook User [ 31/Jul/19 ]

Author:

{'name': 'isabelatkinson', 'username': 'isabelatkinson', 'email': 'isabel.atkinson@10gen.com'}

Message: CDRIVER-3107 warn when removing last server from topology

Emit a warning when the last server in the topology is removed in the
process of updating the topology description.
Branch: cdriver-2873
https://github.com/mongodb/mongo-c-driver/commit/bd17815a14d43d4e967579898ae569fce38c8dc2

Comment by Githook User [ 24/Jul/19 ]

Author:

{'name': 'isabelatkinson', 'email': 'isabel.atkinson@10gen.com', 'username': 'isabelatkinson'}

Message: CDRIVER-3107 warn when removing last server from topology

Emit a warning when the last server in the topology is removed in the
process of updating the topology description.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/bd17815a14d43d4e967579898ae569fce38c8dc2

Comment by Jeremy Mikola [ 02/Jul/19 ]

could you give an example of a typo in a replicaSet's URI options that would result in an empty topology

By "typo", I meant that the value of the replicaSet URI option does not match the replica set of any hosts included in the seed list.

As part of SDAM, the driver will end up removing each host from the topology as it realizes the name in its isMaster response does not match the URI option. I expect additional replica set members included in the isMaster response (but not in the seed list) also won't even be considered if the replica set name does not match. The end result in this case is that we end up with an empty topology.

If you search for "setName" in the Actions section of the spec, you'll see the various steps where nodes may be removed.

As a side note, the spec talks about optionally validating the set name for a single topology; however, I don't believe that applies to libmongoc. IIRC, the "replicaSet" URI option will cause libmongoc to consider the topology a replica set, even if there is only one node in the seed list (which would otherwise resemble a standalone connection string).

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