Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-26094

In branch-1 L2 BC should not be the victimhandler of L1 BC when using combined BC

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 1.7.2
    • BlockCache
    • None
    • Reviewed

    Description

      Currently in branch-1, the block cache initialisation is:

        LruBlockCache l1 = getL1(conf);
          // blockCacheDisabled is set as a side-effect of getL1Internal(), so check it again after the call.
          if (blockCacheDisabled) return null;
          BlockCache l2 = getL2(conf);
          if (l2 == null) {
            GLOBAL_BLOCK_CACHE_INSTANCE = l1;
          } else {
            boolean useExternal = conf.getBoolean(EXTERNAL_BLOCKCACHE_KEY, EXTERNAL_BLOCKCACHE_DEFAULT);
            boolean combinedWithLru = conf.getBoolean(BUCKET_CACHE_COMBINED_KEY,
              DEFAULT_BUCKET_CACHE_COMBINED);
            if (useExternal) {
              GLOBAL_BLOCK_CACHE_INSTANCE = new InclusiveCombinedBlockCache(l1, l2);
            } else {
              if (combinedWithLru) {
                GLOBAL_BLOCK_CACHE_INSTANCE = new CombinedBlockCache(l1, l2);
              } else {
                // L1 and L2 are not 'combined'.  They are connected via the LruBlockCache victimhandler
                // mechanism.  It is a little ugly but works according to the following: when the
                // background eviction thread runs, blocks evicted from L1 will go to L2 AND when we get
                // a block from the L1 cache, if not in L1, we will search L2.
                GLOBAL_BLOCK_CACHE_INSTANCE = l1;
              }
            }
            l1.setVictimCache(l2);
          }
      

      As the code above, L2 will always be the victimhandler of L1, no matter if we use combined blockcache or not. But as logic (in master & branch-2) L2 should not be the victimhandler of L1 when using combined BC. We should set the victimhandler only when we use InclusiveConbinedBC or we do not use CombinedBC.

      Attachments

        Issue Links

          Activity

            People

              xytss123 Yutong Xiao
              xytss123 Yutong Xiao
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: