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 @@ -1142,6 +1142,12 @@ final class ShuffleBlockFetcherIterator(
s"diagnosis is skipped due to lack of shuffle checksum support for push-based shuffle."
logWarning(diagnosisResponse)
diagnosisResponse
case shuffleBlockBatch: ShuffleBlockBatchId =>
val diagnosisResponse = s"BlockBatch $shuffleBlockBatch is corrupted " +
s"but corruption diagnosis is skipped due to lack of shuffle checksum support for " +
s"ShuffleBlockBatchId"
logWarning(diagnosisResponse)
diagnosisResponse
case unexpected: BlockId =>
throw SparkException.internalError(
s"Unexpected type of BlockId, $unexpected", category = "STORAGE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1941,4 +1941,31 @@ class ShuffleBlockFetcherIteratorSuite extends SparkFunSuite with PrivateMethodT

assert(err2.getMessage.contains("corrupt at reset"))
}

test("SPARK-43242: Fix throw 'Unexpected type of BlockId' in shuffle corruption diagnose") {
val remoteBmId = BlockManagerId("test-client-1", "test-client-1", 2)
val blocks = Map[BlockId, ManagedBuffer](
ShuffleBlockBatchId(0, 0, 0, 3) -> createMockManagedBuffer())
answerFetchBlocks { invocation =>
val listener = invocation.getArgument[BlockFetchingListener](4)
listener.onBlockFetchSuccess(ShuffleBlockBatchId(0, 0, 0, 3).toString, mockCorruptBuffer())
}

val logAppender = new LogAppender("diagnose corruption")
withLogAppender(logAppender) {
val iterator = createShuffleBlockIteratorWithDefaults(
Map(remoteBmId -> toBlockList(blocks.keys, 1L, 0)),
streamWrapperLimitSize = Some(100)
)
intercept[FetchFailedException](iterator.next())
verify(transfer, times(2))
.fetchBlocks(any(), any(), any(), any(), any(), any())
assert(logAppender.loggingEvents.count(
_.getMessage.getFormattedMessage.contains("Start corruption diagnosis")) === 1)
assert(logAppender.loggingEvents.exists(
_.getMessage.getFormattedMessage.contains("shuffle_0_0_0_3 is corrupted " +
"but corruption diagnosis is skipped due to lack of " +
"shuffle checksum support for ShuffleBlockBatchId")))
}
}
}