You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by rxin <gi...@git.apache.org> on 2014/08/09 07:20:46 UTC

[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

GitHub user rxin opened a pull request:

    https://github.com/apache/spark/pull/1865

    [SPARK-2936] Migrate Netty network module from Java to Scala

    The Netty network module was originally written when Scala 2.9.x had a bug that prevents a pure Scala implementation, and a subset of the files were done in Java. We have since upgraded to Scala 2.10, and can migrate all Java files now to Scala.
    
    https://github.com/netty/netty/issues/781
    
    https://github.com/mesos/spark/pull/522


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rxin/spark netty

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/1865.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1865
    
----
commit 7f1434b23972c6de0df82187e647cf212868617f
Author: Reynold Xin <rx...@apache.org>
Date:   2014-08-09T05:18:18Z

    [SPARK-2936] Migrate Netty network module from Java to Scala

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16033331
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileClient.scala ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.util.concurrent.TimeUnit
    +
    +import io.netty.bootstrap.Bootstrap
    +import io.netty.channel.{Channel, ChannelOption, EventLoopGroup}
    +import io.netty.channel.oio.OioEventLoopGroup
    +import io.netty.channel.socket.oio.OioSocketChannel
    +
    +import org.apache.spark.Logging
    +
    +class FileClient(handler: FileClientHandler, connectTimeout: Int) extends Logging {
    +
    +  private var channel: Channel = _
    +  private var bootstrap: Bootstrap = _
    +  private var group: EventLoopGroup = _
    +  private val sendTimeout = 60
    +
    +  def init(): Unit = {
    +    group = new OioEventLoopGroup
    +    bootstrap = new Bootstrap
    +    bootstrap.group(group)
    +      .channel(classOf[OioSocketChannel])
    +      .option(ChannelOption.SO_KEEPALIVE, java.lang.Boolean.TRUE)
    +      .option(ChannelOption.TCP_NODELAY, java.lang.Boolean.TRUE)
    +      .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Integer.valueOf(connectTimeout))
    --- End diff --
    
    Yea it didn't compile. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51681115
  
    QA results for PR 1865:<br>- This patch FAILED unit tests.<br>- This patch merges cleanly<br>- This patch adds no public classes<br><br>For more information see test ouptut:<br>https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18250/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by aarondav <gi...@git.apache.org>.
Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16033181
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileServerHandler.scala ---
    @@ -0,0 +1,68 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.io.FileInputStream
    +
    +import io.netty.channel.{DefaultFileRegion, ChannelHandlerContext, SimpleChannelInboundHandler}
    +
    +import org.apache.spark.Logging
    +import org.apache.spark.storage.{BlockId, FileSegment}
    +
    +
    +class FileServerHandler(pResolver: PathResolver)
    +  extends SimpleChannelInboundHandler[String] with Logging {
    +
    +  override def channelRead0(ctx: ChannelHandlerContext, blockIdString: String): Unit = {
    +    val blockId: BlockId = BlockId.apply(blockIdString)
    --- End diff --
    
    BlockId(blockIdString)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by aarondav <gi...@git.apache.org>.
Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16033207
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileClient.scala ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.util.concurrent.TimeUnit
    +
    +import io.netty.bootstrap.Bootstrap
    +import io.netty.channel.{Channel, ChannelOption, EventLoopGroup}
    +import io.netty.channel.oio.OioEventLoopGroup
    +import io.netty.channel.socket.oio.OioSocketChannel
    +
    +import org.apache.spark.Logging
    +
    +class FileClient(handler: FileClientHandler, connectTimeout: Int) extends Logging {
    +
    +  private var channel: Channel = _
    +  private var bootstrap: Bootstrap = _
    +  private var group: EventLoopGroup = _
    +  private val sendTimeout = 60
    --- End diff --
    
    The comment "// 1 min" wasn't useless because it's not 100% clear that this is in seconds otherwise (though one could guess)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51677761
  
    QA tests have started for PR 1865. This patch merges cleanly. <br>View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18242/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/1865


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by aarondav <gi...@git.apache.org>.
Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16033208
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileClient.scala ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.util.concurrent.TimeUnit
    +
    +import io.netty.bootstrap.Bootstrap
    +import io.netty.channel.{Channel, ChannelOption, EventLoopGroup}
    +import io.netty.channel.oio.OioEventLoopGroup
    +import io.netty.channel.socket.oio.OioSocketChannel
    +
    +import org.apache.spark.Logging
    +
    +class FileClient(handler: FileClientHandler, connectTimeout: Int) extends Logging {
    +
    +  private var channel: Channel = _
    +  private var bootstrap: Bootstrap = _
    +  private var group: EventLoopGroup = _
    +  private val sendTimeout = 60
    +
    +  def init(): Unit = {
    +    group = new OioEventLoopGroup
    +    bootstrap = new Bootstrap
    +    bootstrap.group(group)
    +      .channel(classOf[OioSocketChannel])
    +      .option(ChannelOption.SO_KEEPALIVE, java.lang.Boolean.TRUE)
    +      .option(ChannelOption.TCP_NODELAY, java.lang.Boolean.TRUE)
    +      .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Integer.valueOf(connectTimeout))
    --- End diff --
    
    Why is this needed?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51735269
  
    QA results for PR 1865:<br>- This patch PASSES unit tests.<br>- This patch merges cleanly<br>- This patch adds no public classes<br><br>For more information see test ouptut:<br>https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18292/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16034776
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileServer.scala ---
    @@ -0,0 +1,90 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.net.InetSocketAddress
    +
    +import io.netty.bootstrap.ServerBootstrap
    +import io.netty.channel.{ChannelFuture, ChannelOption, EventLoopGroup}
    +import io.netty.channel.oio.OioEventLoopGroup
    +import io.netty.channel.socket.oio.OioServerSocketChannel
    +
    +import org.apache.spark.Logging
    +
    +/**
    + * Server that accept the path of a file an echo back its content.
    + */
    +class FileServer(pResolver: PathResolver, private var port: Int) extends Logging {
    +
    +  private val addr: InetSocketAddress = new InetSocketAddress(port)
    +  private var bossGroup: EventLoopGroup = new OioEventLoopGroup
    +  private var workerGroup: EventLoopGroup = new OioEventLoopGroup
    +
    +  private var channelFuture: ChannelFuture = {
    +    val bootstrap = new ServerBootstrap
    +    bootstrap.group(bossGroup, workerGroup)
    +      .channel(classOf[OioServerSocketChannel])
    +      .option(ChannelOption.SO_BACKLOG, java.lang.Integer.valueOf(100))
    +      .option(ChannelOption.SO_RCVBUF, java.lang.Integer.valueOf(1500))
    +      .childHandler(new FileServerChannelInitializer(pResolver))
    +    bootstrap.bind(addr)
    +  }
    +
    +  try {
    +    val boundAddress = channelFuture.sync.channel.localAddress.asInstanceOf[InetSocketAddress]
    +    port = boundAddress.getPort
    +  } catch {
    +    case ie: InterruptedException =>
    +      port = 0
    +  }
    +
    +  /** Start the file server asynchronously in a new thread. */
    +  def start(): Unit = {
    +    val blockingThread: Thread = new Thread {
    +      override def run(): Unit = {
    +        try {
    +          channelFuture.channel.closeFuture.sync
    +          logInfo("FileServer exiting")
    +        } catch {
    +          case e: InterruptedException =>
    +            logError("File server start got interrupted", e)
    +        }
    +      }
    +    }
    +    blockingThread.setDaemon(true)
    +    blockingThread.start()
    +  }
    +
    +  def getPort: Int = port
    +
    +  def stop(): Unit = {
    +    if (channelFuture != null) {
    +      channelFuture.channel().close().awaitUninterruptibly()
    +      channelFuture = null
    +    }
    +    if (bossGroup != null) {
    +      bossGroup.shutdownGracefully()
    +      bossGroup = null
    +    }
    +    if (workerGroup != null) {
    +      workerGroup.shutdownGracefully()
    +      workerGroup = null
    +    }
    --- End diff --
    
    that TODO was a question, whose answer was "not neeed"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by aarondav <gi...@git.apache.org>.
Github user aarondav commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51726479
  
    Just had a couple minor issues with the translation, LGTM functionality-wise. Did not do a thorough diff check, though.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51696295
  
    QA results for PR 1865:<br>- This patch PASSES unit tests.<br>- This patch merges cleanly<br>- This patch adds no public classes<br><br>For more information see test ouptut:<br>https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18256/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by aarondav <gi...@git.apache.org>.
Github user aarondav commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51739280
  
    Merging into master.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by aarondav <gi...@git.apache.org>.
Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16033197
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileServer.scala ---
    @@ -0,0 +1,90 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.net.InetSocketAddress
    +
    +import io.netty.bootstrap.ServerBootstrap
    +import io.netty.channel.{ChannelFuture, ChannelOption, EventLoopGroup}
    +import io.netty.channel.oio.OioEventLoopGroup
    +import io.netty.channel.socket.oio.OioServerSocketChannel
    +
    +import org.apache.spark.Logging
    +
    +/**
    + * Server that accept the path of a file an echo back its content.
    + */
    +class FileServer(pResolver: PathResolver, private var port: Int) extends Logging {
    +
    +  private val addr: InetSocketAddress = new InetSocketAddress(port)
    +  private var bossGroup: EventLoopGroup = new OioEventLoopGroup
    +  private var workerGroup: EventLoopGroup = new OioEventLoopGroup
    +
    +  private var channelFuture: ChannelFuture = {
    +    val bootstrap = new ServerBootstrap
    +    bootstrap.group(bossGroup, workerGroup)
    +      .channel(classOf[OioServerSocketChannel])
    +      .option(ChannelOption.SO_BACKLOG, java.lang.Integer.valueOf(100))
    +      .option(ChannelOption.SO_RCVBUF, java.lang.Integer.valueOf(1500))
    +      .childHandler(new FileServerChannelInitializer(pResolver))
    +    bootstrap.bind(addr)
    +  }
    +
    +  try {
    +    val boundAddress = channelFuture.sync.channel.localAddress.asInstanceOf[InetSocketAddress]
    +    port = boundAddress.getPort
    +  } catch {
    +    case ie: InterruptedException =>
    +      port = 0
    +  }
    +
    +  /** Start the file server asynchronously in a new thread. */
    +  def start(): Unit = {
    +    val blockingThread: Thread = new Thread {
    +      override def run(): Unit = {
    +        try {
    +          channelFuture.channel.closeFuture.sync
    +          logInfo("FileServer exiting")
    +        } catch {
    +          case e: InterruptedException =>
    +            logError("File server start got interrupted", e)
    +        }
    --- End diff --
    
    You got rid of NOTE, that seemed useful


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51678535
  
    QA results for PR 1865:<br>- This patch PASSES unit tests.<br>- This patch merges cleanly<br>- This patch adds no public classes<br><br>For more information see test ouptut:<br>https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18242/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51694967
  
    Jenkins, retest this please.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16034768
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileClient.scala ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.util.concurrent.TimeUnit
    +
    +import io.netty.bootstrap.Bootstrap
    +import io.netty.channel.{Channel, ChannelOption, EventLoopGroup}
    +import io.netty.channel.oio.OioEventLoopGroup
    +import io.netty.channel.socket.oio.OioSocketChannel
    +
    +import org.apache.spark.Logging
    +
    +class FileClient(handler: FileClientHandler, connectTimeout: Int) extends Logging {
    +
    +  private var channel: Channel = _
    +  private var bootstrap: Bootstrap = _
    +  private var group: EventLoopGroup = _
    +  private val sendTimeout = 60
    --- End diff --
    
    This will be gone soon.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by aarondav <gi...@git.apache.org>.
Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16033193
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileServer.scala ---
    @@ -0,0 +1,90 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.net.InetSocketAddress
    +
    +import io.netty.bootstrap.ServerBootstrap
    +import io.netty.channel.{ChannelFuture, ChannelOption, EventLoopGroup}
    +import io.netty.channel.oio.OioEventLoopGroup
    +import io.netty.channel.socket.oio.OioServerSocketChannel
    +
    +import org.apache.spark.Logging
    +
    +/**
    + * Server that accept the path of a file an echo back its content.
    + */
    +class FileServer(pResolver: PathResolver, private var port: Int) extends Logging {
    +
    +  private val addr: InetSocketAddress = new InetSocketAddress(port)
    +  private var bossGroup: EventLoopGroup = new OioEventLoopGroup
    +  private var workerGroup: EventLoopGroup = new OioEventLoopGroup
    +
    +  private var channelFuture: ChannelFuture = {
    +    val bootstrap = new ServerBootstrap
    +    bootstrap.group(bossGroup, workerGroup)
    +      .channel(classOf[OioServerSocketChannel])
    +      .option(ChannelOption.SO_BACKLOG, java.lang.Integer.valueOf(100))
    +      .option(ChannelOption.SO_RCVBUF, java.lang.Integer.valueOf(1500))
    +      .childHandler(new FileServerChannelInitializer(pResolver))
    +    bootstrap.bind(addr)
    +  }
    +
    +  try {
    +    val boundAddress = channelFuture.sync.channel.localAddress.asInstanceOf[InetSocketAddress]
    +    port = boundAddress.getPort
    +  } catch {
    +    case ie: InterruptedException =>
    +      port = 0
    +  }
    +
    +  /** Start the file server asynchronously in a new thread. */
    +  def start(): Unit = {
    +    val blockingThread: Thread = new Thread {
    +      override def run(): Unit = {
    +        try {
    +          channelFuture.channel.closeFuture.sync
    +          logInfo("FileServer exiting")
    +        } catch {
    +          case e: InterruptedException =>
    +            logError("File server start got interrupted", e)
    +        }
    +      }
    +    }
    +    blockingThread.setDaemon(true)
    +    blockingThread.start()
    +  }
    +
    +  def getPort: Int = port
    +
    +  def stop(): Unit = {
    +    if (channelFuture != null) {
    +      channelFuture.channel().close().awaitUninterruptibly()
    +      channelFuture = null
    +    }
    +    if (bossGroup != null) {
    +      bossGroup.shutdownGracefully()
    +      bossGroup = null
    +    }
    +    if (workerGroup != null) {
    +      workerGroup.shutdownGracefully()
    +      workerGroup = null
    +    }
    --- End diff --
    
    You got rid of the TODO - is it done?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51695016
  
    QA tests have started for PR 1865. This patch merges cleanly. <br>View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18256/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51733424
  
    QA tests have started for PR 1865. This patch merges cleanly. <br>View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18292/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/1865#issuecomment-51680283
  
    QA tests have started for PR 1865. This patch merges cleanly. <br>View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18250/consoleFull


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by aarondav <gi...@git.apache.org>.
Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16033305
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileClient.scala ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.util.concurrent.TimeUnit
    +
    +import io.netty.bootstrap.Bootstrap
    +import io.netty.channel.{Channel, ChannelOption, EventLoopGroup}
    +import io.netty.channel.oio.OioEventLoopGroup
    +import io.netty.channel.socket.oio.OioSocketChannel
    +
    +import org.apache.spark.Logging
    +
    +class FileClient(handler: FileClientHandler, connectTimeout: Int) extends Logging {
    +
    +  private var channel: Channel = _
    +  private var bootstrap: Bootstrap = _
    +  private var group: EventLoopGroup = _
    +  private val sendTimeout = 60
    +
    +  def init(): Unit = {
    +    group = new OioEventLoopGroup
    +    bootstrap = new Bootstrap
    +    bootstrap.group(group)
    +      .channel(classOf[OioSocketChannel])
    +      .option(ChannelOption.SO_KEEPALIVE, java.lang.Boolean.TRUE)
    +      .option(ChannelOption.TCP_NODELAY, java.lang.Boolean.TRUE)
    +      .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Integer.valueOf(connectTimeout))
    --- End diff --
    
    Sorry, wasn't asking about connectTimeout, I meant the Integer.valueOf(). I'm guessing it just doesn't compile without, which is kinda weird, you'd think there'd be a conversion from primitive to boxed in the Scala compiler.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-2936] Migrate Netty network module from...

Posted by shivaram <gi...@git.apache.org>.
Github user shivaram commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1865#discussion_r16033275
  
    --- Diff: core/src/main/scala/org/apache/spark/network/netty/FileClient.scala ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.network.netty
    +
    +import java.util.concurrent.TimeUnit
    +
    +import io.netty.bootstrap.Bootstrap
    +import io.netty.channel.{Channel, ChannelOption, EventLoopGroup}
    +import io.netty.channel.oio.OioEventLoopGroup
    +import io.netty.channel.socket.oio.OioSocketChannel
    +
    +import org.apache.spark.Logging
    +
    +class FileClient(handler: FileClientHandler, connectTimeout: Int) extends Logging {
    +
    +  private var channel: Channel = _
    +  private var bootstrap: Bootstrap = _
    +  private var group: EventLoopGroup = _
    +  private val sendTimeout = 60
    +
    +  def init(): Unit = {
    +    group = new OioEventLoopGroup
    +    bootstrap = new Bootstrap
    +    bootstrap.group(group)
    +      .channel(classOf[OioSocketChannel])
    +      .option(ChannelOption.SO_KEEPALIVE, java.lang.Boolean.TRUE)
    +      .option(ChannelOption.TCP_NODELAY, java.lang.Boolean.TRUE)
    +      .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Integer.valueOf(connectTimeout))
    --- End diff --
    
    I think having a connectTimeout is pretty useful ? I often notice connect timeouts on EC2 and this is not configurable in the default shuffle implementation (that is partly because we use NIO with SocketChannels etc.)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org