[SERVER-24011] ReplSetTest full support for adding/removing nodes Created: 02/May/16  Updated: 06/Dec/22  Resolved: 06/Jan/20

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 3.3.5
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Randolph Tan Assignee: Backlog - Replication Team
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Replication
Participants:

 Description   

The code is structured today such that one could call add() to add a node to the ReplSetTest internal state tracking, and then reInitiate() to reconfigure the replica set with the new node. However, reInitiate() loses custom config options that were originally used when constructing the ReplSetTest.

It looks like this is caused by the method constructing the new config document purely based on membership (via getReplSetConfig) and not based on the current settings (via getReplSetConfigFromNode):

https://github.com/mongodb/mongo/blob/r3.3.5/src/mongo/shell/replsettest.js#L629

this.reInitiate = function() {
    var config = this.getReplSetConfig();
    var newVersion = this.getReplSetConfigFromNode().version + 1;



 Comments   
Comment by Judah Schvimer [ 06/Jan/20 ]

We will make this change (or one similar) when needed for a future test. This is not currently causing significant pain to my knowledge.

Comment by Spencer Brody (Inactive) [ 04/May/16 ]

Per comment by renctan on a code review, options to the replica set config such as 'configsvr' can be lost on a reInitiate. As reInitiate is still the only supported way to add/remove nodes from a ReplSetTest, we should consider fixing this at some point.

Comment by Spencer Brody (Inactive) [ 02/May/16 ]

Yep, it was for adding and removing nodes from the set

Comment by Eric Milkie [ 02/May/16 ]

I'm not sure what things ReplSetTest needs to know about the config, other than the actual presence of nodes (which you can change with add() and remove() I think)?
For all other needs, you can just run reconfig(), which is a function in rslib.js.

Comment by Spencer Brody (Inactive) [ 02/May/16 ]

milkie - I had just asked Randolph to use this function as he was basically implementing custom logic for reconfiguring a replica set managed by a ReplSetTest in a way that would have made the ReplSetTest miss the changes. What's the recommended way to reconfigure a ReplSetTest then if not this method?

renctan - I'm not clear from the description in the ticket what the actual problem is? What settings could be lost?

Comment by Eric Milkie [ 02/May/16 ]

That function isn't named properly. There are only a few tests that use it, and I wouldn't expect any new tests to need its functionality.

Generated at Thu Feb 08 04:05:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.