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

CF Level BC setting should override global one.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 2.0.0
    • Fix Version/s: None
    • Component/s: BlockCache
    • Labels:
      None
    • External issue ID:
      14178

      Description

      The original description is ambiguous. I think i will rewrite it.
      Let's see BlockCache constructor firstly

        public CacheConfig(Configuration conf, HColumnDescriptor family) {
          this(CacheConfig.instantiateBlockCache(conf),
              family.isBlockCacheEnabled(),
              family.isInMemory(),
              // For the following flags we enable them regardless of per-schema settings
              // if they are enabled in the global configuration.
              conf.getBoolean(CACHE_BLOCKS_ON_WRITE_KEY,
                  DEFAULT_CACHE_DATA_ON_WRITE) || family.isCacheDataOnWrite(),
              conf.getBoolean(CACHE_INDEX_BLOCKS_ON_WRITE_KEY,
                  DEFAULT_CACHE_INDEXES_ON_WRITE) || family.isCacheIndexesOnWrite(),
              conf.getBoolean(CACHE_BLOOM_BLOCKS_ON_WRITE_KEY,
                  DEFAULT_CACHE_BLOOMS_ON_WRITE) || family.isCacheBloomsOnWrite(),
              conf.getBoolean(EVICT_BLOCKS_ON_CLOSE_KEY,
                  DEFAULT_EVICT_ON_CLOSE) || family.isEvictBlocksOnClose(),
              conf.getBoolean(CACHE_DATA_BLOCKS_COMPRESSED_KEY, DEFAULT_CACHE_DATA_COMPRESSED),
              conf.getBoolean(PREFETCH_BLOCKS_ON_OPEN_KEY,
                  DEFAULT_PREFETCH_ON_OPEN) || family.isPrefetchBlocksOnOpen(),
              conf.getBoolean(HColumnDescriptor.CACHE_DATA_IN_L1,
                  HColumnDescriptor.DEFAULT_CACHE_DATA_IN_L1) || family.isCacheDataInL1(),
              conf.getBoolean(DROP_BEHIND_CACHE_COMPACTION_KEY,DROP_BEHIND_CACHE_COMPACTION_DEFAULT)
           );
        }
      

      If we dig in it, we will see CacheConfig.cacheDataOnRead is used to accept family.isBlockCacheEnabled().
      I think it is confused as comments about cacheDataOnRead

        /**
         * Whether blocks should be cached on read (default is on if there is a
         * cache but this can be turned off on a per-family or per-request basis).
         * If off we will STILL cache meta blocks; i.e. INDEX and BLOOM types.
         * This cannot be disabled.
         */
        private boolean cacheDataOnRead;
      

      So i think we should use another variable to represent for family.isBlockCacheEnabled().

      The secondary point is we use 'or' to decide cacheDataOnWrite is on/off when both CF and global has this setting.

      conf.getBoolean(CACHE_BLOCKS_ON_WRITE_KEY,
                  DEFAULT_CACHE_DATA_ON_WRITE) || family.isCacheDataOnWrite()
      

      IMO we should use CF Level setting to override global setting.

        Attachments

        1. HBASE-14189_v1.patch
          13 kB
          Heng Chen
        2. HBASE-14189_v2.patch
          15 kB
          Heng Chen
        3. HBASE-14189_v3.patch
          15 kB
          Heng Chen
        4. HBASE-14189_v4.patch
          27 kB
          Heng Chen
        5. HBASE-14189_v5.patch
          27 kB
          Heng Chen
        6. HBASE-14189_v6.patch
          25 kB
          Heng Chen
        7. HBASE-14189_v7.patch
          25 kB
          Heng Chen
        8. HBASE-14189.patch
          36 kB
          Heng Chen

          Issue Links

            Activity

              People

              • Assignee:
                chenheng Heng Chen
                Reporter:
                chenheng Heng Chen
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: