From commits-return-79315-archive-asf-public=cust-asf.ponee.io@hbase.apache.org Wed Oct 17 16:53:27 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B7A111807A3 for ; Wed, 17 Oct 2018 16:53:25 +0200 (CEST) Received: (qmail 76025 invoked by uid 500); 17 Oct 2018 14:53:24 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 75687 invoked by uid 99); 17 Oct 2018 14:53:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2018 14:53:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 367E2E11BB; Wed, 17 Oct 2018 14:53:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: git-site-role@apache.org To: commits@hbase.apache.org Date: Wed, 17 Oct 2018 14:53:22 -0000 Message-Id: <2db56e24a8bd4f429c1f853dd561abb7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/35] hbase-site git commit: Published site at 8cc56bd18c40ba9a7131336e97c74f8d97d8b2be. Repository: hbase-site Updated Branches: refs/heads/asf-site 6129abc29 -> 713132a3d http://git-wip-us.apache.org/repos/asf/hbase-site/blob/713132a3/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.BlockReaderWrapper.html ---------------------------------------------------------------------- diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.BlockReaderWrapper.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.BlockReaderWrapper.html index c491776..76a9ecc 100644 --- a/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.BlockReaderWrapper.html +++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.BlockReaderWrapper.html @@ -210,7 +210,7 @@ 202 203 private void readIndex(boolean useTags) throws IOException { 204 long fileSize = fs.getFileStatus(path).getLen(); -205 LOG.info("Size of " + path + ": " + fileSize); +205 LOG.info("Size of {}: {} compression={}", path, fileSize, compr.toString()); 206 207 FSDataInputStream istream = fs.open(path); 208 HFileContext meta = new HFileContextBuilder() http://git-wip-us.apache.org/repos/asf/hbase-site/blob/713132a3/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.html ---------------------------------------------------------------------- diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.html index c491776..76a9ecc 100644 --- a/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.html +++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.html @@ -210,7 +210,7 @@ 202 203 private void readIndex(boolean useTags) throws IOException { 204 long fileSize = fs.getFileStatus(path).getLen(); -205 LOG.info("Size of " + path + ": " + fileSize); +205 LOG.info("Size of {}: {} compression={}", path, fileSize, compr.toString()); 206 207 FSDataInputStream istream = fs.open(path); 208 HFileContext meta = new HFileContextBuilder() http://git-wip-us.apache.org/repos/asf/hbase-site/blob/713132a3/testdevapidocs/src-html/org/apache/hadoop/hbase/regionserver/CreateRandomStoreFile.html ---------------------------------------------------------------------- diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/regionserver/CreateRandomStoreFile.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/regionserver/CreateRandomStoreFile.html index 1f24659..4b46b23 100644 --- a/testdevapidocs/src-html/org/apache/hadoop/hbase/regionserver/CreateRandomStoreFile.html +++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/regionserver/CreateRandomStoreFile.html @@ -240,7 +240,7 @@ 232 233 Path storeFilePath = sfw.getPath(); 234 long fileSize = fs.getFileStatus(storeFilePath).getLen(); -235 LOG.info("Created " + storeFilePath + ", " + fileSize + " bytes"); +235 LOG.info("Created {}, {} bytes, compression={}", storeFilePath, fileSize, compr.toString()); 236 237 return true; 238 } http://git-wip-us.apache.org/repos/asf/hbase-site/blob/713132a3/testdevapidocs/src-html/org/apache/hadoop/hbase/tool/TestCanaryTool.html ---------------------------------------------------------------------- diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/tool/TestCanaryTool.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/tool/TestCanaryTool.html index e2b18bd..b18632e 100644 --- a/testdevapidocs/src-html/org/apache/hadoop/hbase/tool/TestCanaryTool.html +++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/tool/TestCanaryTool.html @@ -43,231 +43,233 @@ 035import org.apache.hadoop.hbase.HBaseClassTestRule; 036import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; 037import org.apache.hadoop.hbase.client.Put; -038import org.apache.hadoop.hbase.client.Table; -039import org.apache.hadoop.hbase.testclassification.MediumTests; -040import org.apache.hadoop.hbase.util.Bytes; -041import org.apache.hadoop.util.ToolRunner; -042import org.apache.log4j.Appender; -043import org.apache.log4j.LogManager; -044import org.apache.log4j.spi.LoggingEvent; -045import org.junit.After; -046import org.junit.Before; -047import org.junit.ClassRule; -048import org.junit.Ignore; -049import org.junit.Rule; -050import org.junit.Test; -051import org.junit.experimental.categories.Category; -052import org.junit.rules.TestName; -053import org.junit.runner.RunWith; -054import org.mockito.ArgumentMatcher; -055import org.mockito.Mock; -056import org.mockito.runners.MockitoJUnitRunner; -057 -058import org.apache.hbase.thirdparty.com.google.common.collect.Iterables; -059 -060@RunWith(MockitoJUnitRunner.class) -061@Category({MediumTests.class}) -062public class TestCanaryTool { -063 -064 @ClassRule -065 public static final HBaseClassTestRule CLASS_RULE = -066 HBaseClassTestRule.forClass(TestCanaryTool.class); -067 -068 private HBaseTestingUtility testingUtility; -069 private static final byte[] FAMILY = Bytes.toBytes("f"); -070 private static final byte[] COLUMN = Bytes.toBytes("col"); -071 -072 @Rule -073 public TestName name = new TestName(); -074 -075 @Before -076 public void setUp() throws Exception { -077 testingUtility = new HBaseTestingUtility(); -078 testingUtility.startMiniCluster(); -079 LogManager.getRootLogger().addAppender(mockAppender); -080 } -081 -082 @After -083 public void tearDown() throws Exception { -084 testingUtility.shutdownMiniCluster(); -085 LogManager.getRootLogger().removeAppender(mockAppender); -086 } -087 -088 @Mock -089 Appender mockAppender; -090 -091 @Test -092 public void testBasicZookeeperCanaryWorks() throws Exception { -093 final String[] args = { "-t", "10000", "-zookeeper" }; -094 testZookeeperCanaryWithArgs(args); -095 } -096 -097 @Test -098 public void testZookeeperCanaryPermittedFailuresArgumentWorks() throws Exception { -099 final String[] args = { "-t", "10000", "-zookeeper", "-treatFailureAsError", "-permittedZookeeperFailures", "1" }; -100 testZookeeperCanaryWithArgs(args); -101 } -102 -103 @Test -104 public void testBasicCanaryWorks() throws Exception { -105 final TableName tableName = TableName.valueOf(name.getMethodName()); -106 Table table = testingUtility.createTable(tableName, new byte[][] { FAMILY }); -107 // insert some test rows -108 for (int i=0; i<1000; i++) { -109 byte[] iBytes = Bytes.toBytes(i); -110 Put p = new Put(iBytes); -111 p.addColumn(FAMILY, COLUMN, iBytes); -112 table.put(p); -113 } -114 ExecutorService executor = new ScheduledThreadPoolExecutor(1); -115 Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink()); -116 Canary canary = new Canary(executor, sink); -117 String[] args = { "-writeSniffing", "-t", "10000", name.getMethodName() }; -118 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); -119 assertEquals("verify no read error count", 0, canary.getReadFailures().size()); -120 assertEquals("verify no write error count", 0, canary.getWriteFailures().size()); -121 verify(sink, atLeastOnce()).publishReadTiming(isA(ServerName.class), isA(HRegionInfo.class), -122 isA(ColumnFamilyDescriptor.class), anyLong()); -123 } -124 -125 @Test -126 @Ignore("Intermittent argument matching failures, see HBASE-18813") -127 public void testReadTableTimeouts() throws Exception { -128 final TableName [] tableNames = new TableName[2]; -129 tableNames[0] = TableName.valueOf(name.getMethodName() + "1"); -130 tableNames[1] = TableName.valueOf(name.getMethodName() + "2"); -131 // Create 2 test tables. -132 for (int j = 0; j<2; j++) { -133 Table table = testingUtility.createTable(tableNames[j], new byte[][] { FAMILY }); -134 // insert some test rows -135 for (int i=0; i<1000; i++) { -136 byte[] iBytes = Bytes.toBytes(i + j); -137 Put p = new Put(iBytes); -138 p.addColumn(FAMILY, COLUMN, iBytes); -139 table.put(p); -140 } -141 } -142 ExecutorService executor = new ScheduledThreadPoolExecutor(1); -143 Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink()); -144 Canary canary = new Canary(executor, sink); -145 String configuredTimeoutStr = tableNames[0].getNameAsString() + "=" + Long.MAX_VALUE + "," + -146 tableNames[1].getNameAsString() + "=0"; -147 String[] args = { "-readTableTimeouts", configuredTimeoutStr, name.getMethodName() + "1", name.getMethodName() + "2"}; -148 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); -149 verify(sink, times(tableNames.length)).initializeAndGetReadLatencyForTable(isA(String.class)); -150 for (int i=0; i<2; i++) { -151 assertNotEquals("verify non-null read latency", null, sink.getReadLatencyMap().get(tableNames[i].getNameAsString())); -152 assertNotEquals("verify non-zero read latency", 0L, sink.getReadLatencyMap().get(tableNames[i].getNameAsString())); -153 } -154 // One table's timeout is set for 0 ms and thus, should lead to an error. -155 verify(mockAppender, times(1)).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() { -156 @Override -157 public boolean matches(LoggingEvent argument) { -158 return ((LoggingEvent) argument).getRenderedMessage().contains("exceeded the configured read timeout."); -159 } -160 })); -161 verify(mockAppender, times(2)).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() { -162 @Override -163 public boolean matches(LoggingEvent argument) { -164 return argument.getRenderedMessage().contains("The configured read timeout was"); -165 } -166 })); -167 } -168 -169 @Test -170 @Ignore("Intermittent argument matching failures, see HBASE-18813") -171 public void testWriteTableTimeout() throws Exception { -172 ExecutorService executor = new ScheduledThreadPoolExecutor(1); -173 Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink()); -174 Canary canary = new Canary(executor, sink); -175 String[] args = { "-writeSniffing", "-writeTableTimeout", String.valueOf(Long.MAX_VALUE)}; -176 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); -177 assertNotEquals("verify non-null write latency", null, sink.getWriteLatency()); -178 assertNotEquals("verify non-zero write latency", 0L, sink.getWriteLatency()); -179 verify(mockAppender, times(1)).doAppend(argThat( -180 new ArgumentMatcher<LoggingEvent>() { -181 @Override -182 public boolean matches(LoggingEvent argument) { -183 return argument.getRenderedMessage().contains("The configured write timeout was"); -184 } -185 })); -186 } -187 -188 //no table created, so there should be no regions -189 @Test -190 public void testRegionserverNoRegions() throws Exception { -191 runRegionserverCanary(); -192 verify(mockAppender).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() { -193 @Override -194 public boolean matches(LoggingEvent argument) { -195 return argument.getRenderedMessage().contains("Regionserver not serving any regions"); -196 } -197 })); -198 } -199 -200 //by creating a table, there shouldn't be any region servers not serving any regions -201 @Test -202 public void testRegionserverWithRegions() throws Exception { -203 final TableName tableName = TableName.valueOf(name.getMethodName()); -204 testingUtility.createTable(tableName, new byte[][] { FAMILY }); -205 runRegionserverCanary(); -206 verify(mockAppender, never()).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() { -207 @Override -208 public boolean matches(LoggingEvent argument) { -209 return argument.getRenderedMessage().contains("Regionserver not serving any regions"); -210 } -211 })); -212 } -213 -214 @Test -215 public void testRawScanConfig() throws Exception { -216 final TableName tableName = TableName.valueOf(name.getMethodName()); -217 Table table = testingUtility.createTable(tableName, new byte[][] { FAMILY }); -218 // insert some test rows -219 for (int i=0; i<1000; i++) { -220 byte[] iBytes = Bytes.toBytes(i); -221 Put p = new Put(iBytes); -222 p.addColumn(FAMILY, COLUMN, iBytes); -223 table.put(p); -224 } -225 ExecutorService executor = new ScheduledThreadPoolExecutor(1); -226 Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink()); -227 Canary canary = new Canary(executor, sink); -228 String[] args = { "-t", "10000", name.getMethodName() }; -229 org.apache.hadoop.conf.Configuration conf = -230 new org.apache.hadoop.conf.Configuration(testingUtility.getConfiguration()); -231 conf.setBoolean(HConstants.HBASE_CANARY_READ_RAW_SCAN_KEY, true); -232 assertEquals(0, ToolRunner.run(conf, canary, args)); -233 verify(sink, atLeastOnce()) -234 .publishReadTiming(isA(ServerName.class), isA(HRegionInfo.class), -235 isA(ColumnFamilyDescriptor.class), anyLong()); -236 assertEquals("verify no read error count", 0, canary.getReadFailures().size()); -237 } -238 -239 private void runRegionserverCanary() throws Exception { -240 ExecutorService executor = new ScheduledThreadPoolExecutor(1); -241 Canary canary = new Canary(executor, new Canary.RegionServerStdOutSink()); -242 String[] args = { "-t", "10000", "-regionserver"}; -243 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); -244 assertEquals("verify no read error count", 0, canary.getReadFailures().size()); -245 } -246 -247 private void testZookeeperCanaryWithArgs(String[] args) throws Exception { -248 Integer port = -249 Iterables.getOnlyElement(testingUtility.getZkCluster().getClientPortList(), null); -250 testingUtility.getConfiguration().set(HConstants.ZOOKEEPER_QUORUM, -251 "localhost:" + port + "/hbase"); -252 ExecutorService executor = new ScheduledThreadPoolExecutor(2); -253 Canary.ZookeeperStdOutSink sink = spy(new Canary.ZookeeperStdOutSink()); -254 Canary canary = new Canary(executor, sink); -255 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); -256 -257 String baseZnode = testingUtility.getConfiguration() -258 .get(HConstants.ZOOKEEPER_ZNODE_PARENT, HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT); -259 verify(sink, atLeastOnce()) -260 .publishReadTiming(eq(baseZnode), eq("localhost:" + port), anyLong()); -261 } -262} +038import org.apache.hadoop.hbase.client.RegionInfo; +039import org.apache.hadoop.hbase.client.Table; +040import org.apache.hadoop.hbase.testclassification.MediumTests; +041import org.apache.hadoop.hbase.util.Bytes; +042import org.apache.hadoop.util.ToolRunner; +043import org.apache.log4j.Appender; +044import org.apache.log4j.LogManager; +045import org.apache.log4j.spi.LoggingEvent; +046import org.junit.After; +047import org.junit.Before; +048import org.junit.ClassRule; +049import org.junit.Ignore; +050import org.junit.Rule; +051import org.junit.Test; +052import org.junit.experimental.categories.Category; +053import org.junit.rules.TestName; +054import org.junit.runner.RunWith; +055import org.mockito.ArgumentMatcher; +056import org.mockito.Mock; +057import org.mockito.runners.MockitoJUnitRunner; +058 +059import org.apache.hbase.thirdparty.com.google.common.collect.Iterables; +060 +061@RunWith(MockitoJUnitRunner.class) +062@Category({MediumTests.class}) +063public class TestCanaryTool { +064 +065 @ClassRule +066 public static final HBaseClassTestRule CLASS_RULE = +067 HBaseClassTestRule.forClass(TestCanaryTool.class); +068 +069 private HBaseTestingUtility testingUtility; +070 private static final byte[] FAMILY = Bytes.toBytes("f"); +071 private static final byte[] COLUMN = Bytes.toBytes("col"); +072 +073 @Rule +074 public TestName name = new TestName(); +075 +076 @Before +077 public void setUp() throws Exception { +078 testingUtility = new HBaseTestingUtility(); +079 testingUtility.startMiniCluster(); +080 LogManager.getRootLogger().addAppender(mockAppender); +081 } +082 +083 @After +084 public void tearDown() throws Exception { +085 testingUtility.shutdownMiniCluster(); +086 LogManager.getRootLogger().removeAppender(mockAppender); +087 } +088 +089 @Mock +090 Appender mockAppender; +091 +092 @Test +093 public void testBasicZookeeperCanaryWorks() throws Exception { +094 final String[] args = { "-t", "10000", "-zookeeper" }; +095 testZookeeperCanaryWithArgs(args); +096 } +097 +098 @Test +099 public void testZookeeperCanaryPermittedFailuresArgumentWorks() throws Exception { +100 final String[] args = { "-t", "10000", "-zookeeper", "-treatFailureAsError", "-permittedZookeeperFailures", "1" }; +101 testZookeeperCanaryWithArgs(args); +102 } +103 +104 @Test +105 public void testBasicCanaryWorks() throws Exception { +106 final TableName tableName = TableName.valueOf(name.getMethodName()); +107 Table table = testingUtility.createTable(tableName, new byte[][] { FAMILY }); +108 // insert some test rows +109 for (int i=0; i<1000; i++) { +110 byte[] iBytes = Bytes.toBytes(i); +111 Put p = new Put(iBytes); +112 p.addColumn(FAMILY, COLUMN, iBytes); +113 table.put(p); +114 } +115 ExecutorService executor = new ScheduledThreadPoolExecutor(1); +116 Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink()); +117 Canary canary = new Canary(executor, sink); +118 String[] args = { "-writeSniffing", "-t", "10000", tableName.getNameAsString() }; +119 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); +120 assertEquals("verify no read error count", 0, canary.getReadFailures().size()); +121 assertEquals("verify no write error count", 0, canary.getWriteFailures().size()); +122 verify(sink, atLeastOnce()).publishReadTiming(isA(ServerName.class), isA(RegionInfo.class), +123 isA(ColumnFamilyDescriptor.class), anyLong()); +124 } +125 +126 @Test +127 @Ignore("Intermittent argument matching failures, see HBASE-18813") +128 public void testReadTableTimeouts() throws Exception { +129 final TableName [] tableNames = new TableName[2]; +130 tableNames[0] = TableName.valueOf(name.getMethodName() + "1"); +131 tableNames[1] = TableName.valueOf(name.getMethodName() + "2"); +132 // Create 2 test tables. +133 for (int j = 0; j<2; j++) { +134 Table table = testingUtility.createTable(tableNames[j], new byte[][] { FAMILY }); +135 // insert some test rows +136 for (int i=0; i<1000; i++) { +137 byte[] iBytes = Bytes.toBytes(i + j); +138 Put p = new Put(iBytes); +139 p.addColumn(FAMILY, COLUMN, iBytes); +140 table.put(p); +141 } +142 } +143 ExecutorService executor = new ScheduledThreadPoolExecutor(1); +144 Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink()); +145 Canary canary = new Canary(executor, sink); +146 String configuredTimeoutStr = tableNames[0].getNameAsString() + "=" + Long.MAX_VALUE + "," + +147 tableNames[1].getNameAsString() + "=0"; +148 String[] args = {"-readTableTimeouts", configuredTimeoutStr, name.getMethodName() + "1", +149 name.getMethodName() + "2"}; +150 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); +151 verify(sink, times(tableNames.length)).initializeAndGetReadLatencyForTable(isA(String.class)); +152 for (int i=0; i<2; i++) { +153 assertNotEquals("verify non-null read latency", null, sink.getReadLatencyMap().get(tableNames[i].getNameAsString())); +154 assertNotEquals("verify non-zero read latency", 0L, sink.getReadLatencyMap().get(tableNames[i].getNameAsString())); +155 } +156 // One table's timeout is set for 0 ms and thus, should lead to an error. +157 verify(mockAppender, times(1)).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() { +158 @Override +159 public boolean matches(LoggingEvent argument) { +160 return ((LoggingEvent) argument).getRenderedMessage().contains("exceeded the configured read timeout."); +161 } +162 })); +163 verify(mockAppender, times(2)).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() { +164 @Override +165 public boolean matches(LoggingEvent argument) { +166 return argument.getRenderedMessage().contains("The configured read timeout was"); +167 } +168 })); +169 } +170 +171 @Test +172 @Ignore("Intermittent argument matching failures, see HBASE-18813") +173 public void testWriteTableTimeout() throws Exception { +174 ExecutorService executor = new ScheduledThreadPoolExecutor(1); +175 Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink()); +176 Canary canary = new Canary(executor, sink); +177 String[] args = { "-writeSniffing", "-writeTableTimeout", String.valueOf(Long.MAX_VALUE)}; +178 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); +179 assertNotEquals("verify non-null write latency", null, sink.getWriteLatency()); +180 assertNotEquals("verify non-zero write latency", 0L, sink.getWriteLatency()); +181 verify(mockAppender, times(1)).doAppend(argThat( +182 new ArgumentMatcher<LoggingEvent>() { +183 @Override +184 public boolean matches(LoggingEvent argument) { +185 return argument.getRenderedMessage().contains("The configured write timeout was"); +186 } +187 })); +188 } +189 +190 //no table created, so there should be no regions +191 @Test +192 public void testRegionserverNoRegions() throws Exception { +193 runRegionserverCanary(); +194 verify(mockAppender).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() { +195 @Override +196 public boolean matches(LoggingEvent argument) { +197 return argument.getRenderedMessage().contains("Regionserver not serving any regions"); +198 } +199 })); +200 } +201 +202 //by creating a table, there shouldn't be any region servers not serving any regions +203 @Test +204 public void testRegionserverWithRegions() throws Exception { +205 final TableName tableName = TableName.valueOf(name.getMethodName()); +206 testingUtility.createTable(tableName, new byte[][] { FAMILY }); +207 runRegionserverCanary(); +208 verify(mockAppender, never()).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() { +209 @Override +210 public boolean matches(LoggingEvent argument) { +211 return argument.getRenderedMessage().contains("Regionserver not serving any regions"); +212 } +213 })); +214 } +215 +216 @Test +217 public void testRawScanConfig() throws Exception { +218 final TableName tableName = TableName.valueOf(name.getMethodName()); +219 Table table = testingUtility.createTable(tableName, new byte[][] { FAMILY }); +220 // insert some test rows +221 for (int i=0; i<1000; i++) { +222 byte[] iBytes = Bytes.toBytes(i); +223 Put p = new Put(iBytes); +224 p.addColumn(FAMILY, COLUMN, iBytes); +225 table.put(p); +226 } +227 ExecutorService executor = new ScheduledThreadPoolExecutor(1); +228 Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink()); +229 Canary canary = new Canary(executor, sink); +230 String[] args = { "-t", "10000", name.getMethodName() }; +231 org.apache.hadoop.conf.Configuration conf = +232 new org.apache.hadoop.conf.Configuration(testingUtility.getConfiguration()); +233 conf.setBoolean(HConstants.HBASE_CANARY_READ_RAW_SCAN_KEY, true); +234 assertEquals(0, ToolRunner.run(conf, canary, args)); +235 verify(sink, atLeastOnce()) +236 .publishReadTiming(isA(ServerName.class), isA(RegionInfo.class), +237 isA(ColumnFamilyDescriptor.class), anyLong()); +238 assertEquals("verify no read error count", 0, canary.getReadFailures().size()); +239 } +240 +241 private void runRegionserverCanary() throws Exception { +242 ExecutorService executor = new ScheduledThreadPoolExecutor(1); +243 Canary canary = new Canary(executor, new Canary.RegionServerStdOutSink()); +244 String[] args = { "-t", "10000", "-regionserver"}; +245 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); +246 assertEquals("verify no read error count", 0, canary.getReadFailures().size()); +247 } +248 +249 private void testZookeeperCanaryWithArgs(String[] args) throws Exception { +250 Integer port = +251 Iterables.getOnlyElement(testingUtility.getZkCluster().getClientPortList(), null); +252 testingUtility.getConfiguration().set(HConstants.ZOOKEEPER_QUORUM, +253 "localhost:" + port + "/hbase"); +254 ExecutorService executor = new ScheduledThreadPoolExecutor(2); +255 Canary.ZookeeperStdOutSink sink = spy(new Canary.ZookeeperStdOutSink()); +256 Canary canary = new Canary(executor, sink); +257 assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args)); +258 +259 String baseZnode = testingUtility.getConfiguration() +260 .get(HConstants.ZOOKEEPER_ZNODE_PARENT, HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT); +261 verify(sink, atLeastOnce()) +262 .publishReadTiming(eq(baseZnode), eq("localhost:" + port), anyLong()); +263 } +264}