[SERVER-2869] rs.stepDown() should fail if slave is far behind and also allow 'force' option Created: 30/Mar/11  Updated: 12/Jul/16  Resolved: 05/Apr/11

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.8.0
Fix Version/s: 1.9.0

Type: Improvement Priority: Major - P3
Reporter: Kyle Banker Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

When a user calls rs.stepDown():

1. If then closest secondary is more than 10 seconds behind the primary, then the stepDown() should be automatically rejected. This is to prevent the situation where the secondary catches up and then the original primary is re-elected. (Many users have experienced this phenomenon, and it doesn't jibe with the idea of a stepDown().)

2. If the stepDown() is rejected, the users should have the option for say rs.stepDown(

{force: 1}

), which will stop writes to the primary, wait for the secondary to catch up, and then step down the primary so that the secondary does in fact become primary.



 Comments   
Comment by auto [ 05/Apr/11 ]

Author:

{u'login': u'kchodorow', u'name': u'Kristina', u'email': u'kristina@10gen.com'}

Message: stepdown is rejected if other nodes are not up-to-date SERVER-2869

add force : true option to force stepdown
Branch: master
https://github.com/mongodb/mongo/commit/6af8365495692b330f1ec8a93c5f172817f7a7c3

Comment by Kristina Chodorow (Inactive) [ 31/Mar/11 ]

I don't think having a "force" option would work correctly, I think that SERVER-1053 (priorities) is really what people want and stepDown is merely a temporary hack to get the correct node to become master. With priorities, if someone sets the master to a lower priority, it will become a secondary, everyone will sync off of it until the highest-priority node (reachable by a majority) is up-to-date, and then the highest-priority node will become master. So, I think that effectively covers what force:1 would do.

I think that stepDown should have a longer time that it forces a node to be secondary (maybe 5 minutes instead of 30 seconds). However, once priorities are committed, I don't see this command being used much.

Also, there are some practical problems: what would force:1 do if there is no secondary that could become primary? What if there is a secondary but it never catches up (it could have an error and stop syncing)? Then we'd need another command to un-step-down, too.

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