HBASE-16058 TestHRegion fails on 1.4 builds

This commit is contained in:
Enis Soztutar 2016-06-17 18:41:51 -07:00
parent bdb0cc8808
commit 6717f0e388
1 changed files with 7 additions and 4 deletions

View File

@ -130,6 +130,7 @@ import org.apache.hadoop.hbase.test.MetricsAssertHelper;
import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.VerySlowRegionServerTests; import org.apache.hadoop.hbase.testclassification.VerySlowRegionServerTests;
import org.apache.hadoop.hbase.util.Bytes; 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.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper; import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper;
import org.apache.hadoop.hbase.util.FSUtils; import org.apache.hadoop.hbase.util.FSUtils;
@ -452,8 +453,9 @@ public class TestHRegion {
fail("Should have failed with IOException"); fail("Should have failed with IOException");
} catch (IOException expected) { } catch (IOException expected) {
} }
assertEquals("memstoreSize should be incremented", onePutSize * 2, region.getMemstoreSize()); long expectedSize = onePutSize * 2 - ClassSize.ARRAY;
assertEquals("flushable size should be incremented", onePutSize * 2, store.getFlushableSize()); assertEquals("memstoreSize should be incremented", expectedSize, region.getMemstoreSize());
assertEquals("flushable size should be incremented", expectedSize, store.getFlushableSize());
region.setCoprocessorHost(null); region.setCoprocessorHost(null);
HBaseTestingUtility.closeRegionAndWAL(region); 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, qual2, 2, (byte[])null));
p2.add(new KeyValue(row, COLUMN_FAMILY_BYTES, qual3, 3, (byte[])null)); p2.add(new KeyValue(row, COLUMN_FAMILY_BYTES, qual3, 3, (byte[])null));
region.put(p2); 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. // 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 // If already a snapshot, we clear it else we move the memstore to be snapshot and flush
// it // it
region.flush(true); region.flush(true);
// Make sure our memory accounting is right. // Make sure our memory accounting is right.
Assert.assertEquals(sizeOfOnePut * 2, region.getMemstoreSize()); Assert.assertEquals(sizeOfOnePut * 2 - ClassSize.ARRAY, region.getMemstoreSize());
} finally { } finally {
HBaseTestingUtility.closeRegionAndWAL(region); HBaseTestingUtility.closeRegionAndWAL(region);
} }