diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java index a36423e..e179999 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java @@ -1147,15 +1147,14 @@ public class BucketCache implements BlockCache, HeapSize { } }; - private int offsetBase; private int length; - private byte offset1; byte deserialiserIndex; private volatile long accessCounter; private BlockPriority priority; // Set this when we were not able to forcefully evict the block private volatile boolean markedForEvict; private AtomicInteger refCount = new AtomicInteger(0); + private long offset; /** * Time this block was cached. Presumes we are created just before we are added to the cache. @@ -1174,16 +1173,11 @@ public class BucketCache implements BlockCache, HeapSize { } long offset() { // Java has no unsigned numbers - long o = ((long) offsetBase) & 0xFFFFFFFF; - o += (((long) (offset1)) & 0xFF) << 32; - return o << 8; + return this.offset; } private void setOffset(long value) { - assert (value & 0xFF) == 0; - value >>= 8; - offsetBase = (int) value; - offset1 = (byte) (value >> 32); + this.offset=value; } public int getLength() { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCache.java index 6fe352d..e982625 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCache.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCache.java @@ -60,10 +60,10 @@ public class TestBucketCache { @Parameterized.Parameters(name = "{index}: blockSize={0}, bucketSizes={1}") public static Iterable data() { return Arrays.asList(new Object[][] { - { 8192, null }, // TODO: why is 8k the default blocksize for these tests? + { 44600, null }, // TODO: why is 8k the default blocksize for these tests? { 16 * 1024, - new int[] { 2 * 1024 + 1024, 4 * 1024 + 1024, 8 * 1024 + 1024, 16 * 1024 + 1024, + new int[] { 2 * 1024 + 1024, 4 * 1024 + 1024,15000,46000,49152,51200, 8 * 1024 + 1024, 16 * 1024 + 1024, 28 * 1024 + 1024, 32 * 1024 + 1024, 64 * 1024 + 1024, 96 * 1024 + 1024, 128 * 1024 + 1024 } } }); } @@ -259,7 +259,7 @@ public class TestBucketCache { // reconfig buckets sizes, the biggest bucket is small than constructedBlockSize (8k or 16k) // so it can't restore cache from file - int[] smallBucketSizes = new int[] { 2 * 1024 + 1024, 4 * 1024 + 1024 }; + int[] smallBucketSizes = new int[] { 2 * 1024 + 1024,3600, 4 * 1024 + 1024,47000 }; bucketCache = new BucketCache("file:" + testDir + "/bucket.cache", capacitySize, constructedBlockSize, smallBucketSizes, writeThreads, writerQLen, testDir + "/bucket.persistence");