-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
Summary
After triggering a failover for an AWS document DB cluster with multiple nodes after the server recovers the C# driver does not work until restarted.
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
How to Reproduce
Driver version: 2.23.1
DB: AWS document DB, size intermediate with 3 nodes with the same priority
Server: app runner instance in VPC with AWS DocumentDB from above.
Using C# driver above in an asp.net server deployed to AWS app runner configured as above
1. Have a server running and handling write requests
2. Using failover-db-cluster to trigger a failover event (https://awscli.amazonaws.com/v2/documentation/api/latest/reference/rds/failover-db-cluster.html)
3. Keep the server responding to requests
Code used
var settings = MongoClientSettings.FromUrl(new MongoUrl(connectionString));
_client = new MongoClient(settings);
Put([FromBody] TestDocument document)
{ await collection.InsertOneAsync(document); }
Expected
Once the failover is complete it is expected that the server will be able to process requests again without restarting or recreating the mongo db client.
Actual
The server is not able to complete write requests again until restarted.
Other servers can connect and write afterward.
Workaround
The only way I found to automatically recover was to recreate the client with different settings then recovers after the fall over
Additional Background
Connection string options ssl=false&retryWrites=false&readPreference=SecondaryPreferred