-
Type: Epic
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Component/s: SDAM
-
To Do
-
Allow MongoClient to survive cluster topology changes from sharded cluster to replica set
-
Needed
-
Summary
Definitions:
- router endpoint - server endpoint that routes requests to shards (i.e. mongos)
- replica set endpoint - server endpoint that emulates a replica set or standalone (i.e. mongod)
Starting in 8.0, sharded clusters will be the only supported topology in MongoDB. To allow customers currently using a MongoDB replica set to migrate to MongoDB 8.0 without needing to reconfigure their applications, the server team will build a "replica set endpoint" that makes a single-shard cluster appear to be a replica set (PM-2965). However, there are limitations to the replica set endpoint:
- It can only be used with single-shard clusters, so customers have to switch to the router endpoint if they want to add more shards (e.g. to scale horizontally).
- Note that the there have been discussions about supporting multi-shard clusters with the replica set endpoint, but it's currently not in the scope of PM-2965. In any case, horizontal scalability will likely still be limited for customers using the replica set endpoint.
- It will likely be removed with a future version of MongoDB (9.0 or later), so probably can't be used indefinitely.
- It's not decided when the replica set endpoint feature will be removed.
As a result, customers may eventually be motivated or required to stop using the replica set endpoint.
- It's not decided when the replica set endpoint feature will be removed.
To switch to the router endpoint, customers using existing drivers will have to update their connection string and restart their applications. We want to offer customers a better migration experience that doesn't require reconfiguring and restarting their application to switch to the router endpoint.
Updated from the original description:
If all nodes are removed from the Topology, clients MUST reset the TopologyType to Unknown and rediscover the original seed addresses.It might be useful to allow a MongoClient to survive cluster topology changes from a replica set to a sharded cluster (or vice versa). For example, client is connected to mongoses A and B and an admin restarts A and B as a replica set, the client could rediscover A and B as replica set members.
Currently the SDAM spec does not allow this. When a MongoClient is connected to a replica set, it will remove servers that are discovered to be mongos nodes. When a MongoClient is connected to a sharded cluster (a set of mongos nodes), it will remove servers that are not mongos nodes.
I can imagine this addition to the SDAM spec would allow it:
Originally requested in:
PYTHON-2131
Motivation
Who is the affected end user?
Customers who upgrade existing replica sets to MongoDB 8.0 or who chose use the new replica set endpoint for a new MongoDB 8.0 cluster (see PM-2965).
How does this affect the end user?
Customers may delay migrating off the replica set endpoint, reducing their motivation to horizontally scale their clusters or preventing them from migrating to a future MongoDB version that doesn't have the replica set endpoint feature.
How likely is it that this problem or use case will occur?
All customers using the MongoDB 8.0 replica set endpoint will eventually need to switch to the router endpoint.
If the problem does occur, what are the consequences and how severe are they?
Customers who want or need to switch to the router endpoint must change their connection string and restart their applications to re-initialize the MongoClient.
Is this issue urgent?
This feature will be useful when MongoDB 8.0 is released. It will become even more useful when a future MongoDB version is released that removes the replica set endpoint feature.
Is this ticket required by a downstream team?
No.
Is this ticket only for tests?
No.
Acceptance Criteria
To allow migrating from the replica set endpoint to the router endpoint, drivers must be able to:
- Discover the router endpoint(s) somehow.
- Give customers some way to configure whether or not they want their applications to automatically switch to the router endpoint(s), if available.
- Update the current topology from replica set or standalone to sharded cluster.
Open questions:
- Should we try to make this work for pre-8.0 MongoDB versions?
- Should we try to make this work for self-hosted databases or Atlas only?
- Are there other topology transitions that may become important in the future?
-
- Future customers may switch from sharded to load-balanced clusters. Should we try to support no-restart transitions from sharded to load-balanced? (suggested by tyler.brock@mongodb.com)
- is related to
-
DRIVERS-2089 Add events for polling SRV records
- Backlog
- related to
-
PYTHON-2131 Driver connect replica set failed when changing from sharded cluster without address change
- Closed
-
DRIVERS-2740 Add support for polling SRV records for mongod discovery
- Closed
-
DRIVERS-2622 Add SDAM tests for standalone restarted as a replica set or mongos
- Backlog
- split to
-
CDRIVER-4683 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
CSHARP-4717 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
CXX-2714 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
GODRIVER-2905 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
JAVA-5071 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
MOTOR-1153 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
NODE-5453 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
PHPLIB-1195 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
PYTHON-3836 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
RUBY-3297 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked
-
RUST-1702 Allow MongoClient to automatically transition from replica set to sharded endpoint without restarts
- Execution Blocked