forked from apache/incubator-uniffle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[apache#1579][part-1] fix(spark): Adjust reassigned time to ensure th…
…at all previous data is cleared for stage retry
- Loading branch information
Showing
26 changed files
with
933 additions
and
753 deletions.
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
60 changes: 60 additions & 0 deletions
60
client-spark/common/src/main/java/org/apache/spark/shuffle/RssStageResubmitManager.java
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.shuffle; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import com.google.common.collect.Sets; | ||
|
||
import org.apache.uniffle.common.util.JavaUtils; | ||
|
||
public class RssStageResubmitManager { | ||
/** A list of shuffleServer for Write failures */ | ||
private Set<String> failuresShuffleServerIds; | ||
/** | ||
* Prevent multiple tasks from reporting FetchFailed, resulting in multiple ShuffleServer | ||
* assignments, stageID, Attemptnumber Whether to reassign the combination flag; | ||
*/ | ||
private Map<String, Boolean> serverAssignedInfos; | ||
|
||
public RssStageResubmitManager() { | ||
this.failuresShuffleServerIds = Sets.newConcurrentHashSet(); | ||
this.serverAssignedInfos = JavaUtils.newConcurrentMap(); | ||
} | ||
|
||
public Set<String> getFailuresShuffleServerIds() { | ||
return failuresShuffleServerIds; | ||
} | ||
|
||
public void setFailuresShuffleServerIds(Set<String> failuresShuffleServerIds) { | ||
this.failuresShuffleServerIds = failuresShuffleServerIds; | ||
} | ||
|
||
public void recordFailuresShuffleServer(String shuffleServerId) { | ||
failuresShuffleServerIds.add(shuffleServerId); | ||
} | ||
|
||
public boolean recordAndGetServerAssignedInfo(String stageIdAndAttempt) { | ||
return serverAssignedInfos.computeIfAbsent(stageIdAndAttempt, id -> false); | ||
} | ||
|
||
public void recordAndGetServerAssignedInfo(String stageIdAndAttempt, boolean isRetried) { | ||
serverAssignedInfos.put(stageIdAndAttempt, isRetried); | ||
} | ||
} |
127 changes: 127 additions & 0 deletions
127
...nt-spark/common/src/main/java/org/apache/spark/shuffle/handle/ChainShuffleHandleInfo.java
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 |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.shuffle.handle; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import com.google.common.collect.Lists; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import org.apache.uniffle.client.PartitionDataReplicaRequirementTracking; | ||
import org.apache.uniffle.common.ShuffleServerInfo; | ||
import org.apache.uniffle.proto.RssProtos; | ||
|
||
public class ChainShuffleHandleInfo extends ShuffleHandleInfoBase { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(MutableShuffleHandleInfo.class); | ||
|
||
private ShuffleHandleInfo current; | ||
private LinkedList<ShuffleHandleInfo> historyHandles; | ||
|
||
public ChainShuffleHandleInfo(ShuffleHandleInfo shuffleServerInfo) { | ||
super(0, null); | ||
this.current = shuffleServerInfo; | ||
this.historyHandles = Lists.newLinkedList(); | ||
} | ||
|
||
public ChainShuffleHandleInfo( | ||
ShuffleHandleInfo currentShuffleServerInfo, LinkedList<ShuffleHandleInfo> historyHandles) { | ||
super(0, null); | ||
this.current = currentShuffleServerInfo; | ||
this.historyHandles = historyHandles; | ||
} | ||
|
||
@Override | ||
public Set<ShuffleServerInfo> getServers() { | ||
return current.getServers(); | ||
} | ||
|
||
@Override | ||
public Map<Integer, List<ShuffleServerInfo>> getAvailablePartitionServersForWriter() { | ||
return current.getAvailablePartitionServersForWriter(); | ||
} | ||
|
||
@Override | ||
public Map<Integer, List<ShuffleServerInfo>> getAllPartitionServersForReader() { | ||
return current.getAllPartitionServersForReader(); | ||
} | ||
|
||
@Override | ||
public PartitionDataReplicaRequirementTracking createPartitionReplicaTracking() { | ||
return current.createPartitionReplicaTracking(); | ||
} | ||
|
||
/** | ||
* When a Stage retry occurs, replace the current shuffleHandleInfo and record the historical | ||
* shuffleHandleInfo. | ||
*/ | ||
public void replaceCurrentShuffleHandleInfo(ShuffleHandleInfo shuffleHandleInfo) { | ||
this.historyHandles.add(current); | ||
this.current = shuffleHandleInfo; | ||
} | ||
|
||
public ShuffleHandleInfo getCurrent() { | ||
return current; | ||
} | ||
|
||
public LinkedList<ShuffleHandleInfo> getHistoryHandles() { | ||
return historyHandles; | ||
} | ||
|
||
public static RssProtos.ChainShuffleHandleInfo toProto(ChainShuffleHandleInfo handleInfo) { | ||
synchronized (handleInfo) { | ||
LinkedList<RssProtos.MutableShuffleHandleInfo> mutableShuffleHandleInfoLinkedList = | ||
Lists.newLinkedList(); | ||
RssProtos.MutableShuffleHandleInfo currentMutableShuffleHandleInfo = | ||
MutableShuffleHandleInfo.toProto((MutableShuffleHandleInfo) handleInfo.getCurrent()); | ||
for (ShuffleHandleInfo historyHandle : handleInfo.getHistoryHandles()) { | ||
mutableShuffleHandleInfoLinkedList.add( | ||
MutableShuffleHandleInfo.toProto((MutableShuffleHandleInfo) historyHandle)); | ||
} | ||
RssProtos.ChainShuffleHandleInfo handleProto = | ||
RssProtos.ChainShuffleHandleInfo.newBuilder() | ||
.setCurrentMutableShuffleHandleInfo(currentMutableShuffleHandleInfo) | ||
.addAllHistoryMutableShuffleHandleInfo(mutableShuffleHandleInfoLinkedList) | ||
.build(); | ||
return handleProto; | ||
} | ||
} | ||
|
||
public static ChainShuffleHandleInfo fromProto(RssProtos.ChainShuffleHandleInfo handleProto) { | ||
if (handleProto == null) { | ||
return null; | ||
} | ||
|
||
MutableShuffleHandleInfo mutableShuffleHandleInfo = | ||
MutableShuffleHandleInfo.fromProto(handleProto.getCurrentMutableShuffleHandleInfo()); | ||
List<RssProtos.MutableShuffleHandleInfo> historyMutableShuffleHandleInfoList = | ||
handleProto.getHistoryMutableShuffleHandleInfoList(); | ||
LinkedList<ShuffleHandleInfo> historyHandles = Lists.newLinkedList(); | ||
for (RssProtos.MutableShuffleHandleInfo shuffleHandleInfo : | ||
historyMutableShuffleHandleInfoList) { | ||
historyHandles.add(MutableShuffleHandleInfo.fromProto(shuffleHandleInfo)); | ||
} | ||
|
||
ChainShuffleHandleInfo chainShuffleHandleInfo = | ||
new ChainShuffleHandleInfo(mutableShuffleHandleInfo, historyHandles); | ||
return chainShuffleHandleInfo; | ||
} | ||
} |
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.