HBASE-15005 Use value array in computing block length for 1.2 and 1.3
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4bfeccb8 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4bfeccb8 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4bfeccb8 Branch: refs/heads/hbase-12439 Commit: 4bfeccb87a94cfe232ea8fc9a6f40ff5b8d3b1c5 Parents: 408666a Author: Elliott Clark <[email protected]> Authored: Thu Dec 17 23:36:43 2015 -0800 Committer: Elliott Clark <[email protected]> Committed: Fri Dec 18 00:23:02 2015 -0800 ---------------------------------------------------------------------- .../hbase/client/TestMultiRespectsLimits.java | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/4bfeccb8/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java index 28e1855..04c592e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java @@ -20,9 +20,12 @@ package org.apache.hadoop.hbase.client; import org.apache.hadoop.hbase.CompatibilityFactory; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Waiter; +import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding; import org.apache.hadoop.hbase.ipc.RpcServerInterface; import org.apache.hadoop.hbase.metrics.BaseSource; import org.apache.hadoop.hbase.regionserver.HRegionServer; @@ -110,7 +113,12 @@ public class TestMultiRespectsLimits { @Test public void testBlockMultiLimits() throws Exception { final TableName name = TableName.valueOf("testBlockMultiLimits"); - Table t = TEST_UTIL.createTable(name, FAMILY); + HTableDescriptor desc = new HTableDescriptor(name); + HColumnDescriptor hcd = new HColumnDescriptor(FAMILY); + hcd.setDataBlockEncoding(DataBlockEncoding.FAST_DIFF); + desc.addFamily(hcd); + TEST_UTIL.getHBaseAdmin().createTable(desc); + Table t = TEST_UTIL.getConnection().getTable(name); final HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(0); RpcServerInterface rpcServer = regionServer.getRpcServer(); @@ -122,14 +130,16 @@ public class TestMultiRespectsLimits { byte[][] cols = new byte[][]{ Bytes.toBytes("0"), // Get this Bytes.toBytes("1"), // Buffer - Bytes.toBytes("2"), // Get This - Bytes.toBytes("3"), // Buffer + Bytes.toBytes("2"), // Buffer + Bytes.toBytes("3"), // Get This + Bytes.toBytes("4"), // Buffer + Bytes.toBytes("5"), // Buffer }; // Set the value size so that one result will be less than the MAX_SIE // however the block being reference will be larger than MAX_SIZE. // This should cause the regionserver to try and send a result immediately. - byte[] value = new byte[MAX_SIZE - 200]; + byte[] value = new byte[MAX_SIZE - 100]; ThreadLocalRandom.current().nextBytes(value); for (byte[] col:cols) { @@ -155,7 +165,7 @@ public class TestMultiRespectsLimits { gets.add(g0); Get g2 = new Get(row); - g2.addColumn(FAMILY, cols[2]); + g2.addColumn(FAMILY, cols[3]); gets.add(g2); Result[] results = t.get(gets);
