You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by vanzin <gi...@git.apache.org> on 2016/11/22 21:28:20 UTC

[GitHub] spark pull request #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

GitHub user vanzin opened a pull request:

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

    [SPARK-18546][core] Fix merging shuffle spills when using encryption.

    The problem exists because it's not possible to just concatenate encrypted
    partition data from different spill files; currently each partition would
    have its own initial vector to set up encryption, and the final merged file
    should contain a single initial vector for each merged partiton, otherwise
    iterating over each record becomes really hard.
    
    To fix that, UnsafeShuffleWriter now decrypts the partitions when merging,
    so that the merged file contains a single initial vector at the start of
    the partition data.
    
    Because it's not possible to do that using the fast transferTo path, when
    encryption is enabled UnsafeShuffleWriter will revert back to using file
    streams when merging. It may be possible to use a hybrid approach when
    using encryption, using an intermediate direct buffer when reading from
    files and encrypting the data, but that's better left for a separate patch.
    
    As part of the change I made DiskBlockObjectWriter take a SerializerManager
    instead of a "wrap stream" closure, since that makes it easier to test the
    code without having to mock SerializerManager functionality.
    
    Tested with newly added unit tests (UnsafeShuffleWriterSuite for the write
    side and ExternalAppendOnlyMapSuite for integration), and by running some
    apps that failed without the fix.


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

    $ git pull https://github.com/vanzin/spark SPARK-18546

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

    https://github.com/apache/spark/pull/15982.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 #15982
    
----
commit 7ed0d7c0312224252768b6f463603e57ca5e65d4
Author: Marcelo Vanzin <va...@cloudera.com>
Date:   2016-11-20T02:02:56Z

    [SPARK-18547][core] Propagate I/O encryption key when executors register.
    
    This change modifies the method used to propagate encryption keys used during
    shuffle. Instead of relying on YARN's UserGroupInformation credential propagation,
    this change explicitly distributes the key using the messages exchanged between
    driver and executor during registration. When RPC encryption is enabled, this means
    key propagation is also secure.
    
    This allows shuffle encryption to work in non-YARN mode, which means that it's
    easier to write unit tests for areas of the code that are affected by the feature.
    
    The key is stored in the SecurityManager; because there are many instances of
    that class used in the code, the key is only guaranteed to exist in the instance
    managed by the SparkEnv. This path was chosen to avoid storing the key in the
    SparkConf, which would risk having the key being written to disk as part of the
    configuration (as, for example, is done when starting YARN applications).
    
    Test by new and existing unit tests (which were moved from the YARN module to
    core), and by running apps with shuffle encryption enabled.

commit fbd2bcaa44d7dba2a43d4fe2b3ac3830d3388857
Author: Marcelo Vanzin <va...@cloudera.com>
Date:   2016-11-18T01:07:03Z

    [SPARK-18546][core] Fix merging shuffle spills when using encryption.
    
    The problem exists because it's not possible to just concatenate encrypted
    partition data from different spill files; currently each partition would
    have its own initial vector to set up encryption, and the final merged file
    should contain a single initial vector for each merged partiton, otherwise
    iterating over each record becomes really hard.
    
    To fix that, UnsafeShuffleWriter now decrypts the partitions when merging,
    so that the merged file contains a single initial vector at the start of
    the partition data.
    
    Because it's not possible to do that using the fast transferTo path, when
    encryption is enabled UnsafeShuffleWriter will revert back to using file
    streams when merging. It may be possible to use a hybrid approach when
    using encryption, using an intermediate direct buffer when reading from
    files and encrypting the data, but that's better left for a separate patch.
    
    As part of the change I made DiskBlockObjectWriter take a SerializerManager
    instead of a "wrap stream" closure, since that makes it easier to test the
    code without having to mock SerializerManager functionality.
    
    Tested with newly added unit tests (UnsafeShuffleWriterSuite for the write
    side and ExternalAppendOnlyMapSuite for integration), and by running some
    apps that failed without the fix.

----


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69360/
    Test FAILed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69040 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69040/consoleFull)** for PR 15982 at commit [`3b879f4`](https://github.com/apache/spark/commit/3b879f4045edc458de723d0c2fb2f489391f999d).


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merged build finished. Test PASSed.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90085605
  
    --- Diff: core/src/main/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriter.java ---
    @@ -337,42 +340,38 @@ void forceSorterToSpill() throws IOException {
         final int numPartitions = partitioner.numPartitions();
         final long[] partitionLengths = new long[numPartitions];
         final InputStream[] spillInputStreams = new FileInputStream[spills.length];
    -    OutputStream mergedFileOutputStream = null;
    +    final CountingOutputStream mergedFileOutputStream = new CountingOutputStream(
    +      new FileOutputStream(outputFile));
     
         boolean threwException = true;
         try {
           for (int i = 0; i < spills.length; i++) {
             spillInputStreams[i] = new FileInputStream(spills[i].file);
           }
           for (int partition = 0; partition < numPartitions; partition++) {
    -        final long initialFileLength = outputFile.length();
    -        mergedFileOutputStream =
    -          new TimeTrackingOutputStream(writeMetrics, new FileOutputStream(outputFile, true));
    +        final long initialFileLength = mergedFileOutputStream.getByteCount();
    +        OutputStream partitionOutput = new CloseShieldOutputStream(mergedFileOutputStream);
    +        partitionOutput = blockManager.serializerManager().wrapForEncryption(partitionOutput);
             if (compressionCodec != null) {
    -          mergedFileOutputStream = compressionCodec.compressedOutputStream(mergedFileOutputStream);
    +          partitionOutput = compressionCodec.compressedOutputStream(partitionOutput);
             }
    -
    +        partitionOutput = new TimeTrackingOutputStream(writeMetrics, partitionOutput);
             for (int i = 0; i < spills.length; i++) {
               final long partitionLengthInSpill = spills[i].partitionLengths[partition];
               if (partitionLengthInSpill > 0) {
    -            InputStream partitionInputStream = null;
    -            boolean innerThrewException = true;
    -            try {
    -              partitionInputStream =
    -                  new LimitedInputStream(spillInputStreams[i], partitionLengthInSpill, false);
    -              if (compressionCodec != null) {
    -                partitionInputStream = compressionCodec.compressedInputStream(partitionInputStream);
    -              }
    -              ByteStreams.copy(partitionInputStream, mergedFileOutputStream);
    -              innerThrewException = false;
    -            } finally {
    -              Closeables.close(partitionInputStream, innerThrewException);
    +            InputStream partitionInputStream = new LimitedInputStream(spillInputStreams[i],
    +              partitionLengthInSpill, false);
    +            partitionInputStream = blockManager.serializerManager().wrapForEncryption(
    --- End diff --
    
    `partitionInputStream` is not closed



---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69375 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69375/consoleFull)** for PR 15982 at commit [`1025c6b`](https://github.com/apache/spark/commit/1025c6bb384968a7fc474d35a1bb18d82eb21938).


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69419 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69419/consoleFull)** for PR 15982 at commit [`49737d9`](https://github.com/apache/spark/commit/49737d9c574694abb8ea438bd2bb84ca65364259).


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69337 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69337/consoleFull)** for PR 15982 at commit [`2e03ee6`](https://github.com/apache/spark/commit/2e03ee6faec0984eeab0ffe2699ec7cb59bf0c43).


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merged build finished. Test PASSed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69337 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69337/consoleFull)** for PR 15982 at commit [`2e03ee6`](https://github.com/apache/spark/commit/2e03ee6faec0984eeab0ffe2699ec7cb59bf0c43).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69419/
    Test PASSed.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90086862
  
    --- Diff: core/src/test/scala/org/apache/spark/util/collection/ExternalAppendOnlyMapSuite.scala ---
    @@ -17,9 +17,13 @@
     
     package org.apache.spark.util.collection
     
    +import java.security.PrivilegedExceptionAction
    +
     import scala.collection.mutable.ArrayBuffer
     
     import org.apache.spark._
    +import org.apache.spark.deploy.SparkHadoopUtil
    --- End diff --
    
    nit: unused import


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90083229
  
    --- Diff: core/src/main/scala/org/apache/spark/serializer/SerializerManager.scala ---
    @@ -144,14 +144,14 @@ private[spark] class SerializerManager(
       /**
        * Wrap an output stream for compression if block compression is enabled for its block type
        */
    -  private[this] def wrapForCompression(blockId: BlockId, s: OutputStream): OutputStream = {
    +  def wrapForCompression(blockId: BlockId, s: OutputStream): OutputStream = {
         if (shouldCompress(blockId)) compressionCodec.compressedOutputStream(s) else s
       }
     
       /**
        * Wrap an input stream for compression if block compression is enabled for its block type
        */
    -  private[this] def wrapForCompression(blockId: BlockId, s: InputStream): InputStream = {
    +  def wrapForCompression(blockId: BlockId, s: InputStream): InputStream = {
    --- End diff --
    
    nit: not need to open this method


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merged build finished. Test PASSed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merging to master / 2.1.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69375/
    Test PASSed.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90083215
  
    --- Diff: core/src/main/scala/org/apache/spark/serializer/SerializerManager.scala ---
    @@ -144,14 +144,14 @@ private[spark] class SerializerManager(
       /**
        * Wrap an output stream for compression if block compression is enabled for its block type
        */
    -  private[this] def wrapForCompression(blockId: BlockId, s: OutputStream): OutputStream = {
    +  def wrapForCompression(blockId: BlockId, s: OutputStream): OutputStream = {
    --- End diff --
    
    nit: not need to open this method


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69030 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69030/consoleFull)** for PR 15982 at commit [`fbd2bca`](https://github.com/apache/spark/commit/fbd2bcaa44d7dba2a43d4fe2b3ac3830d3388857).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90089946
  
    --- Diff: core/src/test/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriterSuite.java ---
    @@ -338,42 +354,60 @@ private void testMergingSpills(
     
       @Test
       public void mergeSpillsWithTransferToAndLZF() throws Exception {
    -    testMergingSpills(true, LZFCompressionCodec.class.getName());
    +    testMergingSpills(true, LZFCompressionCodec.class.getName(), false);
       }
     
       @Test
       public void mergeSpillsWithFileStreamAndLZF() throws Exception {
    -    testMergingSpills(false, LZFCompressionCodec.class.getName());
    +    testMergingSpills(false, LZFCompressionCodec.class.getName(), false);
       }
     
       @Test
       public void mergeSpillsWithTransferToAndLZ4() throws Exception {
    -    testMergingSpills(true, LZ4CompressionCodec.class.getName());
    +    testMergingSpills(true, LZ4CompressionCodec.class.getName(), false);
       }
     
       @Test
       public void mergeSpillsWithFileStreamAndLZ4() throws Exception {
    -    testMergingSpills(false, LZ4CompressionCodec.class.getName());
    +    testMergingSpills(false, LZ4CompressionCodec.class.getName(), false);
       }
     
       @Test
       public void mergeSpillsWithTransferToAndSnappy() throws Exception {
    -    testMergingSpills(true, SnappyCompressionCodec.class.getName());
    +    testMergingSpills(true, SnappyCompressionCodec.class.getName(), false);
       }
     
       @Test
       public void mergeSpillsWithFileStreamAndSnappy() throws Exception {
    -    testMergingSpills(false, SnappyCompressionCodec.class.getName());
    +    testMergingSpills(false, SnappyCompressionCodec.class.getName(), false);
       }
     
       @Test
       public void mergeSpillsWithTransferToAndNoCompression() throws Exception {
    -    testMergingSpills(true, null);
    +    testMergingSpills(true, null, false);
       }
     
       @Test
       public void mergeSpillsWithFileStreamAndNoCompression() throws Exception {
    -    testMergingSpills(false, null);
    +    testMergingSpills(false, null, false);
    +  }
    +
    +  @Test
    +  public void mergeSpillsWithCompressionAndEncryption() throws Exception {
    +    // This should actually be translated to a "file stream merge" internally, just have the
    +    // test to make sure that it's the case.
    +    testMergingSpills(true, LZ4CompressionCodec.class.getName(), true);
    +  }
    +
    +  @Test
    +  public void mergeSpillsWithFileStreamAndCompressionAndEncryption() throws Exception {
    +    testMergingSpills(false, LZ4CompressionCodec.class.getName(), true);
    +  }
    +
    +  @Test
    +  public void mergeSpillsWithCompressionAndEncryptionSlowPath() throws Exception {
    --- End diff --
    
    We should also test `testMergingSpills(false, null, true);` and `testMergingSpills(true, null, true)`.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90133223
  
    --- Diff: core/src/main/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriter.java ---
    @@ -337,42 +340,47 @@ void forceSorterToSpill() throws IOException {
         final int numPartitions = partitioner.numPartitions();
         final long[] partitionLengths = new long[numPartitions];
         final InputStream[] spillInputStreams = new FileInputStream[spills.length];
    -    OutputStream mergedFileOutputStream = null;
    +
    +    // Use a counting output stream to avoid having to close the underlying file and ask
    +    // the file system for its size after each partition is written.
    +    final CountingOutputStream mergedFileOutputStream = new CountingOutputStream(
    +      new FileOutputStream(outputFile));
     
         boolean threwException = true;
         try {
           for (int i = 0; i < spills.length; i++) {
             spillInputStreams[i] = new FileInputStream(spills[i].file);
           }
           for (int partition = 0; partition < numPartitions; partition++) {
    -        final long initialFileLength = outputFile.length();
    -        mergedFileOutputStream =
    -          new TimeTrackingOutputStream(writeMetrics, new FileOutputStream(outputFile, true));
    +        final long initialFileLength = mergedFileOutputStream.getByteCount();
    +        // Shield the underlying output stream from close() calls, so that we can close the higher
    +        // level streams to make sure all data is really flushed and internal state is cleaned.
    +        OutputStream partitionOutput = new CloseShieldOutputStream(mergedFileOutputStream);
    +        partitionOutput = blockManager.serializerManager().wrapForEncryption(partitionOutput);
             if (compressionCodec != null) {
    -          mergedFileOutputStream = compressionCodec.compressedOutputStream(mergedFileOutputStream);
    +          partitionOutput = compressionCodec.compressedOutputStream(partitionOutput);
             }
    -
    +        partitionOutput = new TimeTrackingOutputStream(writeMetrics, partitionOutput);
    --- End diff --
    
    Hmm... let me revert this and open a bug. `DiskBlockObjectWriter` doesn't count the time for compression / encryption, so this should behave the same. Both should be fixed together.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69348/
    Test PASSed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Ping.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90086837
  
    --- Diff: core/src/test/scala/org/apache/spark/util/collection/ExternalAppendOnlyMapSuite.scala ---
    @@ -17,9 +17,13 @@
     
     package org.apache.spark.util.collection
     
    +import java.security.PrivilegedExceptionAction
    --- End diff --
    
    nit: unused import


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90127514
  
    --- Diff: core/src/test/java/org/apache/spark/unsafe/map/AbstractBytesToBytesMapSuite.java ---
    @@ -75,13 +75,6 @@
       @Mock(answer = RETURNS_SMART_NULLS) BlockManager blockManager;
       @Mock(answer = RETURNS_SMART_NULLS) DiskBlockManager diskBlockManager;
     
    -  private static final class WrapStream extends AbstractFunction1<OutputStream, OutputStream> {
    --- End diff --
    
    you can eliminate the imports of `AbstractFunction1` and `OutputStream` after this


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merged build finished. Test PASSed.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

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


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    LGTM


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    This also contains the changes in #15981 since it's built on top of those, but they should be merged separately. The fix for this bug is in the second commit.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69030/
    Test FAILed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69348 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69348/consoleFull)** for PR 15982 at commit [`8ac9276`](https://github.com/apache/spark/commit/8ac927623c5d7809208b766001f46ea2ad576af9).


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69035 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69035/consoleFull)** for PR 15982 at commit [`3b879f4`](https://github.com/apache/spark/commit/3b879f4045edc458de723d0c2fb2f489391f999d).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90121766
  
    --- Diff: core/src/main/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriter.java ---
    @@ -337,42 +340,47 @@ void forceSorterToSpill() throws IOException {
         final int numPartitions = partitioner.numPartitions();
         final long[] partitionLengths = new long[numPartitions];
         final InputStream[] spillInputStreams = new FileInputStream[spills.length];
    -    OutputStream mergedFileOutputStream = null;
    +
    +    // Use a counting output stream to avoid having to close the underlying file and ask
    +    // the file system for its size after each partition is written.
    +    final CountingOutputStream mergedFileOutputStream = new CountingOutputStream(
    +      new FileOutputStream(outputFile));
     
         boolean threwException = true;
         try {
           for (int i = 0; i < spills.length; i++) {
             spillInputStreams[i] = new FileInputStream(spills[i].file);
           }
           for (int partition = 0; partition < numPartitions; partition++) {
    -        final long initialFileLength = outputFile.length();
    -        mergedFileOutputStream =
    -          new TimeTrackingOutputStream(writeMetrics, new FileOutputStream(outputFile, true));
    +        final long initialFileLength = mergedFileOutputStream.getByteCount();
    +        // Shield the underlying output stream from close() calls, so that we can close the higher
    +        // level streams to make sure all data is really flushed and internal state is cleaned.
    +        OutputStream partitionOutput = new CloseShieldOutputStream(mergedFileOutputStream);
    +        partitionOutput = blockManager.serializerManager().wrapForEncryption(partitionOutput);
             if (compressionCodec != null) {
    -          mergedFileOutputStream = compressionCodec.compressedOutputStream(mergedFileOutputStream);
    +          partitionOutput = compressionCodec.compressedOutputStream(partitionOutput);
             }
    -
    +        partitionOutput = new TimeTrackingOutputStream(writeMetrics, partitionOutput);
    --- End diff --
    
    another change here is that `TimeTrackingOutputStream` now goes around the compression codec.  I think that is the right change, but its at least worth mentioning in the commit msg.
    
    I'm wondering if this its worth having a separate jira for this, just since it will effect metrics for all users


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69360 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69360/consoleFull)** for PR 15982 at commit [`1025c6b`](https://github.com/apache/spark/commit/1025c6bb384968a7fc474d35a1bb18d82eb21938).


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    /cc @zsxwing @JoshRosen


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69040 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69040/consoleFull)** for PR 15982 at commit [`3b879f4`](https://github.com/apache/spark/commit/3b879f4045edc458de723d0c2fb2f489391f999d).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69360 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69360/consoleFull)** for PR 15982 at commit [`1025c6b`](https://github.com/apache/spark/commit/1025c6bb384968a7fc474d35a1bb18d82eb21938).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by squito <gi...@git.apache.org>.
Github user squito commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    I think the comment on `#mergeSpillsWithFileStreams` needs to be updated slightly to include encryption, but other than that lgtm.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merged build finished. Test FAILed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69337/
    Test PASSed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Unrelated failure. 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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69035/
    Test FAILed.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90126726
  
    --- Diff: core/src/test/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriterSuite.java ---
    @@ -40,9 +41,11 @@
     import org.mockito.stubbing.Answer;
     
     import org.apache.spark.HashPartitioner;
    +import org.apache.spark.SecurityManager;
     import org.apache.spark.ShuffleDependency;
     import org.apache.spark.SparkConf;
     import org.apache.spark.TaskContext;
    +import org.apache.spark.deploy.SparkHadoopUtil;
    --- End diff --
    
    other than `CryptoStreamUtils`, the other added imports look unused.  Also looks like you can eliminate `AbstractFunction1` and `ByteStreams` since you are no longer using them.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69375 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69375/consoleFull)** for PR 15982 at commit [`1025c6b`](https://github.com/apache/spark/commit/1025c6bb384968a7fc474d35a1bb18d82eb21938).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69040/
    Test PASSed.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90076997
  
    --- Diff: core/src/main/scala/org/apache/spark/serializer/SerializerManager.scala ---
    @@ -36,7 +36,7 @@ import org.apache.spark.util.io.{ChunkedByteBuffer, ChunkedByteBufferOutputStrea
     private[spark] class SerializerManager(
         defaultSerializer: Serializer,
         conf: SparkConf,
    -    encryptionKey: Option[Array[Byte]]) {
    +    val encryptionKey: Option[Array[Byte]]) {
    --- End diff --
    
    nit: I prefer to add a method called `isEncryptionEnabled` instead of exposing this field.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90082215
  
    --- Diff: core/src/main/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriter.java ---
    @@ -337,42 +340,38 @@ void forceSorterToSpill() throws IOException {
         final int numPartitions = partitioner.numPartitions();
         final long[] partitionLengths = new long[numPartitions];
         final InputStream[] spillInputStreams = new FileInputStream[spills.length];
    -    OutputStream mergedFileOutputStream = null;
    +    final CountingOutputStream mergedFileOutputStream = new CountingOutputStream(
    --- End diff --
    
    Could you add a comment about why need to use `CountingOutputStream` + `CloseShieldOutputStream`? It took me a while to figure out the optimization you did.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69030 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69030/consoleFull)** for PR 15982 at commit [`fbd2bca`](https://github.com/apache/spark/commit/fbd2bcaa44d7dba2a43d4fe2b3ac3830d3388857).


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merged build finished. Test PASSed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merged build finished. Test FAILed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merged build finished. Test FAILed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69348 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69348/consoleFull)** for PR 15982 at commit [`8ac9276`](https://github.com/apache/spark/commit/8ac927623c5d7809208b766001f46ea2ad576af9).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69032 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69032/consoleFull)** for PR 15982 at commit [`3b879f4`](https://github.com/apache/spark/commit/3b879f4045edc458de723d0c2fb2f489391f999d).
     * This patch **fails build dependency tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Merged build finished. Test FAILed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/69032/
    Test FAILed.


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69032 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69032/consoleFull)** for PR 15982 at commit [`3b879f4`](https://github.com/apache/spark/commit/3b879f4045edc458de723d0c2fb2f489391f999d).


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69035 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69035/consoleFull)** for PR 15982 at commit [`3b879f4`](https://github.com/apache/spark/commit/3b879f4045edc458de723d0c2fb2f489391f999d).


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

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

    https://github.com/apache/spark/pull/15982
  
    **[Test build #69419 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69419/consoleFull)** for PR 15982 at commit [`49737d9`](https://github.com/apache/spark/commit/49737d9c574694abb8ea438bd2bb84ca65364259).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 #15982: [SPARK-18546][core] Fix merging shuffle spills wh...

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

    https://github.com/apache/spark/pull/15982#discussion_r90127615
  
    --- Diff: core/src/test/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorterSuite.java ---
    @@ -86,14 +88,7 @@ public int compare(
     
       protected boolean shouldUseRadixSort() { return false; }
     
    -  private final long pageSizeBytes = new SparkConf().getSizeAsBytes("spark.buffer.pageSize", "4m");
    -
    -  private static final class WrapStream extends AbstractFunction1<OutputStream, OutputStream> {
    --- End diff --
    
    same on trimming imports


---
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 issue #15982: [SPARK-18546][core] Fix merging shuffle spills when usin...

Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/15982
  
    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