spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewor14 <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-8029] Robust shuffle writer
Date Fri, 13 Nov 2015 02:00:13 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9610#discussion_r44742645
  
    --- Diff: core/src/main/scala/org/apache/spark/shuffle/IndexShuffleBlockResolver.scala
---
    @@ -75,13 +81,68 @@ private[spark] class IndexShuffleBlockResolver(conf: SparkConf) extends
ShuffleB
       }
     
       /**
    +   * Check whether there are index file and data file also they are matched with each
other, returns
    +   * the lengths of each block in data file, if there are matched, or return null.
    +   */
    +  private def checkIndexAndDataFile(index: File, data: File, blocks: Int): Array[Long]
= {
    +    val lengths = new Array[Long](blocks)
    +    if (index.length() == (blocks + 1) * 8) {
    +      // Read the lengths of blocks
    +      val f = try {
    +        new FileInputStream(index)
    +      } catch {
    +        case e: IOException =>
    +          return null
    +      }
    +      val in = new DataInputStream(new BufferedInputStream(f))
    +      try {
    +        // Convert the offsets into lengths of each block
    +        var offset = in.readLong()
    +        if (offset != 0L) {
    +          return null
    --- End diff --
    
    ```
    // first offset should be 0
    return null
    ```


---
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


Mime
View raw message