Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
terence-yoo committed Mar 21, 2016
1 parent e733266 commit e98f8f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ private void balance(Args args, List<RegionPlan> regionPlanList, Phase phase, bo
String tableName = Bytes.toString(regionPlan.getRegionInfo().getTableName());
String encodedRegionName = regionPlan.getRegionInfo().getEncodedName();
String serverNameDest = regionPlan.getDestination().getServerName();
String serverNameSource = regionPlan.getSource().getServerName();
String serverNameSource;
if (regionPlan.getSource() == null) {
serverNameSource = "N/A";
} else {
serverNameSource = regionPlan.getSource().getServerName();
}
String planStr = progress++ + "/" + regionPlanList.size() + " - move " + encodedRegionName + " of " + tableName + " from " + serverNameSource + " to " + serverNameDest;
if (phase == Phase.BALANCE) {
System.out.print(planStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ List<RegionPlan> makePlan(HBaseAdmin admin, Set<String> tableNameSet, Args args)
for (HRegionInfo hRegionInfo : admin.getTableRegions(tableName.getBytes())) {
ServerName source = regionLocations.get(hRegionInfo);
ServerName dest = serverNames.get((i++) % serverNames.size());
if (!source.equals(dest))
if (source == null || !source.equals(dest))
regionPlanList.add(new RegionPlan(hRegionInfo, source, dest));
}
}
Expand Down

0 comments on commit e98f8f7

Please sign in to comment.