Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect: prefer ip address over hostname #290

Merged
merged 4 commits into from
Sep 30, 2015
Merged

detect: prefer ip address over hostname #290

merged 4 commits into from
Sep 30, 2015

Conversation

s-urbaniak
Copy link

Fixes #289, #276

@s-urbaniak s-urbaniak added the WIP label Sep 28, 2015
@s-urbaniak s-urbaniak assigned s-urbaniak and tsenart and unassigned s-urbaniak Sep 28, 2015
@s-urbaniak
Copy link
Author

@tsenart PTAL

@s-urbaniak
Copy link
Author

/cc @jdef

@tsenart tsenart added PTAL and removed WIP labels Sep 28, 2015
@tsenart
Copy link
Contributor

tsenart commented Sep 28, 2015

LGTM

@jdef
Copy link
Contributor

jdef commented Sep 28, 2015

Probably worth adding a TODO in here to upgrade to MasterInfo.Address as soon as mesos-go makes that available via updated protos. That way you don't need to be in the business of big-vs-little endian decoding (which there were some plans to change at some point).

@jdef
Copy link
Contributor

jdef commented Sep 28, 2015

It sounds like little vs. big endian encoding depends on the arch that the remote UPID process is running on: https://issues.apache.org/jira/browse/MESOS-1201

@jdef
Copy link
Contributor

jdef commented Sep 28, 2015

The "trivial" fix uses ntohl for the ordering problem (copied from the xref'd MESOS issue above):

 // you get the minfo from … magic!
  MasterInfo minfo = getMyMasterInfo(...);

  // then convert the bytes into host-order:
  net::IP ip{ ntohl(minfo.ip()) };
  // you can then generate back the original string ("192.168.1.10")
  std::ostringstream out;
  out << ip;
  return out.str();

@s-urbaniak
Copy link
Author

@jdef PTAL (just added a TODO)

@tsenart
Copy link
Contributor

tsenart commented Sep 29, 2015

@s-urbaniak: TODOs in code get easily lost. Please create an issue to track this instead.

@s-urbaniak
Copy link
Author

@tsenart you are very right, I just created #291

@jdef
Copy link
Contributor

jdef commented Sep 29, 2015

actually wondering if it makes sense to extract this packing logic into a
set of separate go files controlled by build flags to target different
arch's since each may have different endian-ness:
https://golang.org/doc/install/source

On Tue, Sep 29, 2015 at 10:25 AM, Sergiusz Urbaniak <
notifications@github.com> wrote:

@tsenart https://github.com/tsenart you are very right, I just created
#291 #291


Reply to this email directly or view it on GitHub
#290 (comment).

@tsenart
Copy link
Contributor

tsenart commented Sep 29, 2015

@jdef: No need to do that after implementing #291 since it is a string, not an int.

@jdef
Copy link
Contributor

jdef commented Sep 29, 2015

lgtm. we're probably not going to make things any worse for people since
it's already broken. there's a (slight) chance that by fixing this for 99%
of people maybe it breaks for 1% of others. this issue, in general, isn't
fully resolvable without upgrading to the v0.24 bindings. which I don't
think mesos-go has generated protos for yet.

On Tue, Sep 29, 2015 at 10:41 AM, Tomás Senart notifications@github.com
wrote:

@jdef https://github.com/jdef: No need to do that after implementing
#291 #291 since it is a
string, not an int.


Reply to this email directly or view it on GitHub
#290 (comment).

@tsenart
Copy link
Contributor

tsenart commented Sep 29, 2015

Even if we update the bindings, this new address field would only be set in more recent versions of Mesos, so older clusters would still be affected.

@jdef
Copy link
Contributor

jdef commented Sep 29, 2015

true, but given the current deprecation cycle systems need to upgrade
quickly to stay compat. @nqn sent something to the mesos-dev list recently
about the fast-pace of the current deprecation process and how it might
make sense to slow it down.

On Tue, Sep 29, 2015 at 12:23 PM, Tomás Senart notifications@github.com
wrote:

Even if we update the bindings, this new address field would only be set
in more recent versions of Mesos, so older clusters would still be affected.


Reply to this email directly or view it on GitHub
#290 (comment).

tsenart pushed a commit to mesos/mesos-go that referenced this pull request Sep 30, 2015
@jdef
Copy link
Contributor

jdef commented Sep 30, 2015

like the byte order detection

This commit adds support for MasterInfo.Address with fallback to the old
Ip and Port for Mesos < 0.24.0
@s-urbaniak
Copy link
Author

small nit, otherwise I really like the refactorings, LGTM

@s-urbaniak s-urbaniak assigned tsenart and unassigned s-urbaniak Sep 30, 2015
tsenart added a commit that referenced this pull request Sep 30, 2015
detect: prefer ip address over hostname
@tsenart tsenart merged commit a54cb44 into master Sep 30, 2015
@tsenart tsenart deleted the fix-289 branch September 30, 2015 16:07
@tsenart tsenart removed the PTAL label Sep 30, 2015
@tsenart tsenart mentioned this pull request Oct 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants