-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
[SPARK-9899] [SQL] Fixes HadoopFsRelation speculative writes when used together with direct output committer #8191
Conversation
cc @marmbrus |
Test build #40854 has finished for PR 8191 at commit
|
I have some concerns about the way this is implemented in the case of speculation. What happens in the following sequence of events.
Is there no file there now? |
@marmbrus However, in this case, the job should be aborted since both the original task and the speculative task fail, thus we shouldn't assume written data files are intact. |
I meant it gets aborted because the first one completed.
|
@marmbrus Had some offline discussions with @yhuai, and we believe that the real problem we hit in the job behind SPARK-9899 is SPARK-10005 (fixed by #8228). Several known facts:
We suspect things probably happen in the following order:
The hard part is that, we can't ...
Because the very case you mentioned. Since it's equivalent to 1. Because failed speculative tasks may delete properly committed output file written by other successful attempt(s) What makes it worse, consider the following case:
Now correct data is overwritten by corrupted data. The TL;DR is that, S3 + direct output committer + speculation is a REALLY bad combination. Currently I don't see a solution to fix all the cases mentioned above. My suggestion is to deprecate this combination by checking whether speculation is enabled when a direct output committer is used. |
Closing this one since it's not solving the real issue and introduces more problems. |
…ion is on Speculation hates direct output committer, as there are multiple corner cases that may cause data corruption and/or data loss. Please see this [PR comment] [1] for more details. [1]: #8191 (comment) Author: Cheng Lian <lian@databricks.com> Closes #8317 from liancheng/spark-9899/speculation-hates-direct-output-committer.
…ion is on Speculation hates direct output committer, as there are multiple corner cases that may cause data corruption and/or data loss. Please see this [PR comment] [1] for more details. [1]: #8191 (comment) Author: Cheng Lian <lian@databricks.com> Closes #8317 from liancheng/spark-9899/speculation-hates-direct-output-committer. (cherry picked from commit f3ff4c4) Signed-off-by: Michael Armbrust <michael@databricks.com> Conflicts: sql/hive/src/test/scala/org/apache/spark/sql/sources/hadoopFsRelationSuites.scala
…lation enabled This is a follow-up of #8317. When speculation is enabled, there may be multiply tasks writing to the same path. Generally it's OK as we will write to a temporary directory first and only one task can commit the temporary directory to target path. However, when we use direct output committer, tasks will write data to target path directly without temporary directory. This causes problems like corrupted data. Please see [PR comment](#8191 (comment)) for more details. Unfortunately, we don't have a simple flag to tell if a output committer will write to temporary directory or not, so for safety, we have to disable any customized output committer when `speculation` is true. Author: Wenchen Fan <cloud0fan@outlook.com> Closes #8687 from cloud-fan/direct-committer.
…ion is on Speculation hates direct output committer, as there are multiple corner cases that may cause data corruption and/or data loss. Please see this [PR comment] [1] for more details. [1]: apache/spark#8191 (comment) Author: Cheng Lian <lian@databricks.com> Closes #8317 from liancheng/spark-9899/speculation-hates-direct-output-committer.
…lation enabled This is a follow-up of apache/spark#8317. When speculation is enabled, there may be multiply tasks writing to the same path. Generally it's OK as we will write to a temporary directory first and only one task can commit the temporary directory to target path. However, when we use direct output committer, tasks will write data to target path directly without temporary directory. This causes problems like corrupted data. Please see [PR comment](apache/spark#8191 (comment)) for more details. Unfortunately, we don't have a simple flag to tell if a output committer will write to temporary directory or not, so for safety, we have to disable any customized output committer when `speculation` is true. Author: Wenchen Fan <cloud0fan@outlook.com> Closes #8687 from cloud-fan/direct-committer.
Hadoop output format classes call
FileSystem.create()
to create output files, and setoverwrite
argument tofalse
. This causes trouble for speculative write tasks when a direct output committer is used, since previous tasks may leave partial output files there.This PR tries to fix this issue by removing the output file when generating output file paths. This is equivalent to creating output files with
overwrite
flag set totrue
.