HBASE-11307 Deprecate SlabCache

This commit is contained in:
Nick Dimiduk 2014-06-12 16:44:55 -07:00
parent 8e547f3ba7
commit 632301f525
7 changed files with 23 additions and 9 deletions

View File

@ -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);
}

View File

@ -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};
}
}
}

View File

@ -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<BlockCacheKey, CacheablePair> backingMap;
@ -350,4 +352,4 @@ public class SingleSizeCache implements BlockCache, HeapSize {
public BlockCache[] getBlockCaches() {
return null;
}
}
}

View File

@ -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);

View File

@ -57,8 +57,10 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
*
* <p>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<BlockCacheKey, SingleSizeCache> backingStore;
private final TreeMap<Integer, SingleSizeCache> slabs;
@ -508,4 +510,4 @@ public class SlabCache implements SlabItemActionWatcher, BlockCache, HeapSize {
public BlockCache[] getBlockCaches() {
return null;
}
}
}

View File

@ -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 {
/**

View File

@ -1953,7 +1953,8 @@ rs.close();
<para>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.</para>
<para> BucketCache has seen more production deploys and has more deploy options. Fetching
<para><emphasis>SlabCache is deprecated and will be removed in 1.0!</emphasis></para>
<para>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.</para>
@ -2112,6 +2113,7 @@ rs.close();
<title>Offheap Block Cache</title>
<section>
<title>Enable SlabCache</title>
<para><emphasis>SlabCache is deprecated and will be removed in 1.0!</emphasis></para>
<para> SlabCache is originally described in <link
xlink:href="http://blog.cloudera.com/blog/2012/01/caching-in-hbase-slabcache/">Caching
in Apache HBase: SlabCache</link>. Quoting from the API documentation for <link