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

Host names must be distinct within first segment

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.7.2
    • Affects Version/s: 1.6.2
    • Component/s: Replication
    • Labels:
      None
    • Minor Change
    • ALL

      When setting up a replica set it appears only portion of the hostname up to the first period is checked for when doing the isSelf check. This results in a message about bad configs when attempting to use hosts of the following form:

      mongo1.primary.domain.com
      mongo1.backup.domain.com

      I believe it is due to this portion of util/hostandport.h

      86 /** returns true if strings seem to be the same hostname.
      87 "nyc1" and "nyc1.acme.com" are treated as the same.
      88 in fact "nyc1.foo.com" and "nyc1.acme.com" are treated the same -
      89 we oly look up to the first period.
      90 */
      91 inline bool sameHostname(const string& a, const string& b)

      { 92 return str::before(a, '.') == str::before(b, '.'); 93 }

      which appears to be called from the isSelf method in util/message.cpp which appears to be used in checkMembersUpForConfigChange of db/repl/rs_initiate.cpp

      I was unable to find information indicating that this was an intentional restriction on hostnames.

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            tekante Chris Johnson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: