Repository: hbase Updated Branches: refs/heads/0.98 20d4c43e8 -> a3a6487d6
HBASE-12393 The regionserver web will throw exception if we disable block cache (ChiaPing Tsai) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a3a6487d Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a3a6487d Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a3a6487d Branch: refs/heads/0.98 Commit: a3a6487d6170754fcee670f4d2414055342e6144 Parents: 20d4c43 Author: Enis Soztutar <[email protected]> Authored: Wed Jan 21 17:22:10 2015 -0800 Committer: Enis Soztutar <[email protected]> Committed: Wed Jan 21 17:31:02 2015 -0800 ---------------------------------------------------------------------- .../hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon | 2 +- .../hadoop/hbase/regionserver/TestRSStatusServlet.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/a3a6487d/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon index be0b5e0..8c71e83 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon @@ -174,7 +174,7 @@ org.apache.hadoop.util.StringUtils; <%args> CacheConfig cacheConfig; </%args> -<%if cacheConfig == null %> +<%if cacheConfig == null || cacheConfig.getBlockCache() == null %> <p>CacheConfig is null</p> <%else> <table class="table table-striped"> http://git-wip-us.apache.org/repos/asf/hbase/blob/a3a6487d/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java index 42f23c3..5a12eb2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java @@ -44,12 +44,17 @@ import org.mockito.Mockito; import com.google.common.collect.Lists; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.io.hfile.CacheConfig; /** * Tests for the region server status page and its template. */ @Category(SmallTests.class) public class TestRSStatusServlet { + private static final Log LOG = LogFactory.getLog(TestRSStatusServlet.class); private HRegionServer rs; static final int FAKE_IPC_PORT = 1585; @@ -75,6 +80,12 @@ public class TestRSStatusServlet { Mockito.doReturn("fakequorum").when(zkw).getQuorum(); Mockito.doReturn(zkw).when(rs).getZooKeeper(); + // Fake CacheConfig + LOG.warn("The " + HConstants.HFILE_BLOCK_CACHE_SIZE_KEY + " is set to 0"); + CacheConfig cacheConf = Mockito.mock(CacheConfig.class); + Mockito.doReturn(null).when(cacheConf).getBlockCache(); + Mockito.doReturn(cacheConf).when(rs).getCacheConfig(); + // Fake MasterAddressTracker MasterAddressTracker mat = Mockito.mock(MasterAddressTracker.class); Mockito.doReturn(fakeMasterAddress).when(mat).getMasterAddress();
