001/* 002 * 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019package org.apache.hadoop.hbase.master.normalizer; 020 021import java.util.List; 022import org.apache.hadoop.conf.Configurable; 023import org.apache.hadoop.hbase.TableName; 024import org.apache.hadoop.hbase.master.MasterServices; 025import org.apache.yetus.audience.InterfaceAudience; 026 027/** 028 * Performs "normalization" of regions of a table, making sure that suboptimal 029 * choice of split keys doesn't leave cluster in a situation when some regions are 030 * substantially larger than others for considerable amount of time. 031 * 032 * Users who want to use this feature could either use default {@link SimpleRegionNormalizer} 033 * or plug in their own implementation. Please note that overly aggressive normalization rules 034 * (attempting to make all regions perfectly equal in size) could potentially lead to 035 * "split/merge storms". 036 */ 037@InterfaceAudience.Private 038interface RegionNormalizer extends Configurable { 039 /** 040 * Set the master service. Must be called before first call to 041 * {@link #computePlansForTable(TableName)}. 042 * @param masterServices master services to use 043 */ 044 void setMasterServices(MasterServices masterServices); 045 046 /** 047 * Computes a list of normalizer actions to perform on the target table. This is the primary 048 * entry-point from the Master driving a normalization activity. 049 * @param table table to normalize 050 * @return A list of the normalization actions to perform, or an empty list 051 * if there's nothing to do. 052 */ 053 List<NormalizationPlan> computePlansForTable(TableName table); 054}