From 7d7ca33e6d43bc991d71d2ce79668db54866011f Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 27 Feb 2018 12:06:48 -0800 Subject: [PATCH] HBASE-20100 TestEnableTableProcedure flakey Allow OPEN as a possible state when update region transition state. Usually state is OPENING but if crash before finish step is completed, on replay, master may have read that the state is OPEN from meta table and so will think it open... When we replay the procedure finish, allow that the region is already OPEN. --- .../apache/hadoop/hbase/master/assignment/AssignProcedure.java | 2 +- .../org/apache/hadoop/hbase/master/assignment/RegionStates.java | 2 ++ .../hbase/master/assignment/RegionTransitionProcedure.java | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignProcedure.java index 65eafe72cea..fd3155398f8 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignProcedure.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignProcedure.java @@ -208,7 +208,7 @@ public class AssignProcedure extends RegionTransitionProcedure { } } } - LOG.info("Start " + this + "; " + regionNode.toShortString() + + LOG.info("Starting " + this + "; " + regionNode.toShortString() + "; forceNewPlan=" + this.forceNewPlan + ", retain=" + retain); env.getAssignmentManager().queueAssign(regionNode); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java index fa94495e0e1..adeba67f62f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java @@ -60,6 +60,8 @@ public class RegionStates { private static final Logger LOG = LoggerFactory.getLogger(RegionStates.class); protected static final State[] STATES_EXPECTED_ON_OPEN = new State[] { + State.OPEN, // State may already be OPEN if we died after receiving the OPEN from regionserver + // but before complete finish of AssignProcedure. HBASE-20100. State.OFFLINE, State.CLOSED, // disable/offline State.SPLITTING, State.SPLIT, // ServerCrashProcedure State.OPENING, State.FAILED_OPEN, // already in-progress (retrying) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionTransitionProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionTransitionProcedure.java index 4a88e3bf19a..6c63cb83be3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionTransitionProcedure.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionTransitionProcedure.java @@ -322,6 +322,7 @@ public abstract class RegionTransitionProcedure case REGION_TRANSITION_FINISH: // 3. wait assignment response. completion/failure + LOG.debug("Finishing {}; {}", this, regionNode.toShortString()); finishTransition(env, regionNode); am.removeRegionInTransition(regionNode, this); return null;