[SERVER-1885] Host names must be distinct within first segment Created: 04/Oct/10 Updated: 12/Jul/16 Resolved: 21/Oct/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | 1.6.2 |
| Fix Version/s: | 1.7.2 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Chris Johnson | Assignee: | Mathias Stearn |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Minor Change |
| Operating System: | ALL |
| Participants: |
| 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 I believe it is due to this portion of util/hostandport.h 86 /** returns true if strings seem to be the same hostname. 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. |
| Comments |
| Comment by Mathias Stearn [ 21/Oct/10 ] |
|
We now only consider hostnames equal if they are the same or one is a dotted prefix of the other so that "a", "a.b", and "a.b.c" are all the same but "a.b", "a.c", and "a.com" are all considered distinct. |
| Comment by auto [ 21/Oct/10 ] |
|
Author: {'login': 'RedBeard0531', 'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}Message: Better sameHostname() |
| Comment by Dwight Merriman [ 21/Oct/10 ] |
|
i agree it needs to be smarter. the main case we need to handle is host01 thse might be the same host – we would want true for sameHost for this. otherwise i totally agree. |
| Comment by Mathias Stearn [ 21/Oct/10 ] |
|
@Dwight: why do we compare hostnames like this? Is there any downside to just checking for equality? |