[SERVER-8458] adding a node that has been a replset member should clear out the cached state Created: 06/Feb/13  Updated: 03/Mar/15  Resolved: 20/Feb/15

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 2.2.3
Fix Version/s: 2.7.8

Type: Improvement Priority: Minor - P4
Reporter: c a morcomb Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ubuntu


Backwards Compatibility: Fully Compatible
Participants:

 Description   

I set up a replica set with 3 nodes, one acting as arbiter.

after initializing and adding the hosts, I added the third as a arbiter using rs.addArb(host)

rs.conf()

 

"_id" : "api",
"version" : 7,
"members" : [

{ "_id" : 0, "host" : "minnow-data-1.cloud.appcelerator.com:27017" }

,

{ "_id" : 1, "host" : "minnow-data-2.cloud.appcelerator.com:27017" }

,

{ "_id" : 2, "host" : "minnow-data-arbiter-1.cloud.appcelerator.com:27017", "arbiterOnly" : true }

rs.status()

"set" : "api",
"date" : ISODate("2013-02-06T23:51:40Z"),
"myState" : 2,
"syncingTo" : "minnow-data-2.cloud.appcelerator.com:27017",
"members" : [

{ "_id" : 0, "name" : "minnow-data-1.cloud.appcelerator.com:27017", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 4884, "optime" : Timestamp(1360189735000, 1), "optimeDate" : ISODate("2013-02-06T22:28:55Z"), "self" : true }

,

{ "_id" : 1, "name" : "minnow-data-2.cloud.appcelerator.com:27017", "health" : 1, "state" : 1, "stateStr" : "PRIMARY", "uptime" : 4882, "optime" : Timestamp(1360189735000, 1), "optimeDate" : ISODate("2013-02-06T22:28:55Z"), "lastHeartbeat" : ISODate("2013-02-06T23:51:39Z"), "pingMs" : 1 }

,

{ "_id" : 2, "name" : "minnow-data-arbiter-1.cloud.appcelerator.com:27017", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 4882, "lastHeartbeat" : ISODate("2013-02-06T23:51:39Z"), "pingMs" : 12 }

],
"ok" : 1

I would expect the third node to be in state 7 for arbiter.



 Comments   
Comment by Eric Milkie [ 20/Feb/15 ]

Fixed as part of the replication refactor for 3.0. A node removed from a set and readded as an arbiter now properly works as an arbiter.

Comment by c a morcomb [ 08/Feb/13 ]

Thanks this is what must have happened. Following your steps fixed it. Much thanks.

Comment by Thomas Rueckstiess [ 08/Feb/13 ]

Hi,

did you add the node as a secondary before, then removed it with rs.remove() and re-added it as an arbiter? This is the only way I can think of that would put you in this situation.

If this is the case, you should shut down the arbiter node, delete its dbpath directory (arbiters don't need to store any data on disk) and restart it. The rs.status() then should show the node correctly as ARBITER.

Please let us know if this procedure solves your problem or if you have any additional questions.

Regards,
Thomas

Comment by c a morcomb [ 07/Feb/13 ]

mongodb 2.2.3

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