From e98f8f7ac114b723a660450474f5834f730570f9 Mon Sep 17 00:00:00 2001 From: "terence.yoo" Date: Mon, 21 Mar 2016 19:23:58 +0900 Subject: [PATCH] bug fix --- .../main/java/com/kakao/hbase/manager/command/Balance.java | 7 ++++++- .../java/com/kakao/hbase/manager/command/BalanceRule.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hbase0.98/hbase-manager-0.98/src/main/java/com/kakao/hbase/manager/command/Balance.java b/hbase0.98/hbase-manager-0.98/src/main/java/com/kakao/hbase/manager/command/Balance.java index 58a40f4..0544bdc 100644 --- a/hbase0.98/hbase-manager-0.98/src/main/java/com/kakao/hbase/manager/command/Balance.java +++ b/hbase0.98/hbase-manager-0.98/src/main/java/com/kakao/hbase/manager/command/Balance.java @@ -185,7 +185,12 @@ private void balance(Args args, List 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); diff --git a/hbase0.98/hbase-manager-0.98/src/main/java/com/kakao/hbase/manager/command/BalanceRule.java b/hbase0.98/hbase-manager-0.98/src/main/java/com/kakao/hbase/manager/command/BalanceRule.java index 96c0c53..c384196 100644 --- a/hbase0.98/hbase-manager-0.98/src/main/java/com/kakao/hbase/manager/command/BalanceRule.java +++ b/hbase0.98/hbase-manager-0.98/src/main/java/com/kakao/hbase/manager/command/BalanceRule.java @@ -40,7 +40,7 @@ List makePlan(HBaseAdmin admin, Set 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)); } }