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

Host names must be distinct within first segment

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 1.6.2
    • Fix Version/s: 1.7.2
    • Component/s: Replication
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            redbeard0531 Mathias Stearn
            Reporter:
            tekante Chris Johnson
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: