From 847955427528bb9edff44fb6b2969fc9dfd8b9cc Mon Sep 17 00:00:00 2001 From: Matteo Bertozzi Date: Wed, 31 Aug 2016 13:48:02 -0700 Subject: [PATCH] HBASE-16519 Procedure v2 - Avoid sync wait on DDLs operation (addendum) --- .../master/TestAssignmentManagerMetrics.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerMetrics.java index 481745762b6..31e3af8d570 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerMetrics.java @@ -17,6 +17,8 @@ */ package org.apache.hadoop.hbase.master; +import java.io.IOException; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; @@ -37,6 +39,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; +import static org.junit.Assert.fail; @Category(MediumTests.class) public class TestAssignmentManagerMetrics { @@ -69,6 +72,11 @@ public class TestAssignmentManagerMetrics { // set tablesOnMaster to none conf.set("hbase.balancer.tablesOnMaster", "none"); + // set client sync wait timeout to 5sec + conf.setInt("hbase.client.sync.wait.timeout.msec", 2500); + conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1); + conf.setInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, 2500); + TEST_UTIL.startMiniCluster(1); cluster = TEST_UTIL.getHBaseCluster(); master = cluster.getMaster(); @@ -119,7 +127,14 @@ public class TestAssignmentManagerMetrics { String spec = "hdfs:///foo.jar|com.foo.FooRegionObserver|1001|arg1=1,arg2=2"; htd.addCoprocessorWithSpec(spec); - TEST_UTIL.getHBaseAdmin().modifyTable(TABLENAME, htd); + try { + TEST_UTIL.getHBaseAdmin().modifyTable(TABLENAME, htd); + fail("Expected region failed to open"); + } catch (IOException e) { + // expected, the RS will crash and the assignment will spin forever waiting for a RS + // to assign the region. the region will not go to FAILED_OPEN because in this case + // we have just one RS and it will do one retry. + } // Sleep 3 seconds, wait for doMetrics chore catching up Thread.sleep(msgInterval * 3);