Skip to content

Commit

Permalink
fix checkstyle warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Apache9 committed Apr 24, 2021
1 parent 34bcab5 commit 46e546e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ public ServerName randomAssignment(RegionInfo regionInfo, List<ServerName> serve
private Pair<Map<ServerName, List<RegionInfo>>, List<RegionInfo>>
segregateRegionsAndAssignRegionsWithFavoredNodes(List<RegionInfo> regions,
List<ServerName> availableServers) {
Map<ServerName, List<RegionInfo>> assignmentMapForFavoredNodes = new HashMap<>(regions.size() / 2);
List<RegionInfo> regionsWithNoFavoredNodes = new ArrayList<>(regions.size()/2);
Map<ServerName, List<RegionInfo>> assignmentMapForFavoredNodes =
new HashMap<>(regions.size() / 2);
List<RegionInfo> regionsWithNoFavoredNodes = new ArrayList<>(regions.size() / 2);
for (RegionInfo region : regions) {
List<ServerName> favoredNodes = fnm.getFavoredNodes(region);
ServerName primaryHost = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected void configureGenerators() {
setCandidateGenerators(fnPickers);
}

/*
/**
* Round robin assignment: Segregate the regions into two types:
*
* 1. The regions that have favored node assignment where at least one of the favored node
Expand Down Expand Up @@ -183,12 +183,12 @@ private Map<ServerName, List<RegionInfo>> generateFNForRegionsWithoutFN(
return assignmentMap;
}

/*
/**
* Return a pair - one with assignments when favored nodes are present and another with regions
* without favored nodes.
*/
private Pair<Map<ServerName, List<RegionInfo>>, List<RegionInfo>>
segregateRegionsAndAssignRegionsWithFavoredNodes(Collection<RegionInfo> regions,
segregateRegionsAndAssignRegionsWithFavoredNodes(Collection<RegionInfo> regions,
List<ServerName> onlineServers) throws HBaseIOException {

// Since we expect FN to be present most of the time, lets create map with same size
Expand Down Expand Up @@ -227,17 +227,16 @@ private Map<ServerName, List<RegionInfo>> generateFNForRegionsWithoutFN(
}

private void addRegionToMap(Map<ServerName, List<RegionInfo>> assignmentMapForFavoredNodes,
RegionInfo region, ServerName host) {

List<RegionInfo> regionsOnServer;
if ((regionsOnServer = assignmentMapForFavoredNodes.get(host)) == null) {
RegionInfo region, ServerName host) {
List<RegionInfo> regionsOnServer = assignmentMapForFavoredNodes.get(host);
if (regionsOnServer == null) {
regionsOnServer = Lists.newArrayList();
assignmentMapForFavoredNodes.put(host, regionsOnServer);
}
regionsOnServer.add(region);
}

/*
/**
* Get the ServerName for the FavoredNode. Since FN's startcode is -1, we could want to get the
* ServerName with the correct start code from the list of provided servers.
*/
Expand Down

0 comments on commit 46e546e

Please sign in to comment.