hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stack <st...@duboce.net>
Subject Re: hbase git commit: HBASE-15073 Revert due to different opinion on usefulness
Date Tue, 19 Jan 2016 04:52:33 GMT
The commit message is wrong in the below. It misrepresents.

>From the issue:

The -1 is because no case was made for why we need this feature. Usually
folks show up w/ some numbers or a graph or some reasoning as to why
something is needed. In here there is none of that; there is 'certain use
cases' that go unspecified and then when pushed, some rambling about ambari
metrics server with no timelines or measure of what is being addressed or
fit criteria as to what would make ambari-case happy.

St.Ack


On Mon, Jan 18, 2016 at 5:11 PM, <tedyu@apache.org> wrote:

> Repository: hbase
> Updated Branches:
>   refs/heads/branch-1.2 c4bcaa3f6 -> 5ff65455c
>
>
> HBASE-15073 Revert due to different opinion on usefulness
>
>
> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
> Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5ff65455
> Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5ff65455
> Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5ff65455
>
> Branch: refs/heads/branch-1.2
> Commit: 5ff65455c60dbf56fc92630e75d93d7840dde537
> Parents: c4bcaa3
> Author: tedyu <yuzhihong@gmail.com>
> Authored: Mon Jan 18 17:11:32 2016 -0800
> Committer: tedyu <yuzhihong@gmail.com>
> Committed: Mon Jan 18 17:11:32 2016 -0800
>
> ----------------------------------------------------------------------
>  .../apache/hadoop/hbase/HTableDescriptor.java   | 60 +++++++-------------
>  .../hbase/normalizer/NormalizationPlan.java     | 45 ---------------
>  .../org/apache/hadoop/hbase/master/HMaster.java | 20 ++-----
>  .../normalizer/EmptyNormalizationPlan.java      |  6 --
>  .../normalizer/MergeNormalizationPlan.java      |  6 --
>  .../master/normalizer/NormalizationPlan.java    | 35 ++++++++++++
>  .../master/normalizer/RegionNormalizer.java     |  5 +-
>  .../normalizer/SimpleRegionNormalizer.java      | 11 ++--
>  .../normalizer/SplitNormalizationPlan.java      |  6 --
>  .../normalizer/TestSimpleRegionNormalizer.java  | 48 ++++------------
>  .../TestSimpleRegionNormalizerOnCluster.java    |  4 +-
>  hbase-shell/src/main/ruby/hbase/admin.rb        |  5 +-
>  .../src/main/ruby/shell/commands/normalize.rb   |  2 +-
>  .../ruby/shell/commands/normalizer_switch.rb    |  3 +-
>  14 files changed, 84 insertions(+), 172 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
> b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
> index dfb56e4..a6c08c3 100644
> ---
> a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
> +++
> b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
> @@ -44,8 +44,6 @@ import org.apache.hadoop.fs.Path;
>  import org.apache.hadoop.hbase.client.Durability;
>  import org.apache.hadoop.hbase.client.RegionReplicaUtil;
>  import org.apache.hadoop.hbase.exceptions.DeserializationException;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan.PlanType;
>  import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
>  import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
>  import
> org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BytesBytesPair;
> @@ -203,14 +201,13 @@ public class HTableDescriptor implements
> WritableComparable<HTableDescriptor> {
>
>    /**
>     * <em>INTERNAL</em> Used by shell/rest interface to access this
> metadata
> -   * attribute which denotes the allowed types of action (split/merge)
> when the table is treated
> -   * by region normalizer.
> +   * attribute which denotes if the table should be treated by region
> normalizer.
>     *
> -   * @see #getDesiredNormalizationTypes()
> +   * @see #isNormalizationEnabled()
>     */
> -  public static final String NORMALIZATION_MODE = "NORMALIZATION_MODE";
> -  private static final ImmutableBytesWritable NORMALIZATION_MODE_KEY =
> -      new ImmutableBytesWritable(Bytes.toBytes(NORMALIZATION_MODE));
> +  public static final String NORMALIZATION_ENABLED =
> "NORMALIZATION_ENABLED";
> +  private static final ImmutableBytesWritable NORMALIZATION_ENABLED_KEY =
> +    new ImmutableBytesWritable(Bytes.toBytes(NORMALIZATION_ENABLED));
>
>    /** Default durability for HTD is USE_DEFAULT, which defaults to
> HBase-global default value */
>    private static final Durability DEFAULT_DURABLITY =
> Durability.USE_DEFAULT;
> @@ -239,6 +236,11 @@ public class HTableDescriptor implements
> WritableComparable<HTableDescriptor> {
>    public static final boolean DEFAULT_COMPACTION_ENABLED = true;
>
>    /**
> +   * Constant that denotes whether the table is normalized by default.
> +   */
> +  public static final boolean DEFAULT_NORMALIZATION_ENABLED = false;
> +
> +  /**
>     * Constant that denotes the maximum default size of the memstore after
> which
>     * the contents are flushed to the store files
>     */
> @@ -262,7 +264,7 @@ public class HTableDescriptor implements
> WritableComparable<HTableDescriptor> {
>          String.valueOf(DEFAULT_DEFERRED_LOG_FLUSH));
>      DEFAULT_VALUES.put(DURABILITY, DEFAULT_DURABLITY.name()); //use the
> enum name
>      DEFAULT_VALUES.put(REGION_REPLICATION,
> String.valueOf(DEFAULT_REGION_REPLICATION));
> -    DEFAULT_VALUES.put(NORMALIZATION_MODE, "");
> +    DEFAULT_VALUES.put(NORMALIZATION_ENABLED,
> String.valueOf(DEFAULT_NORMALIZATION_ENABLED));
>      for (String s : DEFAULT_VALUES.keySet()) {
>        RESERVED_KEYWORDS.add(new ImmutableBytesWritable(Bytes.toBytes(s)));
>      }
> @@ -655,42 +657,22 @@ public class HTableDescriptor implements
> WritableComparable<HTableDescriptor> {
>    }
>
>    /**
> -   * Check if normalization flag of the table. If flag is
> -   * empty then region normalizer won't attempt to normalize this table.
> +   * Check if normalization enable flag of the table is true. If flag is
> +   * false then no region normalizer won't attempt to normalize this
> table.
>     *
> -   * @return List of PlanType if region normalization is enabled for this
> table
> -   *         null means region normalization is disabled
> +   * @return true if region normalization is enabled for this table
>     */
> -  public List<PlanType> getDesiredNormalizationTypes() {
> -    byte [] value = getValue(NORMALIZATION_MODE_KEY);
> -    if (value == null) {
> -      return null;
> -    }
> -    String strValue = Bytes.toString(value);
> -    if (strValue.isEmpty()) {
> -      return null;
> -    }
> -    List<NormalizationPlan.PlanType> types = new ArrayList<>();
> -    if (strValue.toUpperCase().contains("M")) {
> -      types.add(PlanType.MERGE);
> -    }
> -    if (strValue.toUpperCase().contains("S")) {
> -      types.add(PlanType.SPLIT);
> -    }
> -    return types;
> +  public boolean isNormalizationEnabled() {
> +    return isSomething(NORMALIZATION_ENABLED_KEY,
> DEFAULT_NORMALIZATION_ENABLED);
>    }
>
>    /**
> -   * Setting the types of action for table normalization mode flag.
> +   * Setting the table normalization enable flag.
>     *
> -   * @param types String containing desired types of action:
> -   *        "M" for region merge
> -   *        "S" for region split
> -   *        "MS" for region merge / split
> -   */
> -  public HTableDescriptor setNormalizationMode(final String types) {
> -    setValue(NORMALIZATION_MODE_KEY, types == null || types.isEmpty() ?
> null :
> -      new ImmutableBytesWritable(Bytes.toBytes(types.toUpperCase())));
> +   * @param isEnable True if enable normalization.
> +   */
> +  public HTableDescriptor setNormalizationEnabled(final boolean isEnable)
> {
> +    setValue(NORMALIZATION_ENABLED_KEY, isEnable ? TRUE : FALSE);
>      return this;
>    }
>
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-client/src/main/java/org/apache/hadoop/hbase/normalizer/NormalizationPlan.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-client/src/main/java/org/apache/hadoop/hbase/normalizer/NormalizationPlan.java
> b/hbase-client/src/main/java/org/apache/hadoop/hbase/normalizer/NormalizationPlan.java
> deleted file mode 100644
> index 66481e6..0000000
> ---
> a/hbase-client/src/main/java/org/apache/hadoop/hbase/normalizer/NormalizationPlan.java
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -/**
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements.  See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership.  The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License.  You may obtain a copy of the License at
> - *
> - *     http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing, software
> - * distributed under the License is distributed on an "AS IS" BASIS,
> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> - * See the License for the specific language governing permissions and
> - * limitations under the License.
> - */
> -package org.apache.hadoop.hbase.normalizer;
> -
> -import org.apache.hadoop.hbase.classification.InterfaceAudience;
> -import org.apache.hadoop.hbase.client.Admin;
> -
> -/**
> - * Interface for normalization plan.
> - */
> -@InterfaceAudience.Private
> -public interface NormalizationPlan {
> -  enum PlanType {
> -    SPLIT,
> -    MERGE,
> -    NONE
> -  }
> -
> -  /**
> -   * Executes normalization plan on cluster (does actual
> splitting/merging work).
> -   * @param admin instance of Admin
> -   */
> -  void execute(Admin admin);
> -
> -  /**
> -   * @return the type of this plan
> -   */
> -  PlanType getType();
> -}
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
> index 2acaf64..5fff011 100644
> ---
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
> +++
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
> @@ -114,8 +114,7 @@ import
> org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
>  import org.apache.hadoop.hbase.monitoring.MemoryBoundedLogMessageBuffer;
>  import org.apache.hadoop.hbase.monitoring.MonitoredTask;
>  import org.apache.hadoop.hbase.monitoring.TaskMonitor;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan.PlanType;
> +import org.apache.hadoop.hbase.master.normalizer.NormalizationPlan;
>  import org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost;
>  import
> org.apache.hadoop.hbase.procedure.flush.MasterFlushTableProcedureManager;
>  import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
> @@ -1341,20 +1340,13 @@ public class HMaster extends HRegionServer
> implements MasterServices, Server {
>            LOG.debug("Skipping normalizing " + table + " since its
> namespace has quota");
>            continue;
>          }
> -        if (table.isSystemTable()) {
> -          LOG.debug("Skipping normalization for table: " + table + ", as
> it's system table");
> +        if (table.isSystemTable() || (getTableDescriptors().get(table) !=
> null &&
> +            !getTableDescriptors().get(table).isNormalizationEnabled())) {
> +          LOG.debug("Skipping normalization for table: " + table + ", as
> it's either system"
> +              + " table or doesn't have auto normalization turned on");
>            continue;
>          }
> -        List<PlanType> types = null;
> -        if (getTableDescriptors().get(table) != null) {
> -          types =
> getTableDescriptors().get(table).getDesiredNormalizationTypes();
> -          if (types == null) {
> -            LOG.debug("Skipping normalization for table: " + table + ",
> as it's either system"
> -                + " table or doesn't have auto normalization turned on");
> -            continue;
> -          }
> -        }
> -        List<NormalizationPlan> plans =
> this.normalizer.computePlanForTable(table, types);
> +        List<NormalizationPlan> plans =
> this.normalizer.computePlanForTable(table);
>          if (plans != null) {
>            for (NormalizationPlan plan : plans) {
>              plan.execute(clusterConnection.getAdmin());
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/EmptyNormalizationPlan.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/EmptyNormalizationPlan.java
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/EmptyNormalizationPlan.java
> index 29cc0c3..a36dd07 100644
> ---
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/EmptyNormalizationPlan.java
> +++
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/EmptyNormalizationPlan.java
> @@ -20,7 +20,6 @@ package org.apache.hadoop.hbase.master.normalizer;
>
>  import org.apache.hadoop.hbase.classification.InterfaceAudience;
>  import org.apache.hadoop.hbase.client.Admin;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan;
>
>  /**
>   * Plan which signifies that no normalization is required,
> @@ -46,9 +45,4 @@ public final class EmptyNormalizationPlan implements
> NormalizationPlan {
>    @Override
>    public void execute(Admin admin) {
>    }
> -
> -  @Override
> -  public PlanType getType() {
> -    return PlanType.NONE;
> -  }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java
> index f3ce1d5..08a58a5 100644
> ---
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java
> +++
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java
> @@ -23,7 +23,6 @@ import org.apache.commons.logging.LogFactory;
>  import org.apache.hadoop.hbase.HRegionInfo;
>  import org.apache.hadoop.hbase.classification.InterfaceAudience;
>  import org.apache.hadoop.hbase.client.Admin;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan;
>
>  import java.io.IOException;
>
> @@ -42,11 +41,6 @@ public class MergeNormalizationPlan implements
> NormalizationPlan {
>      this.secondRegion = secondRegion;
>    }
>
> -  @Override
> -  public PlanType getType() {
> -    return PlanType.MERGE;
> -  }
> -
>    HRegionInfo getFirstRegion() {
>      return firstRegion;
>    }
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/NormalizationPlan.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/NormalizationPlan.java
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/NormalizationPlan.java
> new file mode 100644
> index 0000000..96eed8c
> --- /dev/null
> +++
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/NormalizationPlan.java
> @@ -0,0 +1,35 @@
> +/**
> + *
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License.  You may obtain a copy of the License at
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.apache.hadoop.hbase.master.normalizer;
> +
> +import org.apache.hadoop.hbase.classification.InterfaceAudience;
> +import org.apache.hadoop.hbase.client.Admin;
> +
> +/**
> + * Interface for normalization plan.
> + */
> +@InterfaceAudience.Private
> +public interface NormalizationPlan {
> +
> +  /**
> +   * Executes normalization plan on cluster (does actual
> splitting/merging work).
> +   * @param admin instance of Admin
> +   */
> +  void execute(Admin admin);
> +}
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java
> index 3c5de18..c5a1241 100644
> ---
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java
> +++
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java
> @@ -24,8 +24,6 @@ import org.apache.hadoop.hbase.HBaseIOException;
>  import org.apache.hadoop.hbase.TableName;
>  import org.apache.hadoop.hbase.classification.InterfaceAudience;
>  import org.apache.hadoop.hbase.master.MasterServices;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan.PlanType;
>
>  /**
>   * Performs "normalization" of regions on the cluster, making sure that
> suboptimal
> @@ -49,9 +47,8 @@ public interface RegionNormalizer {
>    /**
>     * Computes next optimal normalization plan.
>     * @param table table to normalize
> -   * @param types desired types of NormalizationPlan
>     * @return normalization actions to perform. Null if no action to take
>     */
> -  List<NormalizationPlan> computePlanForTable(TableName table,
> List<PlanType> types)
> +  List<NormalizationPlan> computePlanForTable(TableName table)
>        throws HBaseIOException;
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
> index b9f8203..ef9c102 100644
> ---
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
> +++
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
> @@ -27,8 +27,7 @@ import org.apache.hadoop.hbase.ServerName;
>  import org.apache.hadoop.hbase.TableName;
>  import org.apache.hadoop.hbase.classification.InterfaceAudience;
>  import org.apache.hadoop.hbase.master.MasterServices;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan.PlanType;
> +import org.apache.hadoop.hbase.master.normalizer.NormalizationPlan;
>
>  import java.util.ArrayList;
>  import java.util.Collections;
> @@ -90,12 +89,10 @@ public class SimpleRegionNormalizer implements
> RegionNormalizer {
>     * Action may be either a split, or a merge, or no action.
>     *
>     * @param table table to normalize
> -   * @param types desired types of NormalizationPlan
>     * @return normalization plan to execute
>     */
>    @Override
> -  public List<NormalizationPlan> computePlanForTable(TableName table,
> List<PlanType> types)
> -      throws HBaseIOException {
> +  public List<NormalizationPlan> computePlanForTable(TableName table)
> throws HBaseIOException {
>      if (table == null || table.isSystemTable()) {
>        LOG.debug("Normalization of system table " + table + " isn't
> allowed");
>        return null;
> @@ -135,7 +132,7 @@ public class SimpleRegionNormalizer implements
> RegionNormalizer {
>        long regionSize = getRegionSize(hri);
>        // if the region is > 2 times larger than average, we split it,
> split
>        // is more high priority normalization action than merge.
> -      if (types.contains(PlanType.SPLIT) && regionSize > 2 *
> avgRegionSize) {
> +      if (regionSize > 2 * avgRegionSize) {
>          LOG.debug("Table " + table + ", large region " +
> hri.getRegionNameAsString() + " has size "
>              + regionSize + ", more than twice avg size, splitting");
>          plans.add(new SplitNormalizationPlan(hri, null));
> @@ -145,7 +142,7 @@ public class SimpleRegionNormalizer implements
> RegionNormalizer {
>          }
>          HRegionInfo hri2 = tableRegions.get(candidateIdx+1);
>          long regionSize2 = getRegionSize(hri2);
> -        if (types.contains(PlanType.MERGE) && regionSize + regionSize2 <
> avgRegionSize) {
> +        if (regionSize + regionSize2 < avgRegionSize) {
>            LOG.debug("Table " + table + ", small region size: " +
> regionSize
>              + " plus its neighbor size: " + regionSize2
>              + ", less than the avg size " + avgRegionSize + ", merging
> them");
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
> index 76b7cc2..c96988a 100644
> ---
> a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
> +++
> b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
> @@ -23,7 +23,6 @@ import org.apache.commons.logging.LogFactory;
>  import org.apache.hadoop.hbase.HRegionInfo;
>  import org.apache.hadoop.hbase.classification.InterfaceAudience;
>  import org.apache.hadoop.hbase.client.Admin;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan;
>
>  import java.io.IOException;
>  import java.util.Arrays;
> @@ -43,11 +42,6 @@ public class SplitNormalizationPlan implements
> NormalizationPlan {
>      this.splitPoint = splitPoint;
>    }
>
> -  @Override
> -  public PlanType getType() {
> -    return PlanType.SPLIT;
> -  }
> -
>    public HRegionInfo getRegionInfo() {
>      return regionInfo;
>    }
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizer.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizer.java
> b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizer.java
> index 9733d33..2feadbf 100644
> ---
> a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizer.java
> +++
> b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizer.java
> @@ -26,8 +26,6 @@ import org.apache.hadoop.hbase.RegionLoad;
>  import org.apache.hadoop.hbase.ServerName;
>  import org.apache.hadoop.hbase.TableName;
>  import org.apache.hadoop.hbase.master.MasterServices;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan;
> -import org.apache.hadoop.hbase.normalizer.NormalizationPlan.PlanType;
>  import org.apache.hadoop.hbase.testclassification.SmallTests;
>  import org.apache.hadoop.hbase.util.Bytes;
>  import org.junit.BeforeClass;
> @@ -54,18 +52,6 @@ public class TestSimpleRegionNormalizer {
>    private static final Log LOG =
> LogFactory.getLog(TestSimpleRegionNormalizer.class);
>
>    private static RegionNormalizer normalizer;
> -  private static List<PlanType> bothTypes;
> -  static {
> -    bothTypes = new ArrayList<>();
> -    bothTypes.add(PlanType.SPLIT);
> -    bothTypes.add(PlanType.MERGE);
> -  }
> -
> -  private static List<PlanType> splitType;
> -  static {
> -    splitType = new ArrayList<>();
> -    splitType.add(PlanType.SPLIT);
> -  }
>
>    // mocks
>    private static MasterServices masterServices;
> @@ -82,7 +68,7 @@ public class TestSimpleRegionNormalizer {
>      Map<byte[], Integer> regionSizes = new HashMap<>();
>
>      setupMocksForNormalizer(regionSizes, hris);
> -    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable, bothTypes);
> +    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable);
>      assertTrue(plans == null);
>    }
>
> @@ -101,7 +87,7 @@ public class TestSimpleRegionNormalizer {
>      regionSizes.put(hri2.getRegionName(), 15);
>
>      setupMocksForNormalizer(regionSizes, hris);
> -    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable, bothTypes);
> +    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable);
>      assertTrue(plans == null);
>    }
>
> @@ -128,17 +114,12 @@ public class TestSimpleRegionNormalizer {
>      regionSizes.put(hri4.getRegionName(), 10);
>
>      setupMocksForNormalizer(regionSizes, hris);
> -    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable, bothTypes);
> +    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable);
>      assertTrue(plans == null);
>    }
>
>    @Test
>    public void testMergeOfSmallRegions() throws HBaseIOException {
> -    testMergeOfSmallRegions(true);
> -    testMergeOfSmallRegions(false);
> -  }
> -
> -  public void testMergeOfSmallRegions(boolean mergeDesired) throws
> HBaseIOException {
>      TableName testTable = TableName.valueOf("testMergeOfSmallRegions");
>      List<HRegionInfo> hris = new ArrayList<>();
>      Map<byte[], Integer> regionSizes = new HashMap<>();
> @@ -164,17 +145,12 @@ public class TestSimpleRegionNormalizer {
>      regionSizes.put(hri5.getRegionName(), 16);
>
>      setupMocksForNormalizer(regionSizes, hris);
> -    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable,
> -      mergeDesired ? bothTypes : splitType);
> -
> -    if (mergeDesired) {
> -      NormalizationPlan plan = plans.get(0);
> -      assertTrue(plan instanceof MergeNormalizationPlan);
> -      assertEquals(hri2, ((MergeNormalizationPlan)
> plan).getFirstRegion());
> -      assertEquals(hri3, ((MergeNormalizationPlan)
> plan).getSecondRegion());
> -    } else {
> -      assertTrue(plans == null);
> -    }
> +    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable);
> +
> +    NormalizationPlan plan = plans.get(0);
> +    assertTrue(plan instanceof MergeNormalizationPlan);
> +    assertEquals(hri2, ((MergeNormalizationPlan) plan).getFirstRegion());
> +    assertEquals(hri3, ((MergeNormalizationPlan) plan).getSecondRegion());
>    }
>
>    // Test for situation illustrated in HBASE-14867
> @@ -209,7 +185,7 @@ public class TestSimpleRegionNormalizer {
>      regionSizes.put(hri6.getRegionName(), 2700);
>
>      setupMocksForNormalizer(regionSizes, hris);
> -    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable, bothTypes);
> +    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable);
>      NormalizationPlan plan = plans.get(0);
>
>      assertTrue(plan instanceof MergeNormalizationPlan);
> @@ -244,7 +220,7 @@ public class TestSimpleRegionNormalizer {
>      regionSizes.put(hri5.getRegionName(), 5);
>
>      setupMocksForNormalizer(regionSizes, hris);
> -    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable, bothTypes);
> +    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable);
>
>      assertTrue(plans == null);
>    }
> @@ -272,7 +248,7 @@ public class TestSimpleRegionNormalizer {
>      regionSizes.put(hri4.getRegionName(), 30);
>
>      setupMocksForNormalizer(regionSizes, hris);
> -    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable, bothTypes);
> +    List<NormalizationPlan> plans =
> normalizer.computePlanForTable(testTable);
>      NormalizationPlan plan = plans.get(0);
>
>      assertTrue(plan instanceof SplitNormalizationPlan);
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizerOnCluster.java
> ----------------------------------------------------------------------
> diff --git
> a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizerOnCluster.java
> b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizerOnCluster.java
> index dc96dc7..84ddd0e 100644
> ---
> a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizerOnCluster.java
> +++
> b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizerOnCluster.java
> @@ -113,7 +113,7 @@ public class TestSimpleRegionNormalizerOnCluster {
>      }
>
>      HTableDescriptor htd = admin.getTableDescriptor(TABLENAME);
> -    htd.setNormalizationMode("MS");
> +    htd.setNormalizationEnabled(true);
>      admin.modifyTable(TABLENAME, htd);
>
>      admin.flush(TABLENAME);
> @@ -184,7 +184,7 @@ public class TestSimpleRegionNormalizerOnCluster {
>      }
>
>      HTableDescriptor htd = admin.getTableDescriptor(TABLENAME);
> -    htd.setNormalizationMode("MS");
> +    htd.setNormalizationEnabled(true);
>      admin.modifyTable(TABLENAME, htd);
>
>      admin.flush(TABLENAME);
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-shell/src/main/ruby/hbase/admin.rb
> ----------------------------------------------------------------------
> diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb
> b/hbase-shell/src/main/ruby/hbase/admin.rb
> index 6e27298..d406758 100644
> --- a/hbase-shell/src/main/ruby/hbase/admin.rb
> +++ b/hbase-shell/src/main/ruby/hbase/admin.rb
> @@ -246,10 +246,7 @@ module Hbase
>
>  #----------------------------------------------------------------------------------------------
>      # Parse arguments and update HTableDescriptor accordingly
>      def parse_htd_args(htd, arg)
> -      if arg.has_key?(NORMALIZATION_MODE)
> -        mode = arg.delete(NORMALIZATION_MODE)
> -        htd.setValue(NORMALIZATION_MODE, mode)
> -      end
> +
> htd.setNormalizationEnabled(JBoolean.valueOf(arg.delete(NORMALIZATION_ENABLED)))
> if arg[NORMALIZATION_ENABLED]
>      end
>
>
>  #----------------------------------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-shell/src/main/ruby/shell/commands/normalize.rb
> ----------------------------------------------------------------------
> diff --git a/hbase-shell/src/main/ruby/shell/commands/normalize.rb
> b/hbase-shell/src/main/ruby/shell/commands/normalize.rb
> index e2b3d42..7e6302c 100644
> --- a/hbase-shell/src/main/ruby/shell/commands/normalize.rb
> +++ b/hbase-shell/src/main/ruby/shell/commands/normalize.rb
> @@ -22,7 +22,7 @@ module Shell
>      class Normalize < Command
>        def help
>          return <<-EOF
> -Trigger region normalizer for all tables which have NORMALIZATION_MODE
> flag set. Returns true
> +Trigger region normalizer for all tables which have NORMALIZATION_ENABLED
> flag set. Returns true
>   if normalizer ran successfully, false otherwise. Note that this command
> has no effect
>   if region normalizer is disabled (make sure it's turned on using
> 'normalizer_switch' command).
>
>
>
> http://git-wip-us.apache.org/repos/asf/hbase/blob/5ff65455/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
> ----------------------------------------------------------------------
> diff --git a/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
> b/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
> index ee9e2d1..6d959c4 100644
> --- a/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
> +++ b/hbase-shell/src/main/ruby/shell/commands/normalizer_switch.rb
> @@ -23,8 +23,7 @@ module Shell
>        def help
>          return <<-EOF
>  Enable/Disable region normalizer. Returns previous normalizer state.
> -When normalizer is enabled, it handles all tables with
> 'NORMALIZATION_MODE' flag containing
> -types of normalization actions.
> +When normalizer is enabled, it handles all tables with
> 'NORMALIZATION_ENABLED' => true.
>  Examples:
>
>    hbase> normalizer_switch true
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message