-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up when unregisterShuffle. #31664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up when unregisterShuffle. #31664
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bff7afd
[SPARK-34395][SQL]Clean up unused code for code simplifications.
da47187
Merge remote-tracking branch 'origin/master'
da8facf
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up…
1e9c3b6
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up…
79f9a70
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up…
69467ee
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up…
7319255
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up…
e53ee15
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up…
a86b5ab
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up…
65be2c7
[SPARK-34541][CORE] for test.
cd907bb
[SPARK-34541][CORE] revert
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[SPARK-34541][CORE] Fixed an issue where data could not be cleaned up…
… when unregisterShuffle.
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,29 +139,40 @@ class SortShuffleManagerSuite extends SparkFunSuite with Matchers with LocalSpar | |
| ))) | ||
| } | ||
|
|
||
| test("Data could not be cleaned up when unregisterShuffle") { | ||
| test("Shuffle data can be cleaned up whether spark.shuffle.useOldFetchProtocol=true/false") { | ||
|
||
| withTempDir { tmpDir => | ||
| val conf = new SparkConf(loadDefaults = false) | ||
| conf.set("spark.local.dir", tmpDir.getAbsolutePath) | ||
| sc = new SparkContext("local", "SPARK-34541", conf) | ||
| val rdd = sc.parallelize(1 to 10, 1).map(x => (x, x)) | ||
| // Create a shuffleRdd | ||
| val shuffledRdd = new ShuffledRDD[Int, Int, Int](rdd, new HashPartitioner(4)) | ||
| .setSerializer(new JavaSerializer(conf)) | ||
| def getAllFiles: Set[File] = | ||
| FileUtils.listFiles(tmpDir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE).asScala.toSet | ||
| val filesBeforeShuffle = getAllFiles | ||
| // Force the shuffle to be performed | ||
| shuffledRdd.count() | ||
| // Ensure that the shuffle actually created files that will need to be cleaned up | ||
| val filesCreatedByShuffle = getAllFiles -- filesBeforeShuffle | ||
| filesCreatedByShuffle.map(_.getName) should be | ||
| Set("shuffle_0_0_0.data", "shuffle_0_0_0.index") | ||
| // Check that the cleanup actually removes the files | ||
| sc.env.blockManager.master.removeShuffle(0, blocking = true) | ||
| for (file <- filesCreatedByShuffle) { | ||
| assert (!file.exists(), s"Shuffle file $file was not cleaned up") | ||
| def runJobAndRemoveShuffle(conf: SparkConf, mapId: Long): Unit = { | ||
| sc = new SparkContext("local", "test", conf) | ||
| // For making the taskAttemptId starts from 1. | ||
| sc.parallelize(1 to 10).count() | ||
| val rdd = sc.parallelize(1 to 10, 1).map(x => (x, x)) | ||
| // Create a shuffleRdd | ||
| val shuffledRdd = new ShuffledRDD[Int, Int, Int](rdd, new HashPartitioner(4)) | ||
| .setSerializer(new JavaSerializer(conf)) | ||
| val filesBeforeShuffle = getAllFiles | ||
| // Force the shuffle to be performed | ||
| shuffledRdd.count() | ||
| // Ensure that the shuffle actually created files that will need to be cleaned up | ||
| val filesCreatedByShuffle = getAllFiles -- filesBeforeShuffle | ||
| filesCreatedByShuffle.map(_.getName) should be | ||
| Set("shuffle_0_" + mapId + "_0.data", "shuffle_0_" + mapId + "_0.index") | ||
| // Check that the cleanup actually removes the files | ||
| sc.env.blockManager.master.removeShuffle(0, blocking = true) | ||
| for (file <- filesCreatedByShuffle) { | ||
| assert (!file.exists(), s"Shuffle file $file was not cleaned up") | ||
| } | ||
| } | ||
| val conf = new SparkConf(loadDefaults = false) | ||
| conf.set("spark.local.dir", tmpDir.getAbsolutePath) | ||
| conf.set("spark.shuffle.useOldFetchProtocol", "true") | ||
| runJobAndRemoveShuffle(conf, 0) | ||
| if (sc != null) { | ||
| sc.stop() | ||
| } | ||
| conf.set("spark.shuffle.useOldFetchProtocol", "false") | ||
| runJobAndRemoveShuffle(conf, 1) | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: revert the unrelated change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line-133 is empty line, we add test in
SortShuffleManagerSuitebefore, after #31664 (comment), move the test toShuffleSuite, So i change the empty line together.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the reason, but it's still not a necessary change, especially when there's no other changes in the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,i will revert it.