-
- Downloads
[SPARK-20244][CORE] Handle incorrect bytesRead metrics when using PySpark
## What changes were proposed in this pull request? Hadoop FileSystem's statistics in based on thread local variables, this is ok if the RDD computation chain is running in the same thread. But if child RDD creates another thread to consume the iterator got from Hadoop RDDs, the bytesRead computation will be error, because now the iterator's `next()` and `close()` may run in different threads. This could be happened when using PySpark with PythonRDD. So here building a map to track the `bytesRead` for different thread and add them together. This method will be used in three RDDs, `HadoopRDD`, `NewHadoopRDD` and `FileScanRDD`. I assume `FileScanRDD` cannot be called directly, so I only fixed `HadoopRDD` and `NewHadoopRDD`. ## How was this patch tested? Unit test and local cluster verification. Author: jerryshao <sshao@hortonworks.com> Closes #17617 from jerryshao/SPARK-20244.
Showing
- core/src/main/scala/org/apache/spark/deploy/SparkHadoopUtil.scala 22 additions, 6 deletions.../main/scala/org/apache/spark/deploy/SparkHadoopUtil.scala
- core/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala 7 additions, 1 deletioncore/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala
- core/src/main/scala/org/apache/spark/rdd/NewHadoopRDD.scala 7 additions, 1 deletioncore/src/main/scala/org/apache/spark/rdd/NewHadoopRDD.scala
- core/src/test/scala/org/apache/spark/metrics/InputOutputMetricsSuite.scala 30 additions, 1 deletion...la/org/apache/spark/metrics/InputOutputMetricsSuite.scala
Please register or sign in to comment