Repository: hbase Updated Branches: refs/heads/branch-2.1 4978db810 -> e26ca63f8
Revert "Revert "HBASE-21095 The timeout retry logic for several procedures are broken after master restarts"" HBASE-21113 Apply the branch-2 version of HBASE-21095, The timeout retry logic for several procedures are broken after master restarts I applied the patch HBASE-21095 and then reverted it so could apply the patch as HBASE-21113 (by reverting the HBASE-21095 revert but pushing with this message!). This reverts commit 4978db81028f3a955932589af77599b53d909a46. Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e26ca63f Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e26ca63f Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e26ca63f Branch: refs/heads/branch-2.1 Commit: e26ca63f8801440f242560c81e5135ec809440f1 Parents: 4978db8 Author: Michael Stack <st...@apache.org> Authored: Fri Aug 24 12:35:29 2018 -0700 Committer: Michael Stack <st...@apache.org> Committed: Fri Aug 24 12:35:29 2018 -0700 ---------------------------------------------------------------------- .../assignment/RegionTransitionProcedure.java | 11 ++++------- .../assignment/TestUnexpectedStateException.java | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/e26ca63f/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionTransitionProcedure.java ---------------------------------------------------------------------- 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 0db8676..c10bf2d 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 @@ -364,12 +364,9 @@ public abstract class RegionTransitionProcedure LOG.warn("Failed transition, suspend {}secs {}; {}; waiting on rectified condition fixed " + "by other Procedure or operator intervention", backoff / 1000, this, regionNode.toShortString(), e); - getRegionState(env).getProcedureEvent().suspend(); - if (getRegionState(env).getProcedureEvent().suspendIfNotReady(this)) { - setTimeout(Math.toIntExact(backoff)); - setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT); - throw new ProcedureSuspendedException(); - } + setTimeout(Math.toIntExact(backoff)); + setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT); + throw new ProcedureSuspendedException(); } return new Procedure[] {this}; @@ -387,7 +384,7 @@ public abstract class RegionTransitionProcedure @Override protected synchronized boolean setTimeoutFailure(MasterProcedureEnv env) { setState(ProcedureProtos.ProcedureState.RUNNABLE); - getRegionState(env).getProcedureEvent().wake(env.getProcedureScheduler()); + env.getProcedureScheduler().addFront(this); return false; // 'false' means that this procedure handled the timeout } http://git-wip-us.apache.org/repos/asf/hbase/blob/e26ca63f/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestUnexpectedStateException.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestUnexpectedStateException.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestUnexpectedStateException.java index 0f62f8e..16648c0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestUnexpectedStateException.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestUnexpectedStateException.java @@ -24,17 +24,15 @@ import java.util.Iterator; import java.util.List; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.RegionInfo; +import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.testclassification.MasterTests; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Threads; -import org.apache.hbase.thirdparty.com.google.gson.JsonArray; -import org.apache.hbase.thirdparty.com.google.gson.JsonElement; -import org.apache.hbase.thirdparty.com.google.gson.JsonObject; -import org.apache.hbase.thirdparty.com.google.gson.JsonParser; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -46,6 +44,11 @@ import org.junit.rules.TestName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.gson.JsonArray; +import org.apache.hbase.thirdparty.com.google.gson.JsonElement; +import org.apache.hbase.thirdparty.com.google.gson.JsonObject; +import org.apache.hbase.thirdparty.com.google.gson.JsonParser; + /** * Tests for HBASE-18408 "AM consumes CPU and fills up the logs really fast when there is no RS to * assign". If an {@link org.apache.hadoop.hbase.exceptions.UnexpectedStateException}, we'd spin on @@ -66,6 +69,8 @@ public class TestUnexpectedStateException { @BeforeClass public static void beforeClass() throws Exception { + TEST_UTIL.getConfiguration().setBoolean("hbase.localcluster.assign.random.ports", false); + TEST_UTIL.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, 50655); TEST_UTIL.startMiniCluster(); } @@ -139,6 +144,11 @@ public class TestUnexpectedStateException { } Thread.sleep(1000); } + TEST_UTIL.getMiniHBaseCluster().stopMaster(0).join(); + HMaster master = TEST_UTIL.getMiniHBaseCluster().startMaster().getMaster(); + TEST_UTIL.waitFor(30000, () -> master.isInitialized()); + am = master.getAssignmentManager(); + rsn = am.getRegionStates().getRegionStateNode(region); am.markRegionAsOpened(rsn); t.join(); }