-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1608][part-1] fix(spark): Only share the replacement servers for fa…
…ulty servers in one stage (#1609) ### What changes were proposed in this pull request? 1. Lock the `shuffleHandle` to ensure the thread safe when reassigning partial server for tasks 2. Only share the replacement servers for faulty servers in one stage rather than the whole app 3. Simplify the reassignment logic, like the single one replacement server which will be supported in the future, so let's remove it currently. 4. correct the `partitionIds` type from `string` to `int` in proto ### Why are the changes needed? Fix: #1608 In current implementation of partition reassignment, it will share the same reassignment servers for the different stages, which will crash for app without registry. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? UTs
- Loading branch information
Showing
9 changed files
with
148 additions
and
84 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
61 changes: 61 additions & 0 deletions
61
client-spark/common/src/test/java/org/apache/spark/shuffle/ShuffleHandleInfoTest.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,61 @@ | ||
/* | ||
* 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.Arrays; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import org.apache.uniffle.common.RemoteStorageInfo; | ||
import org.apache.uniffle.common.ShuffleServerInfo; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class ShuffleHandleInfoTest { | ||
|
||
private ShuffleServerInfo createFakeServerInfo(String host) { | ||
return new ShuffleServerInfo(host, 1); | ||
} | ||
|
||
@Test | ||
public void testReassignment() { | ||
Map<Integer, List<ShuffleServerInfo>> partitionToServers = new HashMap<>(); | ||
partitionToServers.put(1, Arrays.asList(createFakeServerInfo("a"), createFakeServerInfo("b"))); | ||
partitionToServers.put(2, Arrays.asList(createFakeServerInfo("c"))); | ||
|
||
ShuffleHandleInfo handleInfo = | ||
new ShuffleHandleInfo(1, partitionToServers, new RemoteStorageInfo("")); | ||
|
||
// case1 | ||
assertFalse(handleInfo.isExistingFaultyServer("a")); | ||
Set<Integer> partitions = new HashSet<>(); | ||
partitions.add(1); | ||
ShuffleServerInfo newServer = createFakeServerInfo("d"); | ||
handleInfo.createNewReassignmentForMultiPartitions(partitions, "a", createFakeServerInfo("d")); | ||
assertTrue(handleInfo.isExistingFaultyServer("a")); | ||
|
||
assertEquals(newServer, handleInfo.useExistingReassignmentForMultiPartitions(partitions, "a")); | ||
} | ||
} |
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
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