Thank you, Jeff!

Regards,
Raman



-------- Original message --------
Subject: [MongoDB-JIRA] (JAVA-665) Connection configuration allows to specify independent nodes as replica set
From: "Jeff Yemin (JIRA)" <jira@mongodb.org>
To: Raman Yushkou <Raman_Yushkou@epam.com>
CC:



    [ https://jira.mongodb.org/browse/JAVA-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=511317#comment-511317 ]

Jeff Yemin commented on JAVA-665:
---------------------------------

Hi Raman,

Reviewing the backlog, I see that there is a duplicate of this in JAVA-930, which will be fixed in 2.12.0.
               
> Connection configuration allows to specify independent nodes as replica set
> ---------------------------------------------------------------------------
>
>                 Key: JAVA-665
>                 URL: https://jira.mongodb.org/browse/JAVA-665
>             Project: Java Driver
>          Issue Type: Bug
>          Components: Cluster Management
>    Affects Versions: 2.9.0, 2.9.1
>         Environment: Windows 7 x64
> mongodb 2.0.4
>            Reporter: Raman Yushkou
>            Priority: Minor - P4
>
> I have faced with possibility to specify two (or more) independent nodes as replica set via MongoURI(...) parameter.
> E.g. I started two independent nodes...
> {code}
> mongod.exe --dbpath .\1\db\ --rest --logappend --logpath .\1\mongo\log --port=1234
> mongod.exe --dbpath .\2\db\ --rest --logappend --logpath .\2\mongo\log --port=5678
> {code}
> ... and configured connection like following:
> {code}
> Mongo con = new Mongo(new MongoURI("mongodb://127.0.0.1:1234,127.0.0.1:5678"));
> {code}
> There are no warnings or errors and following code behaves with illusion of correctly passed replica set configuration:
> {code}
> ReplicaSetStatus status = con.getReplicaSetStatus();
> status.isMaster(new ServerAddress("127.0.0.1", 1234)); // true
> status.isMaster(new ServerAddress("127.0.0.1", 5678)); // false
> status.getMaster().toString(); // 127.0.0.1:1234
> WriteResult r = con.getDB("x").getCollection("y").save(new BasicDBObject("a", "b"));
> r.getLastError().throwOnError(); // there are no errors
> {code}
> The only way to detect that configuration is incorrect - specify REPLICA_SAFE write concern:
> {code}
> con.getDB("x").getCollection("y").save(new BasicDBObject("a", "b"), WriteConcern.REPLICAS_SAFE); // com.mongodb.MongoException: norepl
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira