[SERVER-26893] Make ReplSetTest smarter about voter limits Created: 03/Nov/16  Updated: 06/Dec/22  Resolved: 11/May/20

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Jonathan Abrahams Assignee: Backlog - Server Tooling and Methods (STM) (Inactive)
Resolution: Won't Fix Votes: 0
Labels: stm, tig-mongorunner
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Server Tooling & Methods
Participants:

 Description   

ReplSetTest can initiate and startup a replica set, but if the number of nodes in the set is greater than the number of voting nodes (currently 7), it will fail. It would be good if one could specify a value for nodes larger than the voting limit, and have replSetTest set the extra nodes to votes to 0 and priority to 0.

The current workaround is as follows:

var nodeNum = 15;
var votingLimit = 7;
var rs = new ReplSetTest({nodes: nodeNum});
rs.startSet();
rsConfig = rs.getReplSetConfig();
for (var i = votingLimit; i < nodeNum; i++) {
   rsConfig.members[i].votes = 0;
   rsConfig.members[i].priority = 0;
}
rs.initiate(rsConfig);



 Comments   
Comment by Ryan Timmons [ 11/May/20 ]

Closing as wont-fix to indicate that there is currently no intention of doing this. Please re-open if there is priority for this. Perhaps this change could self-service by an appropriate server team if this is necessary rather than having to go thru the STM prioritization queue.

Comment by Jonathan Abrahams [ 03/Nov/16 ]

I like this solution better, as a workaround, but still feel it's useful for testing larger replica sets and clusters to be able to specify the number of replica set nodes without worrying about the voting limits. This would be useful for test suites which run with large clusters.

Here's the workaround I'm now using:

function replSetNodes(numReplSetNodes) {
    const replSetVotingLimit = 7;
    var rstConfig = [];
    for (var i = 0; i < numReplSetNodes; i++) {
        rstConfig[i] = {};
        if (i >= replSetVotingLimit) {
            rstConfig[i].rsConfig = {priority: 0, votes: 0};
        }
    }
    return rstConfig;
}
 
var numReplSetNodes = 15;
var replSetConfig = {
    nodes: replSetNodes(numReplSetNodes),
    oplogSize: 1024
};
 
var rst = new ReplSetTest(replSetConfig);
rst.startSet();
rst.initiate();

Comment by Scott Hernandez (Inactive) [ 03/Nov/16 ]

If you want a test like this you can specify options for each node, instead of a total count. I'm not sure we want to add logic in ReplSetTest which knows the limits of voters/arbiters/config/etc. The test should be specifying this information, which it can do already.

var rt = new ReplSetTest({nodes:[{},{},{},...{rsConfig:{priority:0, votes:0}},...]})

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