Uh oh!
There was an error while loading. Please reload this page.
[SPARK-4826] Fix generation of temp file names in WAL tests - #3704
[SPARK-4826] Fix generation of temp file names in WAL tests#3704JoshRosen wants to merge 5 commits into
Conversation
SparkQA
commented
Dec 15, 2014
Test build #24464 has started for PR 3704 at commit
|
There was a problem hiding this comment.
This might look race prone (deleting a file and hoping that someone else won't come along and write it in the meantime), but it should be safe because:
- Different Jenkins builds will have different temp directories (
dir). - Within a JVM, multiple calls to
createTempFilewill never return the same pathname (see Javadoc).
harishreedharan
commented
Dec 15, 2014
This looks good to me, though the approach does not make it obvious why this approach was chosen (of course you can figure out in this context, but imagine reading this code a year later). I think the other two are slightly simpler approaches by ensuring unique names on file creation. |
vanzin
commented
Dec 15, 2014
I buy your explanation, given the javadoc, so this LGTM. But I think a cleaner approach that doesn't require reasoning like that to convince people would be to just use a different temp dir per test (i.e. use |
JoshRosen
commented
Dec 15, 2014
The root issue is that this code is trying to return a unique file system path that meets two conditions:
I think this was the intent expressed by the original |
vanzin
commented
Dec 15, 2014
I assume that frameworks handle that automatically (e.g. by having multiple instances of the test class), otherwise you could never parallelize tests that use "before" initializers. I'm pretty sure that works as intented at least with JUnit, but not super familiar with scalatest internals. |
JoshRosen
commented
Dec 15, 2014
Alright, I've simplified things to move the temp. dir creation to |
harishreedharan
commented
Dec 15, 2014
+1. The latest changes look good. |
There was a problem hiding this comment.
This doesn't work if the dir is not empty. You could use Utils.createTempDir() and, optionally, Utils.deleteRecursively() (since createTempDir already takes care of that for you).
There was a problem hiding this comment.
Good catch; I've fixed this.
SparkQA
commented
Dec 15, 2014
Test build #24466 has started for PR 3704 at commit
|
SparkQA
commented
Dec 15, 2014
Test build #24467 has started for PR 3704 at commit
|
SparkQA
commented
Dec 15, 2014
Test build #24464 has finished for PR 3704 at commit
|
AmplabJenkins
commented
Dec 15, 2014
Test PASSed. |
SparkQA
commented
Dec 15, 2014
Test build #24466 has finished for PR 3704 at commit
|
AmplabJenkins
commented
Dec 15, 2014
Test PASSed. |
SparkQA
commented
Dec 15, 2014
Test build #24467 has finished for PR 3704 at commit
|
AmplabJenkins
commented
Dec 15, 2014
Test PASSed. |
srowen
commented
Dec 15, 2014
Looks like a robust approach to me. |
JoshRosen
commented
Dec 15, 2014
Alright, I'm going to merge this. Thanks for looking this over! |
This PR should fix SPARK-4826, an issue where a bug in how we generate temp. file names was causing spurious test failures in the write ahead log suites. Closes#3695. Closes#3701. Author: Josh Rosen <joshrosen@databricks.com> Closes#3704 from JoshRosen/SPARK-4826 and squashes the following commits: f2307f5 [Josh Rosen] Use Spark Utils class for directory creation/deletion a693ddb [Josh Rosen] remove unused Random import b275e41 [Josh Rosen] Move creation of temp. dir to beforeEach/afterEach. 9362919 [Josh Rosen] [SPARK-4826] Fix bug in generation of temp file names. in WAL suites. 86c1944 [Josh Rosen] Revert "HOTFIX: Disabling failing block manager test" (cherry picked from commit f6b8591) Signed-off-by: Josh Rosen <joshrosen@databricks.com>
This PR should fix SPARK-4826, an issue where a bug in how we generate temp. file names was causing spurious test failures in the write ahead log suites.
Closes#3695.
Closes#3701.