-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-27194][SPARK-29302][SQL] For dynamic partition overwrite operation, fix speculation task conflict issue and FileAlreadyExistsException issue #26339
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
Conversation
|
cc @cloud-fan @advancedxy @viirya @wangyum |
|
gentle ping @cloud-fan @advancedxy @viirya |
|
gentle ping @cloud-fan @advancedxy @viirya Could you help take a look? Thanks in advance! |
|
Jenkins, okay to test. |
|
retest this please. |
core/src/main/scala/org/apache/spark/internal/io/HadoopMapReduceCommitProtocol.scala
Outdated
Show resolved
Hide resolved
|
ok to test |
|
Test build #115200 has finished for PR 26339 at commit
|
286a87f to
4c18493
Compare
|
Test build #115221 has finished for PR 26339 at commit
|
|
@dongjoon-hyun test passed. Could you help take a look? thanks in advance! |
|
gentle ping @dongjoon-hyun @dbtsai @viirya |
|
@turboFei do we have test cases to capture the changes. |
I'll try my best to think how to add UT. |
| val fileName = stagingTaskFile.getName | ||
| val taskPartitionPath = getPartitionPath(stagingTaskFile) | ||
| val destFile = new Path(new Path(stagingDir, taskPartitionPath), fileName) | ||
| fs.rename(stagingTaskFile, destFile) |
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.
fs.rename returns boolean in specific cases , please handle the same.
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.
fixed
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
|
Can we have a test case for this PR? |
|
ok to test |
|
Test build #120566 has finished for PR 26339 at commit
|
|
@dongjoon-hyun @turboFei Is this PR still being worked on? We are having similar issues in our platform for a while, it would be great if we can get this fixed soon. |
|
I will follow it. But I am confused that how to add an UT. |
79d9443 to
9c9f39d
Compare
| dir.map { d => | ||
| new Path(new Path(stagingDir, d), filename).toString | ||
| if (dynamicPartitionOverwrite) { | ||
| val tempFile = new Path(dynamicStagingTaskPath(dir.get, taskContext), filename) |
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: dir.get -> d
|
ping @cloud-fan I think the solution given in this PR could work for the issue. |
|
Test build #122368 has finished for PR 26339 at commit
|
|
retest this please |
|
Test build #122382 has finished for PR 26339 at commit
|
|
Test build #122437 has finished for PR 26339 at commit
|
|
Test build #122438 has finished for PR 26339 at commit
|
|
@jerryshao @cloud-fan could you help review this pr? It can help resolve a critical issue. thanks in advance. |
|
also cc @jiangxb1987 |
|
also cc @vanzin |
|
i am getting worried now this wont make it into spark 3.0.0 |
|
@koertkuipers you could send your concern to the vote of Spark 3.0 release and see if PMC/committer would consider it as release blocker or not. |
|
@Ngone51 yeah i thought about doing that, but i dont want to slowdown the spark 3 release even more (and this is not a regression i guess?). now i am just hoping someone sees my messages here and reviews this before spark 3.0.0 rc3! |
|
The vote thread now has more eys on than this PR and as you know this PR is somehow overlooked for a while. |
f9ae20f to
de9f206
Compare
…ion overwrite a task would conflict with its speculative task
de9f206 to
717d9a5
Compare
|
Test build #124203 has finished for PR 26339 at commit
|
|
Retest this please |
|
Test build #124343 has finished for PR 26339 at commit
|
|
@dongjoon-hyun @turboFei Is this PR still being worked on? We are having similar issues in our production environment, and I found there are similar PRs try to solve this problem, such as #26090, #26971 |
|
Gentle ping @dongjoon-hyun @dbtsai |
|
close this and will a create a new pr with new solution. thanks |
why close this? did you find a better approach? |
Hi, here is the new patch. |
thank you. curious why you changed direction... if there is anything wrong with approach in this pullreq? we were just about to start testing it at scale that's why i ask. |
In the origin solution, when renaming staging task file to final file. It is tricky that the final files may from different tasks. If the task output for a partition has multi files(or bucket table insert case), the data might be corrupted. So, we need outputCommitCoordinator to help decide which task can commit. In the new solution, we define a new output committer to leverage outputCommitCoordinator(by invoking SparkHadoopMapRedUtil.commitTask) |
What changes were proposed in this pull request?
For dynamic partition overwrite, its working dir is
.spark-staging-{jobId}.Task file name formatted
part-$taskId-$jobId$ext(regardless task attempt Id).Each task writes its output to:
.spark-staging-{jobId}/partitionPath1/taskFileName1.spark-staging-{jobId}/partitionPath2/taskFileName2.spark-staging-{jobId}/partitionPathN/taskFileNameNIf speculation is enabled, there may be several tasks, which have same taskId and different attemptId, write to the same files concurrently.
For distributedFileSystem, it only allow one task to hold the lease to write a file, if two tasks want to write the same file, an exception like
no lease on inodewould be thrown.Even speculation is not enabled, if a task aborted due to Executor OOM, its output would not be cleaned up.
Then a new task launched to write the same file, because parquet disallows overwriting, a
FileAlreadyExistsExceptionwould be thrown, like.It is a critical issue and would cause job failed.
In this PR, we fix this issue with the solution below:
Why are the changes needed?
Without this PR, dynamic partition overwrite operation might fail.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Added UT.