Skip to content
Open
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 @@ -1522,7 +1522,31 @@ class PushDataHandler(val workerSource: WorkerSource) extends BaseMessageHandler
shuffleKey: String,
index: Int): Unit = {
try {
fileWriter.write(body)
val (endedAttempt, toWrite, curMapId, curMapAttempt) =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Celeborn already check that otherMapAttempt is completed before executing writeData to avoid unnecessary writes. Why is it necessary to perform an additional check within writeData to skip data writing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As communicated, I have added logs to prove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, you're correct. Previously, the mapper end check was performed only when the partition location was null during the handling of PushData/PushMergeData. I believe we can enhance this by extending the check to the mapper level, regardless of whether the partition location is null.

if (shuffleMapperAttempts.containsKey(shuffleKey)) {
val (mapId, attemptId) = getMapAttempt(body)
if (mapId >= shuffleMapperAttempts.get(shuffleKey).length()) {
throw new ArrayIndexOutOfBoundsException(s"MapId $mapId of shuffleKey " +
s"$shuffleKey out of array index bounds when accessing shuffleMapperAttempts.")
}
val endedAttemptId = shuffleMapperAttempts.get(shuffleKey).get(mapId)
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential ArrayIndexOutOfBoundsException when accessing shuffleMapperAttempts. If mapId is greater than or equal to the length of the AtomicIntegerArray, this will throw an exception. Consider adding a bounds check before accessing the array, similar to how other parts of the codebase handle this.

Copilot uses AI. Check for mistakes.
val toWriteAttempt =
if (endedAttemptId == -1) {
// Map task has not completed yet, always write
true
} else {
// Only write if the current attempt matches the ended attempt
attemptId == endedAttemptId
}
(endedAttemptId, toWriteAttempt, mapId, attemptId)
} else (-1, true, -1, -1)
if (toWrite) {
fileWriter.write(body)
} else {
fileWriter.decrementPendingWrites()
logInfo(
s"Skipping data from map $curMapId attempt $curMapAttempt for shuffle $shuffleKey " +
s"because map already completed with attempt $endedAttempt") }
result(index) = StatusCode.SUCCESS
} catch {
case e: Throwable =>
Expand Down
Loading