ramkrish86 commented on a change in pull request #868: HBASE-23296 Add 
CompositeBucketCache to support tiered BC
URL: https://github.com/apache/hbase/pull/868#discussion_r349533873
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheFactory.java
 ##########
 @@ -110,29 +113,35 @@ public static BlockCache createBlockCache(Configuration 
conf) {
           + "we will remove the deprecated config.", 
DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY,
         BLOCKCACHE_BLOCKSIZE_KEY);
     }
-    FirstLevelBlockCache l1Cache = createFirstLevelCache(conf);
+    BlockCache l1Cache = createFirstLevelCache(conf);
     if (l1Cache == null) {
       return null;
     }
-    boolean useExternal = conf.getBoolean(EXTERNAL_BLOCKCACHE_KEY, 
EXTERNAL_BLOCKCACHE_DEFAULT);
-    if (useExternal) {
-      BlockCache l2CacheInstance = createExternalBlockcache(conf);
-      return l2CacheInstance == null ?
-          l1Cache :
-          new InclusiveCombinedBlockCache(l1Cache, l2CacheInstance);
+    if (conf.getBoolean(EXTERNAL_BLOCKCACHE_KEY, EXTERNAL_BLOCKCACHE_DEFAULT)) 
{
+      BlockCache l2Cache = createExternalBlockcache(conf);
+      return l2Cache == null ? l1Cache : new InclusiveCombinedBlockCache(
+          (FirstLevelBlockCache)l1Cache, l2Cache);
     } else {
       // otherwise use the bucket cache.
-      BucketCache bucketCache = createBucketCache(conf);
-      if (!conf.getBoolean("hbase.bucketcache.combinedcache.enabled", true)) {
-        // Non combined mode is off from 2.0
-        LOG.warn(
-            "From HBase 2.0 onwards only combined mode of LRU cache and bucket 
cache is available");
+      BucketCache l2Cache = createBucketCache(conf, CacheLevel.L2);
+      if (conf.getBoolean(BUCKET_CACHE_COMPOSITE_KEY, false)) {
+        return l2Cache == null ? l1Cache : new 
CompositeBucketCache((BucketCache)l1Cache, l2Cache);
+      } else {
+        if (!conf.getBoolean("hbase.bucketcache.combinedcache.enabled", true)) 
{
+          // Non combined mode is off from 2.0
+          LOG.warn("From HBase 2.0 onwards only combined mode of LRU cache and 
bucket"
+              + " cache is available");
+        }
+        return l2Cache == null ? l1Cache : new CombinedBlockCache(
+            (FirstLevelBlockCache)l1Cache, l2Cache);
       }
-      return bucketCache == null ? l1Cache : new CombinedBlockCache(l1Cache, 
bucketCache);
     }
   }
 
-  private static FirstLevelBlockCache createFirstLevelCache(final 
Configuration c) {
+  private static BlockCache createFirstLevelCache(final Configuration c) {
+    if (c.getBoolean(BUCKET_CACHE_COMPOSITE_KEY, false)) {
+      return createBucketCache(c, CacheLevel.L1);
 
 Review comment:
   So L1 can be offheap - I mean the engine type and L2 is a seperate bucket 
cache and so it can be on file also? If both has to be offheap - we should 
recommend the memory usage part also. Say how much % will be good for L1 and 
how much for L2.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to