From 0a0aef345a4b4f4deaa66434f749a3abb248846b Mon Sep 17 00:00:00 2001 From: tedyu Date: Mon, 6 Feb 2017 19:48:14 -0800 Subject: [PATCH] HBASE-17264 Processing RIT with offline state will always fail to open the first time (Allan Yang) --- .../org/apache/hadoop/hbase/master/AssignmentManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java index 2035f6a5767..f3c0787efc7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java @@ -874,7 +874,7 @@ public class AssignmentManager extends ZooKeeperListener { case M_ZK_REGION_OFFLINE: // Insert in RIT and resend to the regionserver - regionStates.updateRegionState(rt, State.PENDING_OPEN); + regionStates.updateRegionState(rt, State.OFFLINE); final RegionState rsOffline = regionStates.getRegionState(regionInfo); this.executorService.submit( new EventHandler(server, EventType.M_MASTER_RECOVERY) { @@ -884,7 +884,7 @@ public class AssignmentManager extends ZooKeeperListener { try { RegionPlan plan = new RegionPlan(regionInfo, null, sn); addPlan(encodedName, plan); - assign(rsOffline, false, false); + assign(rsOffline, true, false); } finally { lock.unlock(); } @@ -1608,6 +1608,7 @@ public class AssignmentManager extends ZooKeeperListener { /** * Use care with forceNewPlan. It could cause double assignment. */ + @VisibleForTesting public void assign(HRegionInfo region, boolean setOfflineInZK, boolean forceNewPlan) { if (isDisabledorDisablingRegionInRIT(region)) { @@ -2085,7 +2086,7 @@ public class AssignmentManager extends ZooKeeperListener { * @param setOfflineInZK * @param forceNewPlan */ - private void assign(RegionState state, + public void assign(RegionState state, boolean setOfflineInZK, final boolean forceNewPlan) { long startTime = EnvironmentEdgeManager.currentTime(); try {