001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.regionserver; 019 020import static org.apache.hadoop.hbase.regionserver.DefaultStoreEngine.DEFAULT_COMPACTION_POLICY_CLASS_KEY; 021 022import java.io.IOException; 023import org.apache.hadoop.conf.Configuration; 024import org.apache.hadoop.hbase.CellComparator; 025import org.apache.hadoop.hbase.CompoundConfiguration; 026import org.apache.hadoop.hbase.regionserver.compactions.CustomDateTieredCompactionPolicy; 027import org.apache.hadoop.hbase.regionserver.compactions.CustomTieredCompactor; 028import org.apache.yetus.audience.InterfaceAudience; 029 030/** 031 * Extension of {@link DateTieredStoreEngine} that uses a pluggable value provider for extracting 032 * the value to be used for comparison in this tiered compaction. Differently from the existing Date 033 * Tiered Compaction, this doesn't yield multiple tiers or files, but rather provides two tiers 034 * based on a configurable “cut-off” age. All rows with the cell tiering value older than this 035 * “cut-off” age would be placed together in an “old” tier, whilst younger rows would go to a 036 * separate, “young” tier file. 037 */ 038@InterfaceAudience.Private 039public class CustomTieredStoreEngine extends DateTieredStoreEngine { 040 041 @Override 042 protected void createComponents(Configuration conf, HStore store, CellComparator kvComparator) 043 throws IOException { 044 CompoundConfiguration config = new CompoundConfiguration(); 045 config.add(conf); 046 config.add(store.conf); 047 config.set(DEFAULT_COMPACTION_POLICY_CLASS_KEY, 048 CustomDateTieredCompactionPolicy.class.getName()); 049 createCompactionPolicy(config, store); 050 this.storeFileManager = new DefaultStoreFileManager(kvComparator, 051 StoreFileComparators.SEQ_ID_MAX_TIMESTAMP, config, compactionPolicy.getConf()); 052 this.storeFlusher = new DefaultStoreFlusher(config, store); 053 this.compactor = new CustomTieredCompactor(config, store); 054 } 055 056}