-
Notifications
You must be signed in to change notification settings - Fork 418
[CELEBORN-2252] Skip writing data from other attempts #3590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) = | ||
| 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) | ||
|
||
| 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 => | ||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.