[SERVER-26809] Update mongo shell sh.getBalancerHost() method for 3.4 Created: 27/Oct/16  Updated: 02/Dec/16  Resolved: 31/Oct/16

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.4.0-rc3

Type: Bug Priority: Major - P3
Reporter: Kay Kim (Inactive) Assignee: Misha Tyulenev
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
is documented by DOCS-9477 Docs for SERVER-26809: Update mongo s... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

1. Start up a sharded cluster.
2. Shard a collection.
3. run sh.getBalancerHost()

Sprint: Sharding 2016-11-21
Participants:

 Description   

Since in 3.4, balancer runs on primary of CSRS and the lock document is:

db.locks.findOne( {_id: "balancer"})
{
	"_id" : "balancer",
	"state" : 2,
	"ts" : ObjectId("581178035b3b7dcb772022cd"),
	"who" : "ConfigServer:Balancer",
	"process" : "ConfigServer",
	"when" : ISODate("2016-10-27T03:44:03.007Z"),
	"why" : "CSRS Balancer"
}

The sh.getBalancerHost() method needs to be updated since it still expects the hostname for the mongos:

function (configDB) {
    if (configDB === undefined)
        configDB = sh._getConfigDB();
    var x = configDB.locks.findOne({_id: "balancer"});
    if (x == null) {
        print(
            "config.locks collection does not contain balancer lock. be sure you
are connected to a mongos");
        return "";
    }
    return x.process.match(/[^:]+:[^:]+/)[0];
}



 Comments   
Comment by Misha Tyulenev [ 31/Oct/16 ]

The command sh.getBAlancerHost in 3.4 will return
"getBalancerHost is deprecated starting version 3.4. The balancer is running on the config server primary host."

Comment by Githook User [ 31/Oct/16 ]

Author:

{u'username': u'mikety', u'name': u'Misha Tyulenev', u'email': u'misha@mongodb.com'}

Message: SERVER-26809 update sh.getBalancerHost method for 3.4
Branch: master
https://github.com/mongodb/mongo/commit/8db151e9e79d8088e9b5e9731207dfcfa1071986

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