[JAVA-5088] ClusterSettings does not compute ClusterConnectionMode consistently Created: 28/Jul/23  Updated: 22/Jan/24  Resolved: 06/Dec/23

Status: Closed
Project: Java Driver
Component/s: Configuration
Affects Version/s: None
Fix Version/s: 5.0.0

Type: Bug Priority: Minor - P4
Reporter: Valentin Kavalenka Assignee: Valentin Kavalenka
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
Epic Link: 5.0 Breaking Changes
Quarter: FY24Q4
Backwards Compatibility: Major Change
Documentation Changes: Needed
Documentation Changes Summary:

Let's mention in What's new that we fixed the way ClusterConnectionMode is computed by ClusterSettings. ClusterSettings.getMode now consistently returns ClusterConnectionMode.MULTIPLE if the replica set name is configured, whether via ClusterSettings.Builder.applyConnectionString or via ClusterSettings.Builder. requiredReplicaSetName. Previously, this was happening only if the replica set name was configured via a connection string.


 Description   

The following code computes ClusterConnectionMode.MULTIPLE

ClusterSettings.builder()
        .applyConnectionString(new ConnectionString("mongodb://127.0.0.1:27017/?replicaSet=replset"))
        .build()
        .getMode()

but its direct counterpart that does not use applyConnectionString computes ClusterConnectionMode.SINGLE

ClusterSettings.builder()
        .hosts(Collections.singletonList(
                new ServerAddress("127.0.0.1", 27017)
        ))
        .requiredReplicaSetName("replset")
        .build()
        .getMode()



 Comments   
Comment by Githook User [ 06/Dec/23 ]

Author:

{'name': 'Valentin Kovalenko', 'email': 'valentin.kovalenko@mongodb.com', 'username': 'stIncMale'}

Message: `ClusterSettings` does not compute `ClusterConnectionMode` consistently (#1273)

`ClusterSettings` does not compute `ClusterConnectionMode` consistently

JAVA-5088
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/2cf5f3d6f9799ad3626883c76fe538daf71ff842

Comment by Valentin Kavalenka [ 31/Jul/23 ]

Targeted to 5.0 as per this comment: https://github.com/mongodb/mongo-java-driver/pull/1163#pullrequestreview-1554883184.

Generated at Thu Feb 08 09:03:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.