Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ private[state] class HDFSBackedStateStoreProvider extends StateStoreProvider wit
} catch {
case _: FileNotFoundException =>
None
case e: IOException =>
logWarning(s"Corrupted snapshot file for version $version of $this: $fileToRead", e)
fs.delete(fileToRead, true)
None
} finally {
if (input != null) input.close()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,10 @@ class StateStoreSuite extends StateStoreSuiteBase[HDFSBackedStateStoreProvider]
val snapshotVersion = (0 to 10).find( version =>
fileExists(provider, version, isSnapshot = true)).getOrElse(fail("snapshot file not found"))

// Corrupt snapshot file and verify that it throws error
// Corrupt snapshot file and verify that it doesn't throw an error
assert(getData(provider, snapshotVersion) === Set("a" -> snapshotVersion))
corruptFile(provider, snapshotVersion, isSnapshot = true)
intercept[Exception] {
getData(provider, snapshotVersion)
}
getData(provider, snapshotVersion)

// Corrupt delta file and verify that it throws error
assert(getData(provider, snapshotVersion - 1) === Set("a" -> (snapshotVersion - 1)))
Expand Down