-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-6440][CORE]Handle IPv6 addresses properly when constructing URI #5424
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tell me more about what this fixes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's all about finding our external IP address: old logic was to use external ipv4 || 127.0.0.1.
That transformes it to ipv4 || ipv6 || 127.0.0.1
Whenewer we don't have any ipv4 it's better to use ipv6 than 127.0.0.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, though I don't think that was the thrust of this JIRA, which was simply to format IPv6 addresses correctly. I think the reasoning makes some sense though.
Nits: can you filterNot(addr => addr.isLinkLocalAddress || addr.isLoopbackAddress)
and if (addresses.notEmpty) {? and find(_.isInstanceOf[Inet4Address])? Just questions of style in this block.
It might be worth a comment to the effect of your reply above here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, i agree with that. Should i make additional commit or change existing one?
*nonEmpty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just push more commits to this branch
|
ok to test |
|
Test build #29936 has finished for PR 5424 at commit
|
|
Use |
|
Test build #29940 has started for PR 5424 at commit |
|
jenkins, test this please |
|
Test build #29943 has finished for PR 5424 at commit
|
|
Seems like jenkins was killed again. |
|
whoops, i missed retriggering this build. :) jenkins, test this please |
|
Jenkins, retest this please. |
|
Test build #29962 has finished for PR 5424 at commit
|
|
Jenkins, retest this please. |
|
Test build #29974 has finished for PR 5424 at commit
|
|
I think I've looked at 10 different versions of 2 PRs for this JIRA now, and all seem to be changing or adding something slightly different than what's essential here. Let me describe what I think needs to be done and why and we can settle that, then implement. The code needs a local IP address in many cases. That's localIpAddress. (Separately, your update to find an IPv6 address sounds OK.) localIpAddressHostname and the getAddressHostName() method actually look pointless. They make a String into an InetAddress and then ask for the exact same text representation back as a String. Personally I'd make localIpAddress an InetAddress, as you've done. I'd remove localIpAddressHostname and replace with localHostName() where a String is needed. ... because then customHostname is consistently applied, right? I think that must be the intent? But then, localIpAddress itself doesn't have much value. It is always used for its string rep anyway. So, localHostName() as well? it's the only thing that needs to be non-private. Back to the original issue: where localHostName() would then be used in a URI, it can be run through the utility method in InetAddresses. I don't think that we should instead have more methods in Utils just for adding a call to that method. Finally, there are instances in SparkSQLEnv, KinesisReceiver and TestUtils that use InetAddress.getLocalHost directly. These should also use localHostName(). Maybe there's a reason that doesn't 100% work but it seems a lot less messy than the 3-5 ways code is reasoning about the local IP address string now. What say, or, should I try it in my own PR? |
|
Ok, i'll try to:
today/tomorrow.
I didn't find any method in InetAddresses like
imho additional method with is better. Also i don't like conversion from |
|
|
|
And for |
|
Oh gosh yeah looking at this the wrong way around of course. Aren't there just two places where the URI logic is needed? I think calling |
|
Ok, |
|
I'd just leave |
…AddressURI and Utils.getAddressHostName; make Utils.localIpAddress private; rename Utils.localHostURI into Utils.localHostNameForURI; use Utils.localHostName in org.apache.spark.streaming.kinesis.KinesisReceiver and org.apache.spark.sql.hive.thriftserver.SparkSQLEnv
|
Test build #30091 has finished for PR 5424 at commit
|
|
LGTM. This simplifies and standardizes the local host name logic across the code, fixes the original problem of IPv6 addresses in URIs, chooses a better local address in some IPv6 cases. Of course, making things consistent means slight behavior changes in some cases -- for example, |
SPARK-6440 #5424 import guava but did not promote guava dependency to compile level. [INFO] compiler plugin: BasicArtifact(org.scalamacros,paradise_2.10.4,2.0.1,null) [info] Compiling 8 Scala sources to /root/projects/spark/sql/hive-thriftserver/target/scala-2.10/classes... [error] bad symbolic reference. A signature in Utils.class refers to term util [error] in package com.google.common which is not available. [error] It may be completely missing from the current classpath, or the version on [error] the classpath might be incompatible with the version used when compiling Utils.class. [error] [error] while compiling: /root/projects/spark/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala [error] during phase: erasure [error] library version: version 2.10.4 [error] compiler version: version 2.10.4 [error] reconstructed args: -deprecation -classpath Author: Daoyuan Wang <daoyuan.wang@intel.com> Closes #5507 from adrian-wang/guava and squashes the following commits: c337dad [Daoyuan Wang] fix compile error
No description provided.