HBASE-3857 Fix TestHFileBlock.testBlockHeapSize test failure (Mikhail)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1153718 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-08-04 01:20:49 +00:00
parent 95c32d4c37
commit 3633f06b50
2 changed files with 6 additions and 1 deletions

View File

@ -184,6 +184,7 @@ Release 0.91.0 - Unreleased
HBASE-4032 HBASE-451 improperly breaks public API HRegionInfo#getTableDesc
HBASE-4148 HFileOutputFormat doesn't fill in TIMERANGE_KEY metadata (Jonathan Hsieh)
HBASE-4003 Cleanup Calls Conservatively On Timeout (Karthick)
HBASE-3857 Fix TestHFileBlock.testBlockHeapSize test failure (Mikhail)
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -482,12 +482,16 @@ public class TestHFileBlock {
@Test
public void testBlockHeapSize() {
// We have seen multiple possible values for this estimate of the heap size
// of a ByteBuffer, presumably depending on the JDK version.
assertTrue(HFileBlock.BYTE_BUFFER_HEAP_SIZE == 64 ||
HFileBlock.BYTE_BUFFER_HEAP_SIZE == 80);
for (int size : new int[] { 100, 256, 12345 }) {
byte[] byteArr = new byte[HFileBlock.HEADER_SIZE + size];
ByteBuffer buf = ByteBuffer.wrap(byteArr, 0, size);
HFileBlock block = new HFileBlock(BlockType.DATA, size, size, -1, buf,
true, -1);
assertEquals(80, HFileBlock.BYTE_BUFFER_HEAP_SIZE);
long expected = ClassSize.align(ClassSize.estimateBase(HFileBlock.class,
true)
+ ClassSize.estimateBase(buf.getClass(), true)