Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-26809

Update mongo shell sh.getBalancerHost() method for 3.4

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4.0-rc3
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

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

      Show
      1. Start up a sharded cluster. 2. Shard a collection. 3. run sh.getBalancerHost()
    • Sprint:
      Sharding 2016-11-21

      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];
      }
      
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              misha.tyulenev Misha Tyulenev
              Reporter:
              kay.kim Kay Kim (Inactive)
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: