[JAVA-665] Connection configuration allows to specify independent nodes as replica set Created: 12/Oct/12  Updated: 07/Mar/14  Resolved: 07/Mar/14

Status: Closed
Project: Java Driver
Component/s: Cluster Management
Affects Version/s: 2.9.0, 2.9.1
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Raman Yushkou Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 x64
mongodb 2.0.4


Attachments: HTML File text.html    
Issue Links:
Duplicate
duplicates JAVA-930 Detect misconfigured clusters Closed

 Description   

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...

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

... and configured connection like following:

Mongo con = new Mongo(new MongoURI("mongodb://127.0.0.1:1234,127.0.0.1:5678"));

There are no warnings or errors and following code behaves with illusion of correctly passed replica set configuration:

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

The only way to detect that configuration is incorrect - specify REPLICA_SAFE write concern:

con.getDB("x").getCollection("y").save(new BasicDBObject("a", "b"), WriteConcern.REPLICAS_SAFE); // com.mongodb.MongoException: norepl



 Comments   
Comment by Raman Yushkou [ 07/Mar/14 ]

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.


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

Comment by Jeffrey Yemin [ 07/Mar/14 ]

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.

Comment by Jeffrey Yemin [ 12/Oct/12 ]

Thanks for this report, Raman.

Generated at Thu Feb 08 08:52:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.