You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/06/06 10:21:07 UTC
[GitHub] [spark] boneanxs opened a new pull request, #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
boneanxs opened a new pull request, #36775:
URL: https://github.com/apache/spark/pull/36775
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'core/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
Should throw the error if caused by Filesystem closed when we enable ignoreCorruptFiles
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
If we set ignoreCorruptFiles to true, when some executors are preempted, the driver will stop these executors, which might cause the filesystem closed exception. As ignoreCorruptFIles is enabled, some tasks will finish directly and return the results to the driver, and the driver will not reschedule these tasks if get the result, this could cause data loss.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
No
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] github-actions[bot] commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1308019781
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.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] boneanxs closed pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
boneanxs closed pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
URL: https://github.com/apache/spark/pull/36775
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] JoshRosen commented on a diff in pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
JoshRosen commented on code in PR #36775:
URL: https://github.com/apache/spark/pull/36775#discussion_r925281565
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileScanRDD.scala:
##########
@@ -215,6 +215,17 @@ class FileScanRDD(
}
}
+ private def isDFSClientClosedException(e: IOException): Boolean = {
+ e.getStackTrace.foreach { ste: StackTraceElement =>
+ if (ste != null && ste.getMethodName != null && ste.getClassName != null
+ && ste.getClassName.contains("DFSClient")
+ && ste.getMethodName.contains("checkOpen")) {
+ true
+ }
+ }
+ false
+ }
Review Comment:
I don't think this use of `foreach` is correct: `foreach` returns `Unit`, so this `isDFSClientClosedException` always returns `false` via the statement below the `foreach`. Instead, I think you should use `exists`:
```suggestion
private def isDFSClientClosedException(e: IOException): Boolean = {
e.getStackTrace.exists { ste: StackTraceElement =>
(ste != null
&& ste.getMethodName != null
&& ste.getClassName != null
&& ste.getClassName.contains("DFSClient")
&& ste.getMethodName == "checkOpen")
}
}
```
Here's a test of this in a scala REPL:
```scala
scala> import java.io._
import java.io._
scala> import java.lang._
import java.lang._
scala> class DFSClient { def checkOpen(): Unit = { throw new IOException("e") } }
defined class DFSClient
scala> def isDFSClientClosedException(e: IOException): Boolean = {
| e.getStackTrace.exists { ste: StackTraceElement =>
| (ste != null
| && ste.getMethodName != null
| && ste.getClassName != null
| && ste.getClassName.contains("DFSClient")
| && ste.getMethodName == "checkOpen")
| }
| }
isDFSClientClosedException: (e: java.io.IOException)Boolean
scala> isDFSClientClosedException(scala.util.Try((new DFSClient).checkOpen()).failed.get.asInstanceOf[IOException])
res0: Boolean = true
scala> isDFSClientClosedException(new IOException("e"))
res1: Boolean = false
```
In this new code, I've kept `.contains` for the class name check but switched to `==` for checking the method name. I think it's a good idea to be more permissive for class names so that we can handle shading, but I don't expect that method names would be renamed so I think it's fine to keep the method name as an equality check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on code in PR #36775:
URL: https://github.com/apache/spark/pull/36775#discussion_r890038485
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileScanRDD.scala:
##########
@@ -253,6 +253,9 @@ class FileScanRDD(
// Throw FileNotFoundException even if `ignoreCorruptFiles` is true
case e: FileNotFoundException if !ignoreMissingFiles => throw e
case e @ (_: RuntimeException | _: IOException) if ignoreCorruptFiles =>
+ if (e.getMessage.contains("Filesystem closed")) {
Review Comment:
Error message checking is too flaky to rely on ..
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] boneanxs commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
boneanxs commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1193721772
Seems failure not relate to this pr
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1147644959
Can one of the admins verify this patch?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] github-actions[bot] closed pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
URL: https://github.com/apache/spark/pull/36775
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wayneguow commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
wayneguow commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1198234993
IMO, it's better that users can configure what exceptions can ignore corrupt files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] JoshRosen commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
JoshRosen commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1148136217
Does checking for filesystem closed exceptions completely fix this issue or are we vulnerable to race conditions? Skimming through the [Hadoop DFSClient code](https://github.com/apache/hadoop/blame/2dfa928a201560bc739ff5e4fe29f8bb19188927/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java), it looks like it only throws `Filesystem closed` IOExceptions from a `checkOpen()` call, but what happens if the FS is closed while a thread has proceeded past `checkOpen()` and is in the middle of some other operation? In that case we might get a different IOException but would presumably want to treat it the same way (because it is a side-effect of another task being interrupted rather than a side-effect of a corrupt file).
It seems like the core problem is that we have a really overly-broad `catch` block which catches corrupt files but also catches many other potential things. For example, let's say that we get an IOException caused by a transient network connectivity issue to external storage: this doesn't meet the intuitive definition of "corrupt file" but would still get caught in the dragnet of the current exception handler.
The current code seems biased towards identifying "false positive" instances of corruption (which can lead to correctness issues). If instead we wanted to bias towards false negatives (i.e. mis-identifying true corruption as a transient crash, therefore failing a user's job) then maybe we could have the code in `readFunc` wrap and re-throw exceptions in some sort of `CorruptFileException` wrapper and then modify the `catch` here to only ignore that new exception. This would require changes in a number of data sources, though. The FileScanRDD code might simply lack the necessary information to be able to identify true corruption cases, so pushing part of that decision one layer lower might make sense.
I think that could be a breaking change for certain users, though, so we'd need to treat it as a user-facing change and document it appropriately (and might need add escape hatch flags in case users need to revert back to the old (arguably buggy) behavior).
----
I'm not sure what's the right course of action here. I just wanted to flag that there's a potentially broader issue here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] boneanxs commented on a diff in pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
boneanxs commented on code in PR #36775:
URL: https://github.com/apache/spark/pull/36775#discussion_r927273061
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileScanRDD.scala:
##########
@@ -215,6 +215,17 @@ class FileScanRDD(
}
}
+ private def isDFSClientClosedException(e: IOException): Boolean = {
+ e.getStackTrace.foreach { ste: StackTraceElement =>
+ if (ste != null && ste.getMethodName != null && ste.getClassName != null
+ && ste.getClassName.contains("DFSClient")
+ && ste.getMethodName.contains("checkOpen")) {
+ true
+ }
+ }
+ false
+ }
Review Comment:
Oops.. Thanks for pointing out... sorry for the silly mistakes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] boneanxs commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
boneanxs commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1180002372
ping @JoshRosen fix the error handling codes, can take a review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] wayneguow commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
wayneguow commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1149679199
+1 to @JoshRosen 's issue.
We also encountered this problem in our scenario for ETL. When reading abnormally from filesystem(such as read timeout exception, which may succeeded with retrying), rather than the file corrupted, it cause data loss. We had to give up to use this conf finally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] JoshRosen commented on a diff in pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
JoshRosen commented on code in PR #36775:
URL: https://github.com/apache/spark/pull/36775#discussion_r925281565
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileScanRDD.scala:
##########
@@ -215,6 +215,17 @@ class FileScanRDD(
}
}
+ private def isDFSClientClosedException(e: IOException): Boolean = {
+ e.getStackTrace.foreach { ste: StackTraceElement =>
+ if (ste != null && ste.getMethodName != null && ste.getClassName != null
+ && ste.getClassName.contains("DFSClient")
+ && ste.getMethodName.contains("checkOpen")) {
+ true
+ }
+ }
+ false
+ }
Review Comment:
I don't think this use of `foreach` is correct: `foreach` returns Unit`, so this `isDFSClientClosedException` always returns `false` via the statement below the `foreach`. Instead, I think you should use `exists`:
```suggestion
private def isDFSClientClosedException(e: IOException): Boolean = {
e.getStackTrace.exists { ste: StackTraceElement =>
(ste != null
&& ste.getMethodName != null
&& ste.getClassName != null
&& ste.getClassName.contains("DFSClient")
&& ste.getMethodName == "checkOpen")
}
}
```
Here's a test of this in a scala REPL:
```scala
scala> import java.io._
import java.io._
scala> import java.lang._
import java.lang._
scala> class DFSClient { def checkOpen(): Unit = { throw new IOException("e") } }
defined class DFSClient
scala> def isDFSClientClosedException(e: IOException): Boolean = {
| e.getStackTrace.exists { ste: StackTraceElement =>
| (ste != null
| && ste.getMethodName != null
| && ste.getClassName != null
| && ste.getClassName.contains("DFSClient")
| && ste.getMethodName == "checkOpen")
| }
| }
isDFSClientClosedException: (e: java.io.IOException)Boolean
scala> isDFSClientClosedException(scala.util.Try((new DFSClient).checkOpen()).failed.get.asInstanceOf[IOException])
res0: Boolean = true
scala> isDFSClientClosedException(new IOException("e"))
res1: Boolean = false
```
In this new code, I've kept `.contains` for the class name check but switched to `==` for checking the method name. I think it's a good idea to be more permissive for class names so that we can handle shading, but I don't expect that method names would be renamed so I think it's fine to keep the method name as an equality check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] boneanxs commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
boneanxs commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1186706415
Gentle ping @JoshRosen @mridulm @HyukjinKwon @wayneguow ...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] JoshRosen commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
JoshRosen commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1171817134
> Thanks for you guys reviews, I think @JoshRosen's way is more appropriate, we better change the implementation to "false negatives", though it may need more efforts to implement it and it's a breaking change to the users.
>
> Do we need to implement it or change this to identify whether it's an exception from `DFSClient.checkOpen` to make the codes more robust?
Maybe we can tackle the issues separately?
In the long-term I think we should reconsider the overall approach for detecting corrupt files and maybe move towards a "false negatives" design. This would be a breaking change and might require datasource changes, so I think it deserves a separate and broader discussion (maybe on a separate JIRA or on the dev mailing list).
In the short-term, I think it's okay to make an incremental improvement to the current design and fix the specific issue targeted by this PR. Merging the slightly-more-robust-via-checking-exception-source version of the change you proposed here delivers real value to users and solves a real problem even if it doesn't completely solve the larger pre-existing design problem in this feature. Could you update this PR to include the more robust method of error checking and ping us for a final look? Please add a code comment near the modified code which references SPARK-39389 and explains the motivation for the change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] boneanxs commented on pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
boneanxs commented on PR #36775:
URL: https://github.com/apache/spark/pull/36775#issuecomment-1165432681
Thanks for you guys reviews, I think @JoshRosen's way is more appropriate, we better change the implementation to "false negatives", though it may need more efforts to implement it and it's a breaking change to the users.
Do we need to implement it or change this to identify whether it's an exception from `DFSClient.checkOpen` to make the codes more robust?
cc: @mridulm @HyukjinKwon @dongjoon-hyun
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] JoshRosen commented on a diff in pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
JoshRosen commented on code in PR #36775:
URL: https://github.com/apache/spark/pull/36775#discussion_r890727456
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileScanRDD.scala:
##########
@@ -253,6 +253,9 @@ class FileScanRDD(
// Throw FileNotFoundException even if `ignoreCorruptFiles` is true
case e: FileNotFoundException if !ignoreMissingFiles => throw e
case e @ (_: RuntimeException | _: IOException) if ignoreCorruptFiles =>
+ if (e.getMessage.contains("Filesystem closed")) {
Review Comment:
I agree that checking exception messages isn't the most robust solution.
Thinking about the risks of exception text matching, I see two potential classes of problems:
1. _Genuine_ corruption might just-so-happen to produce an exception that also contains "Filesystem closed", in which case we'd break a user's job.
2. The third-party FileSystem implementation could change its error messages, which would cause this PR's fix to stop working.
Given the fact that the current code treats essentially _all_ exceptions as corruption, a potentially-brittle solution which ignores issue (2) and solves issue (1) _might_ not be a terrible trade-off.
For example, let's say that we're only trying to put a bandaid on the `DFSClient` closed filesystem issue and aren't trying to solve the broader class of issues I mentioned in my other comment. In that case, we might be able to write some sort of helper function which would walk through the exception's stack frames and look for a frame that calls `DFSClient.checkOpen`. Given that Hadoop hasn't changed that method in 11+ years, it seems pretty unlikely that they would break it in a future release.
Then, we could do something like
```
case e: IOException if isDFSClientClosedException(e) => throw e
```
before the current corruption ignoring case.
This would have no chance of mis-identifying corruption as non-corruption. It's potentially brittle and doesn't necessarily solve all cases, but it could greatly reduce the likelihood of data loss (even though it doesn't completely eliminate it). Depending on the context of use, maybe that's an okay short-term band-aid?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #36775:
URL: https://github.com/apache/spark/pull/36775#discussion_r890600656
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileScanRDD.scala:
##########
@@ -253,6 +253,9 @@ class FileScanRDD(
// Throw FileNotFoundException even if `ignoreCorruptFiles` is true
case e: FileNotFoundException if !ignoreMissingFiles => throw e
case e @ (_: RuntimeException | _: IOException) if ignoreCorruptFiles =>
+ if (e.getMessage.contains("Filesystem closed")) {
Review Comment:
+1 for @HyukjinKwon 's comment. We need a more robust way to detect, @boneanxs .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] mridulm commented on a diff in pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
mridulm commented on code in PR #36775:
URL: https://github.com/apache/spark/pull/36775#discussion_r890765675
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileScanRDD.scala:
##########
@@ -253,6 +253,9 @@ class FileScanRDD(
// Throw FileNotFoundException even if `ignoreCorruptFiles` is true
case e: FileNotFoundException if !ignoreMissingFiles => throw e
case e @ (_: RuntimeException | _: IOException) if ignoreCorruptFiles =>
+ if (e.getMessage.contains("Filesystem closed")) {
Review Comment:
+1 to @JoshRosen's proposal here.
Given that hadoop is throwing a generic exception here, and given the lack of principled alternatives available - walking the stack allows us to reasonably detect if the cause is due to hadoop filesystem being closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] mridulm commented on a diff in pull request #36775: [SPARK-39389]Filesystem closed should not be considered as corrupt files
Posted by GitBox <gi...@apache.org>.
mridulm commented on code in PR #36775:
URL: https://github.com/apache/spark/pull/36775#discussion_r890765675
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileScanRDD.scala:
##########
@@ -253,6 +253,9 @@ class FileScanRDD(
// Throw FileNotFoundException even if `ignoreCorruptFiles` is true
case e: FileNotFoundException if !ignoreMissingFiles => throw e
case e @ (_: RuntimeException | _: IOException) if ignoreCorruptFiles =>
+ if (e.getMessage.contains("Filesystem closed")) {
Review Comment:
+1 to @JoshRosen's proposal.
Given that hadoop is throwing a generic exception here, and given the lack of principled alternatives available - walking the stack allows us to reasonably detect if the cause is due to hadoop filesystem being closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org