From 665921411606fcbad40de1b7f571aa323c5a0fa7 Mon Sep 17 00:00:00 2001 From: liujianhui Date: Mon, 9 Jan 2017 11:20:14 +0800 Subject: [PATCH 1/2] [spark-18806] whether the remote address is worker according to the ip --- .../org/apache/spark/deploy/worker/WorkerWatcher.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/org/apache/spark/deploy/worker/WorkerWatcher.scala b/core/src/main/scala/org/apache/spark/deploy/worker/WorkerWatcher.scala index 23efcab6caad1..94318094ca6b6 100644 --- a/core/src/main/scala/org/apache/spark/deploy/worker/WorkerWatcher.scala +++ b/core/src/main/scala/org/apache/spark/deploy/worker/WorkerWatcher.scala @@ -17,6 +17,8 @@ package org.apache.spark.deploy.worker +import java.net.InetAddress + import org.apache.spark.internal.Logging import org.apache.spark.rpc._ @@ -43,7 +45,9 @@ private[spark] class WorkerWatcher( // Lets filter events only from the worker's rpc system private val expectedAddress = RpcAddress.fromURIString(workerUrl) - private def isWorker(address: RpcAddress) = expectedAddress == address + private def isWorker(address: RpcAddress) = expectedAddress == address || + (expectedAddress.port == address.port && + expectedAddress.host == InetAddress.getByName(address.host).getHostAddress) private def exitNonZero() = if (isTesting) isShutDown = true else System.exit(-1) From 1c77fe894bf07eac21c5f7bb520d21947018061a Mon Sep 17 00:00:00 2001 From: liujianhui Date: Mon, 9 Jan 2017 11:26:37 +0800 Subject: [PATCH 2/2] [spark-18806] whether the remote address is worker according to the ip --- .../scala/org/apache/spark/deploy/worker/WorkerWatcher.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/scala/org/apache/spark/deploy/worker/WorkerWatcher.scala b/core/src/main/scala/org/apache/spark/deploy/worker/WorkerWatcher.scala index 94318094ca6b6..a58e4a9a80039 100644 --- a/core/src/main/scala/org/apache/spark/deploy/worker/WorkerWatcher.scala +++ b/core/src/main/scala/org/apache/spark/deploy/worker/WorkerWatcher.scala @@ -18,7 +18,6 @@ package org.apache.spark.deploy.worker import java.net.InetAddress - import org.apache.spark.internal.Logging import org.apache.spark.rpc._