Skip to content

Commit d06d5ee

Browse files
JoshRosenpwendell
authored andcommitted
[SPARK-5227] [SPARK-5679] Disable FileSystem cache in WholeTextFileRecordReaderSuite
This patch fixes two difficult-to-reproduce Jenkins test failures in InputOutputMetricsSuite (SPARK-5227 and SPARK-5679). The problem was that WholeTextFileRecordReaderSuite modifies the `fs.local.block.size` Hadoop configuration and this change was affecting subsequent test suites due to Hadoop's caching of FileSystem instances (see HADOOP-8490 for more details). The fix implemented here is to disable FileSystem caching in WholeTextFileRecordReaderSuite. Author: Josh Rosen <[email protected]> Closes #4599 from JoshRosen/inputoutputsuite-fix and squashes the following commits: 47dc447 [Josh Rosen] [SPARK-5227] [SPARK-5679] Disable FileSystem cache in WholeTextFileRecordReaderSuite
1 parent 4f4c6d5 commit d06d5ee

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

core/src/test/scala/org/apache/spark/input/WholeTextFileRecordReaderSuite.scala

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import org.scalatest.FunSuite
2828

2929
import org.apache.hadoop.io.Text
3030

31-
import org.apache.spark.SparkContext
31+
import org.apache.spark.{SparkConf, SparkContext}
3232
import org.apache.spark.util.Utils
3333
import org.apache.hadoop.io.compress.{DefaultCodec, CompressionCodecFactory, GzipCodec}
3434

@@ -42,7 +42,15 @@ class WholeTextFileRecordReaderSuite extends FunSuite with BeforeAndAfterAll {
4242
private var factory: CompressionCodecFactory = _
4343

4444
override def beforeAll() {
45-
sc = new SparkContext("local", "test")
45+
// Hadoop's FileSystem caching does not use the Configuration as part of its cache key, which
46+
// can cause Filesystem.get(Configuration) to return a cached instance created with a different
47+
// configuration than the one passed to get() (see HADOOP-8490 for more details). This caused
48+
// hard-to-reproduce test failures, since any suites that were run after this one would inherit
49+
// the new value of "fs.local.block.size" (see SPARK-5227 and SPARK-5679). To work around this,
50+
// we disable FileSystem caching in this suite.
51+
val conf = new SparkConf().set("spark.hadoop.fs.file.impl.disable.cache", "true")
52+
53+
sc = new SparkContext("local", "test", conf)
4654

4755
// Set the block size of local file system to test whether files are split right or not.
4856
sc.hadoopConfiguration.setLong("fs.local.block.size", 32)

0 commit comments

Comments
 (0)