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.master.normalizer;
019
020import java.util.List;
021import org.apache.hadoop.conf.Configurable;
022import org.apache.hadoop.hbase.client.TableDescriptor;
023import org.apache.hadoop.hbase.master.MasterServices;
024import org.apache.yetus.audience.InterfaceAudience;
025
026/**
027 * Performs "normalization" of regions of a table, making sure that suboptimal choice of split keys
028 * doesn't leave cluster in a situation when some regions are substantially larger than others for
029 * considerable amount of time. Users who want to use this feature could either use default
030 * {@link SimpleRegionNormalizer} or plug in their own implementation. Please note that overly
031 * aggressive normalization rules (attempting to make all regions perfectly equal in size) could
032 * potentially lead to "split/merge storms".
033 */
034@InterfaceAudience.Private
035interface RegionNormalizer extends Configurable {
036  /**
037   * Set the master service. Must be called before first call to
038   * {@link #computePlansForTable(TableDescriptor)}.
039   * @param masterServices master services to use
040   */
041  void setMasterServices(MasterServices masterServices);
042
043  /**
044   * Computes a list of normalizer actions to perform on the target table. This is the primary
045   * entry-point from the Master driving a normalization activity.
046   * @param tableDescriptor table descriptor for table which needs normalize
047   * @return A list of the normalization actions to perform, or an empty list if there's nothing to
048   *         do.
049   */
050  List<NormalizationPlan> computePlansForTable(TableDescriptor tableDescriptor);
051}