.../src/main/java/org/apache/hadoop/hbase/regionserver/Chunk.java | 2 +- .../java/org/apache/hadoop/hbase/regionserver/OffheapChunk.java | 2 +- .../java/org/apache/hadoop/hbase/regionserver/OnheapChunk.java | 2 +- .../org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java | 4 ++-- .../org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java | 8 ++++---- .../hadoop/hbase/regionserver/TestMemstoreLABWithoutPool.java | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Chunk.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Chunk.java index fc4aa0b..dfeb246 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Chunk.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Chunk.java @@ -101,7 +101,7 @@ public abstract class Chunk { } // Mark that it's ready for use // Move 8 bytes since the first 8 bytes are having the chunkid in it - boolean initted = nextFreeOffset.compareAndSet(UNINITIALIZED, Bytes.SIZEOF_LONG); + boolean initted = nextFreeOffset.compareAndSet(UNINITIALIZED, Bytes.SIZEOF_INT); // We should always succeed the above CAS since only one thread // calls init()! Preconditions.checkState(initted, "Multiple threads tried to init same chunk"); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/OffheapChunk.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/OffheapChunk.java index e244a33..f5d4905 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/OffheapChunk.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/OffheapChunk.java @@ -41,7 +41,7 @@ public class OffheapChunk extends Chunk { void allocateDataBuffer() { if (data == null) { data = ByteBuffer.allocateDirect(this.size); - data.putLong(0, this.getId()); + data.putInt(0, this.getId()); } } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/OnheapChunk.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/OnheapChunk.java index da34e24..38001ea 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/OnheapChunk.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/OnheapChunk.java @@ -39,7 +39,7 @@ public class OnheapChunk extends Chunk { void allocateDataBuffer() { if (data == null) { data = ByteBuffer.allocate(this.size); - data.putLong(0, this.getId()); + data.putInt(0, this.getId()); } } } \ No newline at end of file diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java index 41b304b..c2e2925 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java @@ -140,8 +140,8 @@ public class TestDefaultMemStore { // make sure chunk size increased even when writing the same cell, if using MSLAB if (msLab instanceof MemStoreLABImpl) { // since we add the chunkID at the 0th offset of the chunk and the - // chunkid is a long we need to account for those 8 bytes - assertEquals(2 * Segment.getCellLength(kv) + Bytes.SIZEOF_LONG, + // chunkid is a long we need to account for those 4 bytes + assertEquals(2 * Segment.getCellLength(kv) + Bytes.SIZEOF_INT, ((MemStoreLABImpl) msLab).getCurrentChunk().getNextFreeOffset()); } } else { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java index 63e63ea..ebd5422 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java @@ -87,10 +87,10 @@ public class TestMemStoreLAB { ByteBufferKeyValue newKv = (ByteBufferKeyValue) mslab.copyCellInto(kv); if (newKv.getBuffer() != lastBuffer) { // since we add the chunkID at the 0th offset of the chunk and the - // chunkid is a long we need to account for those 8 bytes - expectedOff = Bytes.SIZEOF_LONG; + // chunkid is a long we need to account for those 4 bytes + expectedOff = Bytes.SIZEOF_INT; lastBuffer = newKv.getBuffer(); - long chunkId = newKv.getBuffer().getLong(0); + int chunkId = newKv.getBuffer().getInt(0); assertTrue("chunkid should be different", chunkId != lastChunkId); lastChunkId = chunkId; } @@ -173,7 +173,7 @@ public class TestMemStoreLAB { for (Map allocsInChunk : mapsByChunk.values()) { // since we add the chunkID at the 0th offset of the chunk and the // chunkid is a long we need to account for those 8 bytes - int expectedOff = Bytes.SIZEOF_LONG; + int expectedOff = Bytes.SIZEOF_INT; for (AllocRecord alloc : allocsInChunk.values()) { assertEquals(expectedOff, alloc.offset); assertTrue("Allocation overruns buffer", diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemstoreLABWithoutPool.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemstoreLABWithoutPool.java index 1af98e9..d3a09ee 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemstoreLABWithoutPool.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemstoreLABWithoutPool.java @@ -78,9 +78,9 @@ public class TestMemstoreLABWithoutPool { if (newKv.getBuffer() != lastBuffer) { // since we add the chunkID at the 0th offset of the chunk and the // chunkid is a long we need to account for those 8 bytes - expectedOff = Bytes.SIZEOF_LONG; + expectedOff = Bytes.SIZEOF_INT; lastBuffer = newKv.getBuffer(); - long chunkId = newKv.getBuffer().getLong(0); + int chunkId = newKv.getBuffer().getInt(0); assertTrue("chunkid should be different", chunkId != lastChunkId); lastChunkId = chunkId; }