From 6717f0e3883577513fef8c6cb8a2d0f4b4f41433 Mon Sep 17 00:00:00 2001 From: Enis Soztutar Date: Fri, 17 Jun 2016 18:41:51 -0700 Subject: [PATCH] HBASE-16058 TestHRegion fails on 1.4 builds --- .../apache/hadoop/hbase/regionserver/TestHRegion.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java index 93074e14edc..9aa3a9be618 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java @@ -130,6 +130,7 @@ import org.apache.hadoop.hbase.test.MetricsAssertHelper; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.VerySlowRegionServerTests; import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.hbase.util.ClassSize; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper; import org.apache.hadoop.hbase.util.FSUtils; @@ -452,8 +453,9 @@ public class TestHRegion { fail("Should have failed with IOException"); } catch (IOException expected) { } - assertEquals("memstoreSize should be incremented", onePutSize * 2, region.getMemstoreSize()); - assertEquals("flushable size should be incremented", onePutSize * 2, store.getFlushableSize()); + long expectedSize = onePutSize * 2 - ClassSize.ARRAY; + assertEquals("memstoreSize should be incremented", expectedSize, region.getMemstoreSize()); + assertEquals("flushable size should be incremented", expectedSize, store.getFlushableSize()); region.setCoprocessorHost(null); HBaseTestingUtility.closeRegionAndWAL(region); @@ -523,13 +525,14 @@ public class TestHRegion { p2.add(new KeyValue(row, COLUMN_FAMILY_BYTES, qual2, 2, (byte[])null)); p2.add(new KeyValue(row, COLUMN_FAMILY_BYTES, qual3, 3, (byte[])null)); region.put(p2); - Assert.assertEquals(sizeOfOnePut * 3, region.getMemstoreSize()); + long expectedSize = sizeOfOnePut * 3- ClassSize.ARRAY; + Assert.assertEquals(expectedSize, region.getMemstoreSize()); // Do a successful flush. It will clear the snapshot only. Thats how flushes work. // If already a snapshot, we clear it else we move the memstore to be snapshot and flush // it region.flush(true); // Make sure our memory accounting is right. - Assert.assertEquals(sizeOfOnePut * 2, region.getMemstoreSize()); + Assert.assertEquals(sizeOfOnePut * 2 - ClassSize.ARRAY, region.getMemstoreSize()); } finally { HBaseTestingUtility.closeRegionAndWAL(region); }