From 82ccd6be944fe032dc1ff0a27898870e89179e44 Mon Sep 17 00:00:00 2001 From: Nick Dimiduk Date: Thu, 12 Jun 2014 16:44:55 -0700 Subject: [PATCH] HBASE-11307 Deprecate SlabCache --- .../src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java | 1 + .../java/org/apache/hadoop/hbase/io/hfile/DoubleBlockCache.java | 6 ++++-- .../java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java | 4 +++- .../src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java | 6 ++++-- .../main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java | 6 ++++-- .../apache/hadoop/hbase/io/hfile/slab/SlabItemActionWatcher.java | 5 ++++- src/main/docbkx/book.xml | 4 +++- 7 files changed, 23 insertions(+), 9 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java index de6aec7..f017701 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java @@ -515,6 +515,7 @@ public class CacheConfig { GLOBAL_BLOCK_CACHE_INSTANCE = lruCache; } } else { + LOG.warn("SlabCache is deprecated. Consider BucketCache as a replacement."); GLOBAL_BLOCK_CACHE_INSTANCE = new DoubleBlockCache( lruCacheSize, slabCacheOffHeapCacheSize, blockSize, blockSize, conf); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/DoubleBlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/DoubleBlockCache.java index 558ca20..c7a1c8c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/DoubleBlockCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/DoubleBlockCache.java @@ -35,8 +35,10 @@ import org.apache.hadoop.util.StringUtils; * cache before looking for the block in the off heap cache. Metrics are the * combined size and hits and misses of both caches. * - **/ + * @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}. + */ @InterfaceAudience.Private +@Deprecated public class DoubleBlockCache implements ResizableBlockCache, HeapSize { static final Log LOG = LogFactory.getLog(DoubleBlockCache.class.getName()); @@ -178,4 +180,4 @@ public class DoubleBlockCache implements ResizableBlockCache, HeapSize { public BlockCache[] getBlockCaches() { return new BlockCache [] {this.onHeapCache, this.offHeapCache}; } -} \ No newline at end of file +} diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java index d9494e4..383efcc 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SingleSizeCache.java @@ -51,8 +51,10 @@ import com.google.common.cache.RemovalNotification; * Eviction and LRUness is taken care of by Guava's MapMaker, which creates a * ConcurrentLinkedHashMap. * + * @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}. **/ @InterfaceAudience.Private +@Deprecated public class SingleSizeCache implements BlockCache, HeapSize { private final Slab backingStore; private final ConcurrentMap backingMap; @@ -350,4 +352,4 @@ public class SingleSizeCache implements BlockCache, HeapSize { public BlockCache[] getBlockCaches() { return null; } -} \ No newline at end of file +} diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java index 77bea49..637890f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/Slab.java @@ -33,9 +33,11 @@ import com.google.common.base.Preconditions; * Slab is a class which is designed to allocate blocks of a certain size. * Constructor creates a number of DirectByteBuffers and slices them into the * requisite size, then puts them all in a buffer. - **/ - + * + * @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}. + */ @InterfaceAudience.Private +@Deprecated class Slab implements org.apache.hadoop.hbase.io.HeapSize { static final Log LOG = LogFactory.getLog(Slab.class); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java index 4a264bb..c4056c4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java @@ -57,8 +57,10 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; * *

It is configured with a call to {@link #addSlab(int, int)} * - **/ + * @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}. + */ @InterfaceAudience.Private +@Deprecated public class SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize { private final ConcurrentHashMap backingStore; private final TreeMap slabs; @@ -508,4 +510,4 @@ public class SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize { public BlockCache[] getBlockCaches() { return null; } -} \ No newline at end of file +} diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabItemActionWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabItemActionWatcher.java index fe121de..93b35db 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabItemActionWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabItemActionWatcher.java @@ -24,8 +24,11 @@ import org.apache.hadoop.hbase.io.hfile.BlockCacheKey; /** * Interface for objects that want to know when actions occur in a SingleSizeCache. - * */ + * + * @deprecated As of 1.0, replaced by {@link org.apache.hadoop.hbase.io.hfile.bucket.BucketCache}. + */ @InterfaceAudience.Private +@Deprecated interface SlabItemActionWatcher { /** diff --git a/src/main/docbkx/book.xml b/src/main/docbkx/book.xml index a11acc6..87beac7 100644 --- a/src/main/docbkx/book.xml +++ b/src/main/docbkx/book.xml @@ -1953,7 +1953,8 @@ rs.close(); LruBlockCache is the original implementation, and is entirely within the Java heap. SlabCache and BucketCache are mainly intended for keeping blockcache data offheap, although BucketCache can also keep data onheap and in files. - BucketCache has seen more production deploys and has more deploy options. Fetching + SlabCache is deprecated and will be removed in 1.0! + BucketCache has seen more production deploys and has more deploy options. Fetching will always be slower when fetching from BucketCache or SlabCache, as compared with the native onheap LruBlockCache. However, latencies tend to be less erratic over time, because there is less garbage collection. @@ -2112,6 +2113,7 @@ rs.close(); Offheap Block Cache

Enable SlabCache + SlabCache is deprecated and will be removed in 1.0! SlabCache is originally described in Caching in Apache HBase: SlabCache. Quoting from the API documentation for