[JAVA-1161] A replica set member that doesn't report its name results in removal of all servers from the client view of the replica set Created: 07/Apr/14  Updated: 30/Jan/15  Resolved: 28/Apr/14

Status: Closed
Project: Java Driver
Component/s: Cluster Management
Affects Version/s: 2.12.0
Fix Version/s: 2.12.1, 3.0.0

Type: Bug Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-13458 Identify replica state in ismaster fo... Closed

 Description   

A server started with --replSet <name> return this ambiguous ismaster response in at least three situations:

  1. an uninitialized replica set
  2. a shunned state (shunned is when the server was removed from the replica set configuration)
  3. briefly on member startup

For example:

{ "serverUsed" : "localhost:27017" ,
  "ismaster" : false ,
  "secondary" : false ,
  "info" : "can't get local.system.replset config from self or any seed (EMPTYCONFIG)" ,
  "isreplicaset" : true ,
  "maxBsonObjectSize" : 16777216 ,
  "maxMessageSizeBytes" : 48000000 ,
  "localTime" : { "$date" : "2014-04-01T14:10:05.110Z"} ,
  "ok" : 1.0 }

Note: isreplicaset exists in only these states and there is no hosts field, nor setName nor setVersion to work with.

The problem is that the driver doesn't detect this state, and proceeds to remove all other replica set members from the client view of the cluster. This can result in the inability to perform operations against the cluster until the MongoClient instance is closed and re-created.

Instead, the driver should ignore server descriptions for replica set members that don't contain a hosts field or a setName field.



 Comments   
Comment by Githook User [ 30/Jan/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1161: When a replica set member returns an empty list of hosts or no set name, assume it's not yet joined the replica set and do not remove every server from the client view of the replica set.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/0e1bb9df1572a9b5117eee03226bc156e2ff9ede

Comment by Githook User [ 01/Aug/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1161: Added assertion that a replica set member without a name or hosts list will be of type ReplicaSetOther
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/ab4013156e18a8dea77449ab56a35e391bee866c

Comment by Githook User [ 01/Aug/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1161: Just to be safe, also ignoring replica set members without a setName.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/df8668603a27fb08fbf8c476d1cc92c9381b46d5

Comment by Githook User [ 01/Aug/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1161: When a replica set member returns an empty list of hosts, assume it's not a part of an initiated replica set and do not remove every server from the client view of the replica set.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/2d69e075d4f83086326c7df90618e59269b32d05

Comment by Jeffrey Yemin [ 29/Apr/14 ]

Closing for 2.12.1 release.

Comment by Githook User [ 28/Apr/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1161: When a replica set member returns an empty list of hosts or no set name, assume it's not yet joined the replica set and do not remove every server from the client view of the replica set.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/0e1bb9df1572a9b5117eee03226bc156e2ff9ede

Comment by Githook User [ 27/Apr/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1161: Added assertion that a replica set member without a name or hosts list will be of type ReplicaSetOther
Branch: 2.12.x
https://github.com/mongodb/mongo-java-driver/commit/ab4013156e18a8dea77449ab56a35e391bee866c

Comment by Githook User [ 26/Apr/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1161: Just to be safe, also ignoring replica set members without a setName.
Branch: 2.12.x
https://github.com/mongodb/mongo-java-driver/commit/df8668603a27fb08fbf8c476d1cc92c9381b46d5

Comment by Githook User [ 08/Apr/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1161: When a replica set member returns an empty list of hosts, assume it's not a part of an initiated replica set and do not remove every server from the client view of the replica set.
Branch: 2.12.x
https://github.com/mongodb/mongo-java-driver/commit/2d69e075d4f83086326c7df90618e59269b32d05

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