-
Notifications
You must be signed in to change notification settings - Fork 135
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
[#719] feat(netty): Optimize allocation strategy #739
Changes from 4 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 | ||
---|---|---|---|---|
|
@@ -17,6 +17,7 @@ | |||
|
||||
package org.apache.uniffle.test; | ||||
|
||||
import java.lang.reflect.Field; | ||||
import java.util.Arrays; | ||||
import java.util.List; | ||||
import java.util.Map; | ||||
|
@@ -31,10 +32,12 @@ | |||
import org.apache.uniffle.client.request.RssGetShuffleAssignmentsRequest; | ||||
import org.apache.uniffle.client.response.RssApplicationInfoResponse; | ||||
import org.apache.uniffle.client.response.RssGetShuffleAssignmentsResponse; | ||||
import org.apache.uniffle.common.ClientType; | ||||
import org.apache.uniffle.common.PartitionRange; | ||||
import org.apache.uniffle.common.ShuffleRegisterInfo; | ||||
import org.apache.uniffle.common.ShuffleServerInfo; | ||||
import org.apache.uniffle.common.config.RssBaseConf; | ||||
import org.apache.uniffle.common.config.RssConf; | ||||
import org.apache.uniffle.common.rpc.StatusCode; | ||||
import org.apache.uniffle.common.storage.StorageInfo; | ||||
import org.apache.uniffle.common.storage.StorageMedia; | ||||
|
@@ -121,11 +124,30 @@ public void getShuffleRegisterInfoTest() { | |||
|
||||
@Test | ||||
public void getShuffleAssignmentsTest() throws Exception { | ||||
String appId = "getShuffleAssignmentsTest"; | ||||
final String appId = "getShuffleAssignmentsTest"; | ||||
CoordinatorTestUtils.waitForRegister(coordinatorClient,2); | ||||
// When the shuffleServerHeartbeat Test is completed before the current test, | ||||
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. Line 249 in 1021031
Because this shuffleServerConf modifies the netty port number of a server, there will be one less machine allocated. Therefore, in order to maintain the original test, we need to set the port number back to a negative number, which is equivalent to setting the label to GRPC .
|
||||
// the server's tags will be [ss_v4, GRPC_NETTY] and [ss_v4, GRPC], respectively. | ||||
// We need to remove the first machine's tag from GRPC_NETTY to GRPC | ||||
shuffleServers.get(0).stopServer(); | ||||
RssConf shuffleServerConf = shuffleServers.get(0).getShuffleServerConf(); | ||||
Map<String, Object> originConf = shuffleServerConf.getSettings(); | ||||
Class<RssConf> clazz = RssConf.class; | ||||
Field field = clazz.getDeclaredField("settings"); | ||||
field.setAccessible(true); | ||||
originConf.remove(ShuffleServerConf.NETTY_SERVER_PORT.key()); | ||||
field.set(shuffleServerConf, originConf); | ||||
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. We don't need set the value again. They are the same object. 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. I got it. |
||||
String storageTypeJsonSource = String.format("{\"%s\": \"ssd\"}", baseDir); | ||||
withEnvironmentVariables("RSS_ENV_KEY", storageTypeJsonSource).execute(() -> { | ||||
ShuffleServer ss = new ShuffleServer((ShuffleServerConf) shuffleServerConf); | ||||
ss.start(); | ||||
shuffleServers.set(0, ss); | ||||
}); | ||||
Thread.sleep(5000); | ||||
// add tag when ClientType is `GRPC` | ||||
RssGetShuffleAssignmentsRequest request = new RssGetShuffleAssignmentsRequest( | ||||
appId, 1, 10, 4, 1, | ||||
Sets.newHashSet(Constants.SHUFFLE_SERVER_VERSION)); | ||||
Sets.newHashSet(Constants.SHUFFLE_SERVER_VERSION, ClientType.GRPC.name())); | ||||
RssGetShuffleAssignmentsResponse response = coordinatorClient.getShuffleAssignments(request); | ||||
Set<Integer> expectedStart = Sets.newHashSet(0, 4, 8); | ||||
|
||||
|
@@ -157,7 +179,7 @@ public void getShuffleAssignmentsTest() throws Exception { | |||
|
||||
request = new RssGetShuffleAssignmentsRequest( | ||||
appId, 1, 10, 4, 2, | ||||
Sets.newHashSet(Constants.SHUFFLE_SERVER_VERSION)); | ||||
Sets.newHashSet(Constants.SHUFFLE_SERVER_VERSION, ClientType.GRPC.name())); | ||||
response = coordinatorClient.getShuffleAssignments(request); | ||||
serverToPartitionRanges = response.getServerToPartitionRanges(); | ||||
assertEquals(2, serverToPartitionRanges.size()); | ||||
|
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.
Could we convert this method to
CheckValue#checkValueFunc
likeConfigUtil#POSITIVE_LONG_VALIDATOR
?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.
OK, i will try 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.
It doesn't seem to work because there is no
checkValue
on mr's client side.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.
I got it. My mistake.