sarutak commented on code in PR #59709:
URL: https://github.com/apache/spark/pull/59709#discussion_r4353392541
##########
core/src/main/scala/org/apache/spark/deploy/master/FileSystemPersistenceEngine.scala:
##########
@@ -63,24 +64,60 @@ private[master] class FileSystemPersistenceEngine(
override def read[T: ClassTag](prefix: String): Seq[T] = {
val files = new File(dir).listFiles().filter(_.getName.startsWith(prefix))
- files.map(deserializeFromFile[T]).toImmutableArraySeq
+ files.flatMap { file =>
+ try {
+ Some(deserializeFromFile[T](file))
+ } catch {
+ case NonFatal(e) =>
+ // Skip an unreadable file, e.g. one left truncated by a crash, so
that it cannot block
+ // recovery. Rename it, instead of deleting it, so that it is kept
for inspection but no
+ // longer matches the app_, driver_ or worker_ prefix.
+ val corrupted = new File(dir, "corrupted_" + file.getName)
+ logWarning(log"Exception while reading persisted file ${MDC(PATH,
file.getPath())}, " +
+ log"renaming it to ${MDC(NEW_PATH, corrupted.getPath())}", e)
+ if (!file.renameTo(corrupted)) {
Review Comment:
Thank you, got it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]