-
Notifications
You must be signed in to change notification settings - Fork 355
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
[CELEBORN-1644] Optimize handle merged data on stage end #2806
Open
FMX
wants to merge
3
commits into
apache:main
Choose a base branch
from
FMX:b1644
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+50
−17
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,7 +217,8 @@ abstract class CommitHandler( | |
shuffleId: Int, | ||
shuffleCommittedInfo: ShuffleCommittedInfo, | ||
params: ArrayBuffer[CommitFilesParam], | ||
commitFilesFailedWorkers: ShuffleFailedWorkers): Unit = { | ||
commitFilesFailedWorkers: ShuffleFailedWorkers, | ||
isStageEnd: Boolean = false): Unit = { | ||
|
||
def retryCommitFiles(status: CommitFutureWithStatus, currentTime: Long): Unit = { | ||
status.retriedTimes = status.retriedTimes + 1 | ||
|
@@ -290,7 +291,8 @@ abstract class CommitHandler( | |
param.replicaIds, | ||
getMapperAttempts(shuffleId), | ||
commitEpoch.incrementAndGet(), | ||
mockCommitFilesFailure) | ||
mockCommitFilesFailure, | ||
isStageEnd) | ||
val future = commitFiles(param.worker, msg) | ||
|
||
futures.add(CommitFutureWithStatus(future, msg, param.worker, 1, startTime)) | ||
|
@@ -311,13 +313,14 @@ abstract class CommitHandler( | |
while (iter.hasNext) { | ||
val status = iter.next() | ||
val worker = status.workerInfo | ||
val workerAddr = worker.readableAddress() | ||
if (status.future.isCompleted) { | ||
status.future.value.get match { | ||
case scala.util.Success(res) => | ||
res.status match { | ||
case StatusCode.SUCCESS | StatusCode.PARTIAL_SUCCESS | StatusCode.SHUFFLE_NOT_REGISTERED | StatusCode.REQUEST_FAILED | StatusCode.WORKER_EXCLUDED => | ||
logInfo(s"Request commitFiles return ${res.status} for " + | ||
s"${Utils.makeShuffleKey(appUniqueId, shuffleId)}") | ||
s"${Utils.makeShuffleKey(appUniqueId, shuffleId)} from ${workerAddr}") | ||
if (res.status != StatusCode.SUCCESS && res.status != StatusCode.WORKER_EXCLUDED) { | ||
commitFilesFailedWorkers.put(worker, (res.status, System.currentTimeMillis())) | ||
} | ||
|
@@ -326,12 +329,12 @@ abstract class CommitHandler( | |
case StatusCode.COMMIT_FILES_MOCK_FAILURE => | ||
if (status.retriedTimes < maxRetries) { | ||
logError(s"Request commitFiles return ${res.status} for " + | ||
s"${Utils.makeShuffleKey(appUniqueId, shuffleId)} for ${status.retriedTimes}/$maxRetries, will retry") | ||
s"${Utils.makeShuffleKey(appUniqueId, shuffleId)} from ${workerAddr} for ${status.retriedTimes}/$maxRetries, will retry") | ||
retryCommitFiles(status, currentTime) | ||
} else { | ||
logError( | ||
s"Request commitFiles return ${StatusCode.COMMIT_FILES_MOCK_FAILURE} for " + | ||
s"${Utils.makeShuffleKey(appUniqueId, shuffleId)} for ${status.retriedTimes}/$maxRetries, will not retry") | ||
s"${Utils.makeShuffleKey(appUniqueId, shuffleId)} from ${workerAddr} for ${status.retriedTimes}/$maxRetries, will not retry") | ||
val res = createFailResponse(status) | ||
processResponse(res, status.workerInfo) | ||
iter.remove() | ||
|
@@ -439,7 +442,7 @@ abstract class CommitHandler( | |
replicaIds) | ||
} | ||
|
||
doParallelCommitFiles(shuffleId, shuffleCommittedInfo, params, commitFilesFailedWorkers) | ||
doParallelCommitFiles(shuffleId, shuffleCommittedInfo, params, commitFilesFailedWorkers, true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only the ReducePartitionCommitHandler can set stageEnd to true when call handleFinalCommitFiles method. |
||
|
||
logInfo(s"Shuffle $shuffleId " + | ||
s"commit files complete. File count ${shuffleCommittedInfo.currentShuffleFileCount.sum()} " + | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ class PushDataHandler(val workerSource: WorkerSource) extends BaseMessageHandler | |
|
||
private var partitionLocationInfo: WorkerPartitionLocationInfo = _ | ||
private var shuffleMapperAttempts: ConcurrentHashMap[String, AtomicIntegerArray] = _ | ||
private var presumptiveEndedShuffles: ConcurrentHashMap.KeySetView[String, java.lang.Boolean] = _ | ||
private var shufflePartitionType: ConcurrentHashMap[String, PartitionType] = _ | ||
private var shufflePushDataTimeout: ConcurrentHashMap[String, Long] = _ | ||
private var replicateThreadPool: ThreadPoolExecutor = _ | ||
|
@@ -79,6 +80,7 @@ class PushDataHandler(val workerSource: WorkerSource) extends BaseMessageHandler | |
replicateThreadPool = worker.replicateThreadPool | ||
unavailablePeers = worker.unavailablePeers | ||
replicateClientFactory = worker.replicateClientFactory | ||
presumptiveEndedShuffles = worker.presumptiveEndedShuffles | ||
registered = Some(worker.registered) | ||
workerInfo = worker.workerInfo | ||
diskReserveSize = worker.conf.workerDiskReserveSize | ||
|
@@ -475,7 +477,13 @@ class PushDataHandler(val workerSource: WorkerSource) extends BaseMessageHandler | |
// A shuffle can trigger multiple CommitFiles requests, for reasons like: HARD_SPLIT happens, StageEnd. | ||
// If MapperAttempts but the value is -1 for the mapId(-1 means the map has not yet finished), | ||
// it's probably because commitFiles for HARD_SPLIT happens. | ||
if (shuffleMapperAttempts.containsKey(shuffleKey)) { | ||
if (presumptiveEndedShuffles.contains(shuffleKey)) { | ||
logDebug(s"Receive push merged data from speculative " + | ||
s"task(shuffle $shuffleKey, map $mapId, attempt $attemptId), " + | ||
s"but this stage is ended.") | ||
callbackWithTimer.onSuccess( | ||
ByteBuffer.wrap(Array[Byte](StatusCode.STAGE_ENDED.getValue))) | ||
} else if (shuffleMapperAttempts.containsKey(shuffleKey)) { | ||
if (-1 != shuffleMapperAttempts.get(shuffleKey).get(mapId)) { | ||
logDebug(s"Receive push merged data from speculative " + | ||
s"task(shuffle $shuffleKey, map $mapId, attempt $attemptId), " + | ||
|
@@ -490,6 +498,7 @@ class PushDataHandler(val workerSource: WorkerSource) extends BaseMessageHandler | |
ByteBuffer.wrap(Array[Byte](StatusCode.HARD_SPLIT.getValue))) | ||
} | ||
} else { | ||
// This means that this stage is ended and invoked commit files by stage end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should remove this line~ |
||
if (storageManager.shuffleKeySet().contains(shuffleKey)) { | ||
// If there is no shuffle key in shuffleMapperAttempts but there is shuffle key | ||
// in StorageManager. This partition should be HARD_SPLIT partition and | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there any compatibility problem between old client version and new server version, which situation is that server returns
STAGE_ENDED
but client only handlesMAP_ENDED
?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.
STAGE_ENDED will be returned if the field stageEnd is true. So old servers won't return STAGE_ENDED.