[SERVER-10922] Adding repl set member as a non-repl set shard succeeds Created: 26/Sep/13  Updated: 11/Jul/16  Resolved: 04/Oct/13

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.5.3
Fix Version/s: 2.5.3

Type: Bug Priority: Major - P3
Reporter: Phillip Quiza Assignee: Randolph Tan
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Steps To Reproduce:

Run this jstest:

/* Startup config servers */
var configServers = [];
var configNames = [];
for (var i = 0; i < 3; i++) {
    var configConf = {
        useHostname: "localhost",
        noJournalPrealloc: true,
        port: 29000 + i,
        pathOpts: { testName: "test", config: i },
        dbpath: "$testName-config$config",
        configsvr: ""
    };
 
    var conn = MongoRunner.runMongod(configConf);
    configServers.push(conn);
    configNames.push(conn.name);
}
 
/* Startup mongos */
var mongosConf = {
    useHostname: "localhost",
    port: 32000,
    pathOpts: { testName: "test", mongos: 0 },
    configdb: configNames.join(','),
    verbose: 1
};
 
var mongos = MongoRunner.runMongos(mongosConf);
 
/* Test adding a replica set member as a non-repl set shard */
var rst2 = new ReplSetTest({ nodes: 2, smallfiles: '', noprealloc: '' });
rst2.startSet();
var cfg2 = rst2.getReplSetConfig();
rst2.initiate(cfg2);
 
res = mongos.adminCommand({ addShard: cfg2.members[1].host });
assert.eq(res.ok, 0, JSON.stringify(res));

Participants:

 Description   

Repl set members should not be allowed to be added as standalone shards to a cluster. Example:

If localhost:30000 is part of repl set rs1 it should be added like this:

db.runCommand({addShard: "rs1/localhost:30000"});

Not this:

db.runCommand({addShard: "localhost:30000"});

This is a regression. 2.4.6 works fine.



 Comments   
Comment by Randolph Tan [ 04/Oct/13 ]

reverted regression via https://github.com/mongodb/mongo/commit/6c68034f641f9f50e10ab68ac660242a53373ec1

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