[
https://issues.apache.org/jira/browse/MESOS-1201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14658688#comment-14658688
]
Marco Massenzio commented on MESOS-1201:
----------------------------------------
[~jieyu]: We have now updated {{MasterInfo}} to use an {{Address}} field
instead of the raw {{ip}} int filed (it's still there, for compatibility
purposes, as it's declared as {{required}}).
Internally, as mentioned, {{net::IP}} is consistent, so the need for this is
greatly reduced.
What do you think: is this still necessary? Or could we close it with a "won't
fix"?
> Store IP addresses in host order
> --------------------------------
>
> Key: MESOS-1201
> URL: https://issues.apache.org/jira/browse/MESOS-1201
> Project: Mesos
> Issue Type: Bug
> Components: technical debt
> Reporter: Jie Yu
>
> Currently, in our code base, we store ip addresses in network order. For
> instance, in UPID. Ironically, we store ports in host order.
> This can cause some subtle bugs which will be very hard to debug. For
> example, we store ip in MasterInfo. Say the IP address is: 01.02.03.04. Since
> we don't convert it into host order in our code, on x86 (little endian), it's
> integer value will be 0x04030201. Now, we store it as an uint32 field in
> MasterInfo protobuf. Protobuf will convert all integers into little endian
> format, since x86 is little endian machine, no conversion will take place. As
> a result, the value stored in probobuf will be 0x04030201. Now, if a big
> endian machine reads this protobuf, it will do the conversion. If it later
> interprets the ip from this integer, it will interpret it to be 04.03.02.01.
> So I plan to store all IP addresses in our code base to be in host order
> (which is the common practice).
> We may have some compatibility issues as we store MasterInfo in ZooKeeper for
> master detection and redirection. For example, what if the new code reads an
> old MasterInfo? What would happen?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)