-
- Downloads
SPARK-3811 [CORE] More robust / standard Utils.deleteRecursively, Utils.createTempDir
I noticed a few issues with how temp directories are created and deleted: *Minor* * Guava's `Files.createTempDir()` plus `File.deleteOnExit()` is used in many tests to make a temp dir, but `Utils.createTempDir()` seems to be the standard Spark mechanism * Call to `File.deleteOnExit()` could be pushed into `Utils.createTempDir()` as well, along with this replacement * _I messed up the message in an exception in `Utils` in SPARK-3794; fixed here_ *Bit Less Minor* * `Utils.deleteRecursively()` fails immediately if any `IOException` occurs, instead of trying to delete any remaining files and subdirectories. I've observed this leave temp dirs around. I suggest changing it to continue in the face of an exception and throw one of the possibly several exceptions that occur at the end. * `Utils.createTempDir()` will add a JVM shutdown hook every time the method is called. Even if the subdir is the parent of another parent dir, since this check is inside the hook. However `Utils` manages a set of all dirs to delete on shutdown already, called `shutdownDeletePaths`. A single hook can be registered to delete all of these on exit. This is how Tachyon temp paths are cleaned up in `TachyonBlockManager`. I noticed a few other things that might be changed but wanted to ask first: * Shouldn't the set of dirs to delete be `File`, not just `String` paths? * `Utils` manages the set of `TachyonFile` that have been registered for deletion, but the shutdown hook is managed in `TachyonBlockManager`. Should this logic not live together, and not in `Utils`? it's more specific to Tachyon, and looks a slight bit odd to import in such a generic place. Author: Sean Owen <sowen@cloudera.com> Closes #2670 from srowen/SPARK-3811 and squashes the following commits: 071ae60 [Sean Owen] Update per @vanzin's review da0146d [Sean Owen] Make Utils.deleteRecursively try to delete all paths even when an exception occurs; use one shutdown hook instead of one per method call to delete temp dirs 3a0faa4 [Sean Owen] Standardize on Utils.createTempDir instead of Files.createTempDir
Showing
- core/src/main/scala/org/apache/spark/TestUtils.scala 3 additions, 2 deletionscore/src/main/scala/org/apache/spark/TestUtils.scala
- core/src/main/scala/org/apache/spark/util/Utils.scala 38 additions, 17 deletionscore/src/main/scala/org/apache/spark/util/Utils.scala
- core/src/test/scala/org/apache/spark/FileServerSuite.scala 1 addition, 3 deletionscore/src/test/scala/org/apache/spark/FileServerSuite.scala
- core/src/test/scala/org/apache/spark/FileSuite.scala 1 addition, 3 deletionscore/src/test/scala/org/apache/spark/FileSuite.scala
- core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala 1 addition, 2 deletions...test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala
- core/src/test/scala/org/apache/spark/input/WholeTextFileRecordReaderSuite.scala 1 addition, 5 deletions...g/apache/spark/input/WholeTextFileRecordReaderSuite.scala
- core/src/test/scala/org/apache/spark/rdd/PairRDDFunctionsSuite.scala 12 additions, 9 deletions...st/scala/org/apache/spark/rdd/PairRDDFunctionsSuite.scala
- core/src/test/scala/org/apache/spark/scheduler/EventLoggingListenerSuite.scala 1 addition, 3 deletions...rg/apache/spark/scheduler/EventLoggingListenerSuite.scala
- core/src/test/scala/org/apache/spark/scheduler/ReplayListenerSuite.scala 1 addition, 3 deletions...cala/org/apache/spark/scheduler/ReplayListenerSuite.scala
- core/src/test/scala/org/apache/spark/storage/DiskBlockManagerSuite.scala 3 additions, 14 deletions...cala/org/apache/spark/storage/DiskBlockManagerSuite.scala
- core/src/test/scala/org/apache/spark/util/FileLoggerSuite.scala 1 addition, 2 deletions...rc/test/scala/org/apache/spark/util/FileLoggerSuite.scala
- core/src/test/scala/org/apache/spark/util/UtilsSuite.scala 26 additions, 2 deletionscore/src/test/scala/org/apache/spark/util/UtilsSuite.scala
- mllib/src/test/scala/org/apache/spark/mllib/util/MLUtilsSuite.scala 4 additions, 5 deletions...test/scala/org/apache/spark/mllib/util/MLUtilsSuite.scala
- repl/src/test/scala/org/apache/spark/repl/ExecutorClassLoaderSuite.scala 2 additions, 6 deletions...cala/org/apache/spark/repl/ExecutorClassLoaderSuite.scala
- repl/src/test/scala/org/apache/spark/repl/ReplSuite.scala 1 addition, 3 deletionsrepl/src/test/scala/org/apache/spark/repl/ReplSuite.scala
- streaming/src/test/scala/org/apache/spark/streaming/CheckpointSuite.scala 1 addition, 2 deletions...st/scala/org/apache/spark/streaming/CheckpointSuite.scala
- streaming/src/test/scala/org/apache/spark/streaming/InputStreamsSuite.scala 1 addition, 2 deletions.../scala/org/apache/spark/streaming/InputStreamsSuite.scala
- streaming/src/test/scala/org/apache/spark/streaming/MasterFailureTest.scala 1 addition, 2 deletions.../scala/org/apache/spark/streaming/MasterFailureTest.scala
- streaming/src/test/scala/org/apache/spark/streaming/TestSuiteBase.scala 2 additions, 3 deletions...test/scala/org/apache/spark/streaming/TestSuiteBase.scala
- yarn/common/src/test/scala/org/apache/spark/deploy/yarn/ClientBaseSuite.scala 1 addition, 4 deletions.../scala/org/apache/spark/deploy/yarn/ClientBaseSuite.scala
Loading
Please register or sign in to comment