Skip to content

Commit

Permalink
[hotfix] fix server discovery (apache#8664)
Browse files Browse the repository at this point in the history
Co-authored-by: Rong Rong <[email protected]>
  • Loading branch information
walterddr and Rong Rong committed May 17, 2022
1 parent 30bc434 commit 4d77924
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public WorkerInstance(String hostname, int serverPort, int mailboxPort) {
}

private static InstanceConfig toInstanceConfig(String hostname, int serverPort, int mailboxPort) {
String server = String.format("%s_%d", hostname, serverPort);
String server = String.format("%s%s_%d", CommonConstants.Helix.PREFIX_OF_SERVER_INSTANCE, hostname, serverPort);
InstanceConfig instanceConfig = InstanceConfig.toInstanceConfig(server);
ZNRecord znRecord = instanceConfig.getRecord();
Map<String, String> simpleFields = znRecord.getSimpleFields();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ public void testQueryAndAssertStageContentForJoin()
// table scan stages; for tableA it should have 2 hosts, for tableB it should have only 1
Assert.assertEquals(
e.getValue().getServerInstances().stream().map(ServerInstance::toString).collect(Collectors.toList()),
tables.get(0).equals("a") ? ImmutableList.of("localhost_1", "localhost_2")
: ImmutableList.of("localhost_1"));
tables.get(0).equals("a") ? ImmutableList.of("Server_localhost_1", "Server_localhost_2")
: ImmutableList.of("Server_localhost_1"));
} else if (!PlannerUtils.isRootStage(e.getKey())) {
// join stage should have both servers used.
Assert.assertEquals(
e.getValue().getServerInstances().stream().map(ServerInstance::toString).collect(Collectors.toList()),
ImmutableList.of("localhost_1", "localhost_2"));
ImmutableList.of("Server_localhost_1", "Server_localhost_2"));
} else {
// reduce stage should have the reducer instance.
Assert.assertEquals(
e.getValue().getServerInstances().stream().map(ServerInstance::toString).collect(Collectors.toList()),
ImmutableList.of("localhost_3"));
ImmutableList.of("Server_localhost_3"));
}
}
}
Expand Down

0 comments on commit 4d77924

Please sign in to comment.