Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 90C04200CDF for ; Thu, 17 Aug 2017 21:15:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8EF1516B898; Thu, 17 Aug 2017 19:15:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 39D8F16B88F for ; Thu, 17 Aug 2017 21:15:04 +0200 (CEST) Received: (qmail 41319 invoked by uid 500); 17 Aug 2017 19:15:02 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 39514 invoked by uid 99); 17 Aug 2017 19:15:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Aug 2017 19:15:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B3999F5EE5; Thu, 17 Aug 2017 19:14:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stack@apache.org To: commits@hbase.apache.org Date: Thu, 17 Aug 2017 19:15:19 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [21/50] [abbrv] hbase git commit: HBASE-18528 DON'T allow user to modify the passed table/column descriptor archived-at: Thu, 17 Aug 2017 19:15:05 -0000 HBASE-18528 DON'T allow user to modify the passed table/column descriptor Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e2b797be Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e2b797be Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e2b797be Branch: refs/heads/HBASE-14070.HLC Commit: e2b797be390f05c55a490a64bc72e2d8c19fcbb7 Parents: c6bf4d5 Author: Chia-Ping Tsai Authored: Mon Aug 14 14:02:30 2017 +0800 Committer: Chia-Ping Tsai Committed: Mon Aug 14 14:02:30 2017 +0800 ---------------------------------------------------------------------- .../client/ImmutableHColumnDescriptor.java | 5 +- .../hbase/client/ImmutableHTableDescriptor.java | 11 ++- .../hbase/coprocessor/MasterObserver.java | 48 ++++++------ .../hbase/master/MasterCoprocessorHost.java | 80 +++++++++++--------- 4 files changed, 79 insertions(+), 65 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/e2b797be/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHColumnDescriptor.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHColumnDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHColumnDescriptor.java index c8d34ff..89ef851 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHColumnDescriptor.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHColumnDescriptor.java @@ -35,8 +35,9 @@ public class ImmutableHColumnDescriptor extends HColumnDescriptor { super(desc, false); } - ImmutableHColumnDescriptor(final ModifyableColumnFamilyDescriptor desc) { - super(desc); + public ImmutableHColumnDescriptor(final ColumnFamilyDescriptor desc) { + super(desc instanceof ModifyableColumnFamilyDescriptor ? + (ModifyableColumnFamilyDescriptor) desc : new ModifyableColumnFamilyDescriptor(desc)); } @Override http://git-wip-us.apache.org/repos/asf/hbase/blob/e2b797be/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHTableDescriptor.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHTableDescriptor.java index 4e9e9af..169f143 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHTableDescriptor.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableHTableDescriptor.java @@ -28,19 +28,17 @@ import org.apache.hadoop.hbase.HTableDescriptor; * Read-only table descriptor. */ @Deprecated // deprecated for hbase 2.0, remove for hbase 3.0. see HTableDescriptor. -@InterfaceAudience.Public +@InterfaceAudience.Private public class ImmutableHTableDescriptor extends HTableDescriptor { @Override protected HColumnDescriptor toHColumnDescriptor(ColumnFamilyDescriptor desc) { if (desc == null) { return null; - } else if (desc instanceof ModifyableColumnFamilyDescriptor) { - return new ImmutableHColumnDescriptor((ModifyableColumnFamilyDescriptor) desc); } else if (desc instanceof HColumnDescriptor) { return new ImmutableHColumnDescriptor((HColumnDescriptor) desc); } else { - return new ImmutableHColumnDescriptor(new ModifyableColumnFamilyDescriptor(desc)); + return new ImmutableHColumnDescriptor(desc); } } /* @@ -51,6 +49,11 @@ public class ImmutableHTableDescriptor extends HTableDescriptor { super(desc, false); } + public ImmutableHTableDescriptor(final TableDescriptor desc) { + super(desc instanceof ModifyableTableDescriptor ? + (ModifyableTableDescriptor) desc : new ModifyableTableDescriptor(desc.getTableName(), desc)); + } + @Override protected ModifyableTableDescriptor getDelegateeForModification() { throw new UnsupportedOperationException("HTableDescriptor is read-only"); http://git-wip-us.apache.org/repos/asf/hbase/blob/e2b797be/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java index f4f5db3..8e368ba 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java @@ -107,7 +107,7 @@ public interface MasterObserver extends Coprocessor { * table handler and it is async to the create RPC call. * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master - * @param desc the HTableDescriptor for the table + * @param desc the read-only HTableDescriptor for the table * @param regions the initial regions created for the table * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-15575). @@ -122,7 +122,7 @@ public interface MasterObserver extends Coprocessor { * of create table RPC call. Called as part of create table handler and * it is async to the create RPC call. * @param ctx the environment to interact with the framework and master - * @param desc the HTableDescriptor for the table + * @param desc the read-only HTableDescriptor for the table * @param regions the initial regions created for the table * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-15575). @@ -368,7 +368,7 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param htd the HTableDescriptor + * @param htd the read-only HTableDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-15575). * Use {@link #preModifyTableAction(ObserverContext, TableName, TableDescriptor)}. @@ -384,7 +384,7 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param htd the HTableDescriptor + * @param htd the read-only HTableDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). * Use {@link #postCompletedModifyTableAction(ObserverContext, TableName, TableDescriptor)}. @@ -435,7 +435,7 @@ public interface MasterObserver extends Coprocessor { * add column RPC call. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param columnFamily the HColumnDescriptor + * @param columnFamily the read-only HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). * Use {@link #preAddColumnFamily(ObserverContext, TableName, ColumnFamilyDescriptor)}. @@ -464,7 +464,7 @@ public interface MasterObserver extends Coprocessor { * add column RPC call. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param columnFamily the HColumnDescriptor + * @param columnFamily the read-only HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). * Use {@link #postAddColumnFamily(ObserverContext, TableName, ColumnFamilyDescriptor)}. @@ -493,7 +493,7 @@ public interface MasterObserver extends Coprocessor { * add column handler. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param columnFamily the HColumnDescriptor + * @param columnFamily the read-only HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). Use * {@link #preAddColumnFamilyAction(ObserverContext, TableName, ColumnFamilyDescriptor)}. @@ -525,7 +525,7 @@ public interface MasterObserver extends Coprocessor { * add column handler. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param columnFamily the HColumnDescriptor + * @param columnFamily the read-only HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). Use * {@link #postCompletedAddColumnFamilyAction(ObserverContext, TableName, ColumnFamilyDescriptor)}. @@ -557,7 +557,7 @@ public interface MasterObserver extends Coprocessor { * modify column RPC call. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param columnFamily the HColumnDescriptor + * @param columnFamily the read-only HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). * Use {@link #preModifyColumnFamily(ObserverContext, TableName, ColumnFamilyDescriptor)}. @@ -586,7 +586,7 @@ public interface MasterObserver extends Coprocessor { * column RPC call. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param columnFamily the HColumnDescriptor + * @param columnFamily the read-only HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). * Use {@link #postModifyColumnFamily(ObserverContext, TableName, ColumnFamilyDescriptor)}. @@ -615,7 +615,7 @@ public interface MasterObserver extends Coprocessor { * modify column handler. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param columnFamily the HColumnDescriptor + * @param columnFamily the read-only HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). * Use {@link #preModifyColumnFamilyAction(ObserverContext, TableName, ColumnFamilyDescriptor)}. @@ -647,7 +647,7 @@ public interface MasterObserver extends Coprocessor { * column handler. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table - * @param columnFamily the HColumnDescriptor + * @param columnFamily the read-only HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). Use * {@link #postCompletedModifyColumnFamilyAction(ObserverContext,TableName,ColumnFamilyDescriptor)}. @@ -1284,10 +1284,10 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param snapshot the SnapshotDescriptor for the snapshot - * @param hTableDescriptor the TableDescriptor of the table to snapshot + * @param tableDescriptor the TableDescriptor of the table to snapshot */ default void preSnapshot(final ObserverContext ctx, - final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor) + final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {} /** @@ -1295,10 +1295,10 @@ public interface MasterObserver extends Coprocessor { * Called as part of snapshot RPC call. * @param ctx the environment to interact with the framework and master * @param snapshot the SnapshotDescriptor for the snapshot - * @param hTableDescriptor the TableDescriptor of the table to snapshot + * @param tableDescriptor the TableDescriptor of the table to snapshot */ default void postSnapshot(final ObserverContext ctx, - final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor) + final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {} /** @@ -1325,10 +1325,10 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param snapshot the SnapshotDescriptor for the snapshot - * @param hTableDescriptor the TableDescriptor of the table to create + * @param tableDescriptor the TableDescriptor of the table to create */ default void preCloneSnapshot(final ObserverContext ctx, - final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor) + final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {} /** @@ -1336,10 +1336,10 @@ public interface MasterObserver extends Coprocessor { * Called as part of restoreSnapshot RPC call. * @param ctx the environment to interact with the framework and master * @param snapshot the SnapshotDescriptor for the snapshot - * @param hTableDescriptor the v of the table to create + * @param tableDescriptor the v of the table to create */ default void postCloneSnapshot(final ObserverContext ctx, - final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor) + final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {} /** @@ -1348,10 +1348,10 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param snapshot the SnapshotDescriptor for the snapshot - * @param hTableDescriptor the TableDescriptor of the table to restore + * @param tableDescriptor the TableDescriptor of the table to restore */ default void preRestoreSnapshot(final ObserverContext ctx, - final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor) + final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {} /** @@ -1359,10 +1359,10 @@ public interface MasterObserver extends Coprocessor { * Called as part of restoreSnapshot RPC call. * @param ctx the environment to interact with the framework and master * @param snapshot the SnapshotDescriptor for the snapshot - * @param hTableDescriptor the TableDescriptor of the table to restore + * @param tableDescriptor the TableDescriptor of the table to restore */ default void postRestoreSnapshot(final ObserverContext ctx, - final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor) + final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {} /** http://git-wip-us.apache.org/repos/asf/hbase/blob/e2b797be/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java index 04bdacf..004f91d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java @@ -22,7 +22,6 @@ package org.apache.hadoop.hbase.master; import java.io.IOException; import java.util.List; import java.util.Set; -import java.util.stream.Collectors; import org.apache.commons.lang.ClassUtils; import org.apache.commons.logging.Log; @@ -38,6 +37,9 @@ import org.apache.hadoop.hbase.ProcedureInfo; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.classification.InterfaceAudience; +import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; +import org.apache.hadoop.hbase.client.ImmutableHColumnDescriptor; +import org.apache.hadoop.hbase.client.ImmutableHTableDescriptor; import org.apache.hadoop.hbase.client.MasterSwitchType; import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.client.TableDescriptor; @@ -243,7 +245,7 @@ public class MasterCoprocessorHost /* Implementation of hooks for invoking MasterObservers */ - public void preCreateTable(final HTableDescriptor htd, final HRegionInfo[] regions) + public void preCreateTable(final TableDescriptor htd, final HRegionInfo[] regions) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override @@ -254,7 +256,7 @@ public class MasterCoprocessorHost }); } - public void postCreateTable(final HTableDescriptor htd, final HRegionInfo[] regions) + public void postCreateTable(final TableDescriptor htd, final HRegionInfo[] regions) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override @@ -265,26 +267,26 @@ public class MasterCoprocessorHost }); } - public void preCreateTableAction(final HTableDescriptor htd, final HRegionInfo[] regions, + public void preCreateTableAction(final TableDescriptor htd, final HRegionInfo[] regions, final User user) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.preCreateTableHandler(ctx, htd, regions); + oserver.preCreateTableHandler(ctx, toImmutableHTableDescriptor(htd), regions); oserver.preCreateTableAction(ctx, htd, regions); } }); } public void postCompletedCreateTableAction( - final HTableDescriptor htd, final HRegionInfo[] regions, final User user) throws IOException { + final TableDescriptor htd, final HRegionInfo[] regions, final User user) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.postCreateTableHandler(ctx, htd, regions); + oserver.postCreateTableHandler(ctx, toImmutableHTableDescriptor(htd), regions); oserver.postCompletedCreateTableAction(ctx, htd, regions); } }); @@ -376,7 +378,7 @@ public class MasterCoprocessorHost }); } - public void preModifyTable(final TableName tableName, final HTableDescriptor htd) + public void preModifyTable(final TableName tableName, final TableDescriptor htd) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override @@ -387,7 +389,7 @@ public class MasterCoprocessorHost }); } - public void postModifyTable(final TableName tableName, final HTableDescriptor htd) + public void postModifyTable(final TableName tableName, final TableDescriptor htd) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override @@ -398,51 +400,51 @@ public class MasterCoprocessorHost }); } - public void preModifyTableAction(final TableName tableName, final HTableDescriptor htd, + public void preModifyTableAction(final TableName tableName, final TableDescriptor htd, final User user) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.preModifyTableHandler(ctx, tableName, htd); + oserver.preModifyTableHandler(ctx, tableName, toImmutableHTableDescriptor(htd)); oserver.preModifyTableAction(ctx, tableName, htd); } }); } - public void postCompletedModifyTableAction(final TableName tableName, final HTableDescriptor htd, + public void postCompletedModifyTableAction(final TableName tableName, final TableDescriptor htd, final User user) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.postModifyTableHandler(ctx, tableName, htd); + oserver.postModifyTableHandler(ctx, tableName, toImmutableHTableDescriptor(htd)); oserver.postCompletedModifyTableAction(ctx, tableName, htd); } }); } - public boolean preAddColumn(final TableName tableName, final HColumnDescriptor columnFamily) + public boolean preAddColumn(final TableName tableName, final ColumnFamilyDescriptor columnFamily) throws IOException { return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.preAddColumn(ctx, tableName, columnFamily); + oserver.preAddColumn(ctx, tableName, toImmutableHColumnDescriptor(columnFamily)); oserver.preAddColumnFamily(ctx, tableName, columnFamily); } }); } - public void postAddColumn(final TableName tableName, final HColumnDescriptor columnFamily) + public void postAddColumn(final TableName tableName, final ColumnFamilyDescriptor columnFamily) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.postAddColumn(ctx, tableName, columnFamily); + oserver.postAddColumn(ctx, tableName, toImmutableHColumnDescriptor(columnFamily)); oserver.postAddColumnFamily(ctx, tableName, columnFamily); } }); @@ -450,14 +452,14 @@ public class MasterCoprocessorHost public boolean preAddColumnFamilyAction( final TableName tableName, - final HColumnDescriptor columnFamily, + final ColumnFamilyDescriptor columnFamily, final User user) throws IOException { return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.preAddColumnHandler(ctx, tableName, columnFamily); + oserver.preAddColumnHandler(ctx, tableName, toImmutableHColumnDescriptor(columnFamily)); oserver.preAddColumnFamilyAction(ctx, tableName, columnFamily); } }); @@ -465,38 +467,38 @@ public class MasterCoprocessorHost public void postCompletedAddColumnFamilyAction( final TableName tableName, - final HColumnDescriptor columnFamily, + final ColumnFamilyDescriptor columnFamily, final User user) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.postAddColumnHandler(ctx, tableName, columnFamily); + oserver.postAddColumnHandler(ctx, tableName, toImmutableHColumnDescriptor(columnFamily)); oserver.postCompletedAddColumnFamilyAction(ctx, tableName, columnFamily); } }); } - public boolean preModifyColumn(final TableName tableName, final HColumnDescriptor columnFamily) + public boolean preModifyColumn(final TableName tableName, final ColumnFamilyDescriptor columnFamily) throws IOException { return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.preModifyColumn(ctx, tableName, columnFamily); + oserver.preModifyColumn(ctx, tableName, toImmutableHColumnDescriptor(columnFamily)); oserver.preModifyColumnFamily(ctx, tableName, columnFamily); } }); } - public void postModifyColumn(final TableName tableName, final HColumnDescriptor columnFamily) + public void postModifyColumn(final TableName tableName, final ColumnFamilyDescriptor columnFamily) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.postModifyColumn(ctx, tableName, columnFamily); + oserver.postModifyColumn(ctx, tableName, toImmutableHColumnDescriptor(columnFamily)); oserver.postModifyColumnFamily(ctx, tableName, columnFamily); } }); @@ -504,13 +506,13 @@ public class MasterCoprocessorHost public boolean preModifyColumnFamilyAction( final TableName tableName, - final HColumnDescriptor columnFamily, + final ColumnFamilyDescriptor columnFamily, final User user) throws IOException { return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.preModifyColumnHandler(ctx, tableName, columnFamily); + oserver.preModifyColumnHandler(ctx, tableName, toImmutableHColumnDescriptor(columnFamily)); oserver.preModifyColumnFamilyAction(ctx, tableName, columnFamily); } }); @@ -518,13 +520,13 @@ public class MasterCoprocessorHost public void postCompletedModifyColumnFamilyAction( final TableName tableName, - final HColumnDescriptor columnFamily, + final ColumnFamilyDescriptor columnFamily, final User user) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { - oserver.postModifyColumnHandler(ctx, tableName, columnFamily); + oserver.postModifyColumnHandler(ctx, tableName, toImmutableHColumnDescriptor(columnFamily)); oserver.postCompletedModifyColumnFamilyAction(ctx, tableName, columnFamily); } }); @@ -1155,7 +1157,7 @@ public class MasterCoprocessorHost } public void preSnapshot(final SnapshotDescription snapshot, - final HTableDescriptor hTableDescriptor) throws IOException { + final TableDescriptor hTableDescriptor) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) @@ -1166,7 +1168,7 @@ public class MasterCoprocessorHost } public void postSnapshot(final SnapshotDescription snapshot, - final HTableDescriptor hTableDescriptor) throws IOException { + final TableDescriptor hTableDescriptor) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) @@ -1197,7 +1199,7 @@ public class MasterCoprocessorHost } public void preCloneSnapshot(final SnapshotDescription snapshot, - final HTableDescriptor hTableDescriptor) throws IOException { + final TableDescriptor hTableDescriptor) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) @@ -1208,7 +1210,7 @@ public class MasterCoprocessorHost } public void postCloneSnapshot(final SnapshotDescription snapshot, - final HTableDescriptor hTableDescriptor) throws IOException { + final TableDescriptor hTableDescriptor) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) @@ -1219,7 +1221,7 @@ public class MasterCoprocessorHost } public void preRestoreSnapshot(final SnapshotDescription snapshot, - final HTableDescriptor hTableDescriptor) throws IOException { + final TableDescriptor hTableDescriptor) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) @@ -1230,7 +1232,7 @@ public class MasterCoprocessorHost } public void postRestoreSnapshot(final SnapshotDescription snapshot, - final HTableDescriptor hTableDescriptor) throws IOException { + final TableDescriptor hTableDescriptor) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) @@ -1875,4 +1877,12 @@ public class MasterCoprocessorHost } }); } + + private static ImmutableHTableDescriptor toImmutableHTableDescriptor(TableDescriptor desc) { + return new ImmutableHTableDescriptor(desc); + } + + private static ImmutableHColumnDescriptor toImmutableHColumnDescriptor(ColumnFamilyDescriptor desc) { + return new ImmutableHColumnDescriptor(desc); + } }