HBASE-18502 Change MasterObserver to use TableDescriptor and ColumnFamilyDescriptor

This commit is contained in:
Chia-Ping Tsai 2017-08-07 11:26:15 +08:00
parent a7014ce46c
commit fd76eb39d7
24 changed files with 184 additions and 171 deletions

View File

@ -24,8 +24,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
@ -68,7 +68,7 @@ public class ExampleMasterObserverWithMetrics implements MasterObserver {
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
// we rely on the fact that there is only 1 instance of our MasterObserver. We keep track of
// when the operation starts before the operation is executing.
this.createTableStartTime = System.currentTimeMillis();
@ -76,7 +76,7 @@ public class ExampleMasterObserverWithMetrics implements MasterObserver {
@Override
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
if (this.createTableStartTime > 0) {
long time = System.currentTimeMillis() - this.createTableStartTime;
LOG.info("Create table took: " + time);

View File

@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.constraint.ConstraintException;
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
@ -268,7 +269,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
}
}
void assignTableToGroup(HTableDescriptor desc) throws IOException {
void assignTableToGroup(TableDescriptor desc) throws IOException {
String groupName =
master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString())
.getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP);
@ -293,7 +294,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
// Assign table to default RSGroup.
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
assignTableToGroup(desc);
}
@ -330,7 +331,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
@Override
public void preCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
SnapshotDescription snapshot, HTableDescriptor desc) throws IOException {
SnapshotDescription snapshot, TableDescriptor desc) throws IOException {
assignTableToGroup(desc);
}

View File

@ -35,8 +35,10 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.MasterSwitchType;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.master.RegionPlan;
import org.apache.hadoop.hbase.master.locking.LockProcedure;
import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
@ -83,21 +85,21 @@ public interface MasterObserver extends Coprocessor {
* table 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 TableDescriptor for the table
* @param regions the initial regions created for the table
*/
default void preCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {}
TableDescriptor desc, HRegionInfo[] regions) throws IOException {}
/**
* Called after the createTable operation has been requested. Called as part
* of create table RPC call.
* @param ctx the environment to interact with the framework and master
* @param desc the HTableDescriptor for the table
* @param desc the TableDescriptor for the table
* @param regions the initial regions created for the table
*/
default void postCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {}
TableDescriptor desc, HRegionInfo[] regions) throws IOException {}
/**
* Called before a new table is created by
@ -109,7 +111,7 @@ public interface MasterObserver extends Coprocessor {
* @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
* (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
* Use {@link #preCreateTableAction(ObserverContext, HTableDescriptor, HRegionInfo[])}.
* Use {@link #preCreateTableAction(ObserverContext, TableDescriptor, HRegionInfo[])}.
*/
@Deprecated
default void preCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
@ -124,7 +126,7 @@ public interface MasterObserver extends Coprocessor {
* @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
* (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
* Use {@link #postCompletedCreateTableAction(ObserverContext, HTableDescriptor, HRegionInfo[])}
* Use {@link #postCompletedCreateTableAction(ObserverContext, TableDescriptor, HRegionInfo[])}
*/
@Deprecated
default void postCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
@ -141,12 +143,12 @@ public interface MasterObserver extends Coprocessor {
* Make sure to implement only one of the two as both are called.
*
* @param ctx the environment to interact with the framework and master
* @param desc the HTableDescriptor for the table
* @param desc the TableDescriptor for the table
* @param regions the initial regions created for the table
*/
default void preCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HTableDescriptor desc,
final TableDescriptor desc,
final HRegionInfo[] regions) throws IOException {}
/**
@ -159,12 +161,12 @@ public interface MasterObserver extends Coprocessor {
* Make sure to implement only one of the two as both are called.
*
* @param ctx the environment to interact with the framework and master
* @param desc the HTableDescriptor for the table
* @param desc the TableDescriptor for the table
* @param regions the initial regions created for the table
*/
default void postCompletedCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HTableDescriptor desc,
final TableDescriptor desc,
final HRegionInfo[] regions) throws IOException {}
/**
@ -345,20 +347,20 @@ 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 TableDescriptor
*/
default void preModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName, HTableDescriptor htd) throws IOException {}
final TableName tableName, TableDescriptor htd) throws IOException {}
/**
* Called after the modifyTable operation has been requested. Called as part
* of modify table RPC call.
* @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 TableDescriptor
*/
default void postModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName, HTableDescriptor htd) throws IOException {}
final TableName tableName, TableDescriptor htd) throws IOException {}
/**
* Called prior to modifying a table's properties. Called as part of modify
@ -369,7 +371,7 @@ public interface MasterObserver extends Coprocessor {
* @param htd the HTableDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
* Use {@link #preModifyTableAction(ObserverContext, TableName, HTableDescriptor)}.
* Use {@link #preModifyTableAction(ObserverContext, TableName, TableDescriptor)}.
*/
@Deprecated
default void preModifyTableHandler(
@ -385,7 +387,7 @@ public interface MasterObserver extends Coprocessor {
* @param htd the HTableDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
* Use {@link #postCompletedModifyTableAction(ObserverContext, TableName, HTableDescriptor)}.
* Use {@link #postCompletedModifyTableAction(ObserverContext, TableName, TableDescriptor)}.
*/
@Deprecated
default void postModifyTableHandler(
@ -403,12 +405,12 @@ public interface MasterObserver extends Coprocessor {
*
* @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 TableDescriptor
*/
default void preModifyTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HTableDescriptor htd) throws IOException {}
final TableDescriptor htd) throws IOException {}
/**
* Called after to modifying a table's properties. Called as part of modify
@ -421,12 +423,12 @@ public interface MasterObserver extends Coprocessor {
*
* @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 TableDescriptor
*/
default void postCompletedModifyTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HTableDescriptor htd) throws IOException {}
final TableDescriptor htd) throws IOException {}
/**
* Called prior to adding a new column family to the table. Called as part of
@ -436,7 +438,7 @@ public interface MasterObserver extends Coprocessor {
* @param columnFamily the HColumnDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
* Use {@link #preAddColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
* Use {@link #preAddColumnFamily(ObserverContext, TableName, ColumnFamilyDescriptor)}.
*/
@Deprecated
default void preAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
@ -452,10 +454,10 @@ public interface MasterObserver extends Coprocessor {
*
* @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 ColumnFamilyDescriptor
*/
default void preAddColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {}
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {}
/**
* Called after the new column family has been created. Called as part of
@ -465,7 +467,7 @@ public interface MasterObserver extends Coprocessor {
* @param columnFamily the HColumnDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
* Use {@link #postAddColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
* Use {@link #postAddColumnFamily(ObserverContext, TableName, ColumnFamilyDescriptor)}.
*/
@Deprecated
default void postAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
@ -481,10 +483,10 @@ public interface MasterObserver extends Coprocessor {
*
* @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 ColumnFamilyDescriptor
*/
default void postAddColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {}
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {}
/**
* Called prior to adding a new column family to the table. Called as part of
@ -494,7 +496,7 @@ public interface MasterObserver extends Coprocessor {
* @param columnFamily the HColumnDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>). Use
* {@link #preAddColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}.
* {@link #preAddColumnFamilyAction(ObserverContext, TableName, ColumnFamilyDescriptor)}.
*/
@Deprecated
default void preAddColumnHandler(
@ -511,12 +513,12 @@ public interface MasterObserver extends Coprocessor {
*
* @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 ColumnFamilyDescriptor
*/
default void preAddColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {}
final ColumnFamilyDescriptor columnFamily) throws IOException {}
/**
* Called after the new column family has been created. Called as part of
@ -526,7 +528,7 @@ public interface MasterObserver extends Coprocessor {
* @param columnFamily the HColumnDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>). Use
* {@link #postCompletedAddColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}.
* {@link #postCompletedAddColumnFamilyAction(ObserverContext, TableName, ColumnFamilyDescriptor)}.
*/
@Deprecated
default void postAddColumnHandler(
@ -543,12 +545,12 @@ public interface MasterObserver extends Coprocessor {
*
* @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 ColumnFamilyDescriptor
*/
default void postCompletedAddColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {}
final ColumnFamilyDescriptor columnFamily) throws IOException {}
/**
* Called prior to modifying a column family's attributes. Called as part of
@ -558,7 +560,7 @@ public interface MasterObserver extends Coprocessor {
* @param columnFamily the HColumnDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
* Use {@link #preModifyColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
* Use {@link #preModifyColumnFamily(ObserverContext, TableName, ColumnFamilyDescriptor)}.
*/
@Deprecated
default void preModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
@ -574,10 +576,10 @@ public interface MasterObserver extends Coprocessor {
*
* @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 ColumnFamilyDescriptor
*/
default void preModifyColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {}
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {}
/**
* Called after the column family has been updated. Called as part of modify
@ -587,7 +589,7 @@ public interface MasterObserver extends Coprocessor {
* @param columnFamily the HColumnDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
* Use {@link #postModifyColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
* Use {@link #postModifyColumnFamily(ObserverContext, TableName, ColumnFamilyDescriptor)}.
*/
@Deprecated
default void postModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
@ -603,10 +605,10 @@ public interface MasterObserver extends Coprocessor {
*
* @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 ColumnFamilyDescriptor
*/
default void postModifyColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {}
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {}
/**
* Called prior to modifying a column family's attributes. Called as part of
@ -616,7 +618,7 @@ public interface MasterObserver extends Coprocessor {
* @param columnFamily the HColumnDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
* Use {@link #preModifyColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}.
* Use {@link #preModifyColumnFamilyAction(ObserverContext, TableName, ColumnFamilyDescriptor)}.
*/
@Deprecated
default void preModifyColumnHandler(
@ -633,12 +635,12 @@ public interface MasterObserver extends Coprocessor {
*
* @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 ColumnFamilyDescriptor
*/
default void preModifyColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {}
final ColumnFamilyDescriptor columnFamily) throws IOException {}
/**
* Called after the column family has been updated. Called as part of modify
@ -648,7 +650,7 @@ public interface MasterObserver extends Coprocessor {
* @param columnFamily the HColumnDescriptor
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>). Use
* {@link #postCompletedModifyColumnFamilyAction(ObserverContext,TableName,HColumnDescriptor)}.
* {@link #postCompletedModifyColumnFamilyAction(ObserverContext,TableName,ColumnFamilyDescriptor)}.
*/
@Deprecated
default void postModifyColumnHandler(
@ -665,12 +667,12 @@ public interface MasterObserver extends Coprocessor {
*
* @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 ColumnFamilyDescriptor
*/
default void postCompletedModifyColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {}
final ColumnFamilyDescriptor columnFamily) throws IOException {}
/**
* Called prior to deleting the entire column family. Called as part of
@ -1282,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 hTableDescriptor of the table to snapshot
* @param hTableDescriptor the TableDescriptor of the table to snapshot
*/
default void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {}
/**
@ -1293,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 hTableDescriptor of the table to snapshot
* @param hTableDescriptor the TableDescriptor of the table to snapshot
*/
default void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {}
/**
@ -1323,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 hTableDescriptor of the table to create
* @param hTableDescriptor the TableDescriptor of the table to create
*/
default void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {}
/**
@ -1334,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 hTableDescriptor of the table to create
* @param hTableDescriptor the v of the table to create
*/
default void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {}
/**
@ -1346,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 hTableDescriptor of the table to restore
* @param hTableDescriptor the TableDescriptor of the table to restore
*/
default void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {}
/**
@ -1357,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 hTableDescriptor of the table to restore
* @param hTableDescriptor the TableDescriptor of the table to restore
*/
default void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {}
/**
@ -1390,7 +1392,7 @@ public interface MasterObserver extends Coprocessor {
* @param regex regular expression used for filtering the table names
*/
default void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
String regex) throws IOException {}
/**
@ -1401,7 +1403,7 @@ public interface MasterObserver extends Coprocessor {
* @param regex regular expression used for filtering the table names
*/
default void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
String regex) throws IOException {}
/**
@ -1411,7 +1413,7 @@ public interface MasterObserver extends Coprocessor {
* @param regex regular expression used for filtering the table names
*/
default void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors, String regex) throws IOException {}
List<TableDescriptor> descriptors, String regex) throws IOException {}
/**
* Called after a getTableNames request has been processed.
@ -1420,7 +1422,7 @@ public interface MasterObserver extends Coprocessor {
* @param regex regular expression used for filtering the table names
*/
default void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors, String regex) throws IOException {}
List<TableDescriptor> descriptors, String regex) throws IOException {}

View File

@ -192,7 +192,7 @@ code, see the {@link org.apache.hadoop.hbase.client.coprocessor} package documen
<h2><a name="load">Coprocessor loading</a></h2>
A customized coprocessor can be loaded by two different ways, by configuration,
or by <code>HTableDescriptor</code> for a newly created table.
or by <code>TableDescriptor</code> for a newly created table.
<p>
(Currently we don't really have an on demand coprocessor loading mechanism for
opened regions.)
@ -255,13 +255,14 @@ policy implementations, perhaps) ahead of observers.
"TestClassloading.jar");
// create a table that references the jar
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(getClass().getTableName()));
htd.addFamily(new HColumnDescriptor("test"));
htd.setValue("Coprocessor$1",
path.toString() +
":" + classFullName +
":" + Coprocessor.Priority.USER);
HBaseAdmin admin = new HBaseAdmin(this.conf);
TableDescriptor htd = TableDescriptorBuilder
.newBuilder(TableName.valueOf(getClass().getTableName()))
.addColumnFamily(ColumnFamilyDescriptorBuilder.of("test"))
.setValue(Bytes.toBytes("Coprocessor$1", path.toString()+
":" + classFullName +
":" + Coprocessor.Priority.USER))
.build();
Admin admin = connection.getAdmin();
admin.createTable(htd);
</pre></blockquote>
<h3>Chain of RegionObservers</h3>

View File

@ -53,6 +53,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.ClusterStatus;
import org.apache.hadoop.hbase.CoordinatedStateException;
import org.apache.hadoop.hbase.CoordinatedStateManager;
@ -2975,7 +2976,7 @@ public class HMaster extends HRegionServer implements MasterServices {
}
@Override
public List<HTableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException {
public List<TableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException {
checkInitialized();
return listTableDescriptors(name, null, null, true);
}
@ -3042,10 +3043,10 @@ public class HMaster extends HRegionServer implements MasterServices {
* @param includeSysTables False to match only against userspace tables
* @return the list of table descriptors
*/
public List<HTableDescriptor> listTableDescriptors(final String namespace, final String regex,
public List<TableDescriptor> listTableDescriptors(final String namespace, final String regex,
final List<TableName> tableNameList, final boolean includeSysTables)
throws IOException {
List<HTableDescriptor> htds = new ArrayList<>();
List<TableDescriptor> htds = new ArrayList<>();
boolean bypass = cpHost != null?
cpHost.preGetTableDescriptors(tableNameList, htds, regex): false;
if (!bypass) {
@ -3066,14 +3067,14 @@ public class HMaster extends HRegionServer implements MasterServices {
*/
public List<TableName> listTableNames(final String namespace, final String regex,
final boolean includeSysTables) throws IOException {
List<HTableDescriptor> htds = new ArrayList<>();
List<TableDescriptor> htds = new ArrayList<>();
boolean bypass = cpHost != null? cpHost.preGetTableNames(htds, regex): false;
if (!bypass) {
htds = getTableDescriptors(htds, namespace, regex, null, includeSysTables);
if (cpHost != null) cpHost.postGetTableNames(htds, regex);
}
List<TableName> result = new ArrayList<>(htds.size());
for (HTableDescriptor htd: htds) result.add(htd.getTableName());
for (TableDescriptor htd: htds) result.add(htd.getTableName());
return result;
}
@ -3082,7 +3083,7 @@ public class HMaster extends HRegionServer implements MasterServices {
* tables, etc.
* @throws IOException
*/
private List<HTableDescriptor> getTableDescriptors(final List<HTableDescriptor> htds,
private List<TableDescriptor> getTableDescriptors(final List<TableDescriptor> htds,
final String namespace, final String regex, final List<TableName> tableNameList,
final boolean includeSysTables)
throws IOException {
@ -3123,12 +3124,12 @@ public class HMaster extends HRegionServer implements MasterServices {
* @param descriptors list of table descriptors to filter
* @param pattern the regex to use
*/
private static void filterTablesByRegex(final Collection<HTableDescriptor> descriptors,
private static void filterTablesByRegex(final Collection<TableDescriptor> descriptors,
final Pattern pattern) {
final String defaultNS = NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR;
Iterator<HTableDescriptor> itr = descriptors.iterator();
Iterator<TableDescriptor> itr = descriptors.iterator();
while (itr.hasNext()) {
HTableDescriptor htd = itr.next();
TableDescriptor htd = itr.next();
String tableName = htd.getTableName().getNameAsString();
boolean matched = pattern.matcher(tableName).matches();
if (!matched && htd.getTableName().getNamespaceAsString().equals(defaultNS)) {

View File

@ -22,6 +22,7 @@ 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;
@ -39,6 +40,7 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.client.MasterSwitchType;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
@ -1259,7 +1261,7 @@ public class MasterCoprocessorHost
}
public boolean preGetTableDescriptors(final List<TableName> tableNamesList,
final List<HTableDescriptor> descriptors, final String regex) throws IOException {
final List<TableDescriptor> descriptors, final String regex) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
@Override
public void call(MasterObserver oserver, ObserverContext<MasterCoprocessorEnvironment> ctx)
@ -1270,7 +1272,7 @@ public class MasterCoprocessorHost
}
public void postGetTableDescriptors(final List<TableName> tableNamesList,
final List<HTableDescriptor> descriptors, final String regex) throws IOException {
final List<TableDescriptor> descriptors, final String regex) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
@Override
public void call(MasterObserver oserver, ObserverContext<MasterCoprocessorEnvironment> ctx)
@ -1280,7 +1282,7 @@ public class MasterCoprocessorHost
});
}
public boolean preGetTableNames(final List<HTableDescriptor> descriptors,
public boolean preGetTableNames(final List<TableDescriptor> descriptors,
final String regex) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
@Override
@ -1291,7 +1293,7 @@ public class MasterCoprocessorHost
});
}
public void postGetTableNames(final List<HTableDescriptor> descriptors,
public void postGetTableNames(final List<TableDescriptor> descriptors,
final String regex) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
@Override

View File

@ -44,6 +44,7 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.UnknownRegionException;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.client.MasterSwitchType;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.client.TableState;
import org.apache.hadoop.hbase.client.VersionInfoUtil;
import org.apache.hadoop.hbase.client.replication.ReplicationSerDeHelper;
@ -856,13 +857,13 @@ public class MasterRpcServices extends RSRpcServices
}
}
List<HTableDescriptor> descriptors = master.listTableDescriptors(namespace, regex,
List<TableDescriptor> descriptors = master.listTableDescriptors(namespace, regex,
tableNameList, req.getIncludeSysTables());
GetTableDescriptorsResponse.Builder builder = GetTableDescriptorsResponse.newBuilder();
if (descriptors != null && descriptors.size() > 0) {
// Add the table descriptors to the response
for (HTableDescriptor htd: descriptors) {
for (TableDescriptor htd: descriptors) {
builder.addTableSchema(ProtobufUtil.convertToTableSchema(htd));
}
}
@ -1114,7 +1115,7 @@ public class MasterRpcServices extends RSRpcServices
try {
ListTableDescriptorsByNamespaceResponse.Builder b =
ListTableDescriptorsByNamespaceResponse.newBuilder();
for (HTableDescriptor htd : master
for (TableDescriptor htd : master
.listTableDescriptorsByNamespace(request.getNamespaceName())) {
b.addTableSchema(ProtobufUtil.convertToTableSchema(htd));
}

View File

@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.TableNotDisabledException;
import org.apache.hadoop.hbase.TableNotFoundException;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.client.MasterSwitchType;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.executor.ExecutorService;
import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
import org.apache.hadoop.hbase.master.locking.LockManager;
@ -381,7 +382,7 @@ public interface MasterServices extends Server {
* @return descriptors
* @throws IOException
*/
public List<HTableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException;
public List<TableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException;
/**
* Get list of table names by namespace

View File

@ -59,6 +59,7 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.filter.QualifierFilter;
@ -365,7 +366,7 @@ public class AccessControlLists {
/**
* Returns {@code true} if the given table is {@code _acl_} metadata table.
*/
static boolean isAclTable(HTableDescriptor desc) {
static boolean isAclTable(TableDescriptor desc) {
return ACL_TABLE_NAME.equals(desc.getTableName());
}

View File

@ -43,10 +43,8 @@ import org.apache.hadoop.hbase.CompoundConfiguration;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.Type;
import org.apache.hadoop.hbase.MetaTableAccessor;
@ -57,6 +55,7 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.Tag;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Get;
@ -68,6 +67,7 @@ import org.apache.hadoop.hbase.client.Query;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.BulkLoadObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
@ -134,7 +134,6 @@ import com.google.protobuf.Message;
import com.google.protobuf.RpcCallback;
import com.google.protobuf.RpcController;
import com.google.protobuf.Service;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
/**
* Provides basic authorization checks for data access and administrative
@ -988,8 +987,8 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> c,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
Set<byte[]> families = desc.getFamiliesKeys();
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
Set<byte[]> families = desc.getColumnFamilyNames();
Map<byte[], Set<byte[]>> familyMap = new TreeMap<>(Bytes.BYTES_COMPARATOR);
for (byte[] family: families) {
familyMap.put(family, null);
@ -1001,7 +1000,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void postCompletedCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> c,
final HTableDescriptor desc,
final TableDescriptor desc,
final HRegionInfo[] regions) throws IOException {
// When AC is used, it should be configured as the 1st CP.
// In Master, the table operations like create, are handled by a Thread pool but the max size
@ -1108,14 +1107,14 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName,
HTableDescriptor htd) throws IOException {
TableDescriptor htd) throws IOException {
requirePermission(getActiveUser(c), "modifyTable", tableName, null, null,
Action.ADMIN, Action.CREATE);
}
@Override
public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> c,
TableName tableName, final HTableDescriptor htd) throws IOException {
TableName tableName, final TableDescriptor htd) throws IOException {
final Configuration conf = c.getEnvironment().getConfiguration();
// default the table owner to current user, if not specified.
final String owner = (htd.getOwnerString() != null) ? htd.getOwnerString() :
@ -1134,7 +1133,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily)
TableName tableName, ColumnFamilyDescriptor columnFamily)
throws IOException {
requireTablePermission(getActiveUser(ctx), "addColumn", tableName, columnFamily.getName(), null,
Action.ADMIN, Action.CREATE);
@ -1142,7 +1141,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily)
TableName tableName, ColumnFamilyDescriptor columnFamily)
throws IOException {
requirePermission(getActiveUser(ctx), "modifyColumn", tableName, columnFamily.getName(), null,
Action.ADMIN, Action.CREATE);
@ -1318,7 +1317,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
requirePermission(getActiveUser(ctx), "snapshot " + snapshot.getName(), hTableDescriptor.getTableName(), null, null,
Permission.Action.ADMIN);
@ -1340,11 +1339,11 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
User user = getActiveUser(ctx);
if (SnapshotDescriptionUtils.isSnapshotOwner(snapshot, user)
&& hTableDescriptor.getNameAsString().equals(snapshot.getTable())) {
&& hTableDescriptor.getTableName().getNameAsString().equals(snapshot.getTable())) {
// Snapshot owner is allowed to create a table with the same name as the snapshot he took
AuthResult result = AuthResult.allow("cloneSnapshot " + snapshot.getName(),
"Snapshot owner check allowed", user, null, hTableDescriptor.getTableName(), null);
@ -1356,7 +1355,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
User user = getActiveUser(ctx);
if (SnapshotDescriptionUtils.isSnapshotOwner(snapshot, user)) {
@ -2521,7 +2520,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
String regex) throws IOException {
// We are delegating the authorization check to postGetTableDescriptors as we don't have
// any concrete set of table names when a regex is present or the full list is requested.
@ -2541,7 +2540,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
String regex) throws IOException {
// Skipping as checks in this case are already done by preGetTableDescriptors.
if (regex == null && tableNamesList != null && !tableNamesList.isEmpty()) {
@ -2550,9 +2549,9 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
// Retains only those which passes authorization checks, as the checks weren't done as part
// of preGetTableDescriptors.
Iterator<HTableDescriptor> itr = descriptors.iterator();
Iterator<TableDescriptor> itr = descriptors.iterator();
while (itr.hasNext()) {
HTableDescriptor htd = itr.next();
TableDescriptor htd = itr.next();
try {
requirePermission(getActiveUser(ctx), "getTableDescriptors", htd.getTableName(), null, null,
Action.ADMIN, Action.CREATE);
@ -2564,11 +2563,11 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
@Override
public void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors, String regex) throws IOException {
List<TableDescriptor> descriptors, String regex) throws IOException {
// Retains only those which passes authorization checks.
Iterator<HTableDescriptor> itr = descriptors.iterator();
Iterator<TableDescriptor> itr = descriptors.iterator();
while (itr.hasNext()) {
HTableDescriptor htd = itr.next();
TableDescriptor htd = itr.next();
try {
requireAccess(getActiveUser(ctx), "getTableNames", htd.getTableName(), Action.values());
} catch (AccessDeniedException e) {

View File

@ -19,10 +19,7 @@
package org.apache.hadoop.hbase.security.access;
import java.io.IOException;
import java.net.URI;
import java.nio.file.PathMatcher;
import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import org.apache.commons.io.FilenameUtils;
@ -39,9 +36,9 @@ import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.master.MasterServices;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.util.Bytes;
/**
@ -58,13 +55,13 @@ public class CoprocessorWhitelistMasterObserver implements MasterObserver {
@Override
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HTableDescriptor htd) throws IOException {
TableName tableName, TableDescriptor htd) throws IOException {
verifyCoprocessors(ctx, htd);
}
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor htd, HRegionInfo[] regions) throws IOException {
TableDescriptor htd, HRegionInfo[] regions) throws IOException {
verifyCoprocessors(ctx, htd);
}
@ -143,7 +140,7 @@ public class CoprocessorWhitelistMasterObserver implements MasterObserver {
* @param htd as passed in from the coprocessor
*/
private void verifyCoprocessors(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor htd) throws IOException {
TableDescriptor htd) throws IOException {
MasterServices services = ctx.getEnvironment().getMasterServices();
Configuration conf = services.getConfiguration();
@ -152,9 +149,8 @@ public class CoprocessorWhitelistMasterObserver implements MasterObserver {
conf.getStringCollection(
CP_COPROCESSOR_WHITELIST_PATHS_KEY);
List<String> coprocs = htd.getCoprocessors();
Collection<String> coprocs = htd.getCoprocessors();
for (int i = 0; i < coprocs.size(); i++) {
String coproc = coprocs.get(i);
String coprocSpec = Bytes.toString(htd.getValue(
Bytes.toBytes("coprocessor$" + (i + 1))));

View File

@ -51,6 +51,7 @@ import org.apache.hadoop.hbase.TagType;
import org.apache.hadoop.hbase.TagUtil;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
@ -59,6 +60,7 @@ import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.constraint.ConstraintException;
import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
@ -215,7 +217,7 @@ public class VisibilityController implements MasterObserver, RegionObserver,
@Override
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HTableDescriptor htd) throws IOException {
TableName tableName, TableDescriptor htd) throws IOException {
if (!authorizationEnabled) {
return;
}
@ -226,7 +228,7 @@ public class VisibilityController implements MasterObserver, RegionObserver,
@Override
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily)
TableName tableName, ColumnFamilyDescriptor columnFamily)
throws IOException {
if (!authorizationEnabled) {
return;
@ -238,7 +240,7 @@ public class VisibilityController implements MasterObserver, RegionObserver,
@Override
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
if (!authorizationEnabled) {
return;
}

View File

@ -30,11 +30,11 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
@ -81,7 +81,7 @@ public class TestBackupDeleteWithFailures extends TestBackupBase{
@Override
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException
{
if (failures.contains(Failure.PRE_SNAPSHOT_FAILURE)) {

View File

@ -197,7 +197,7 @@ public class TestEnableTable {
@Override
public void postCompletedCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HTableDescriptor desc,
final TableDescriptor desc,
final HRegionInfo[] regions) throws IOException {
// the AccessController test, some times calls only and directly the
// postCompletedCreateTableAction()

View File

@ -47,6 +47,7 @@ import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
import org.apache.hadoop.hbase.metrics.Counter;
import org.apache.hadoop.hbase.metrics.Metric;
@ -101,14 +102,14 @@ public class TestCoprocessorMetrics {
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
// we rely on the fact that there is only 1 instance of our MasterObserver
this.start = System.currentTimeMillis();
}
@Override
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
if (this.start > 0) {
long time = System.currentTimeMillis() - start;
LOG.info("Create table took: " + time);

View File

@ -37,6 +37,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
@ -104,7 +105,7 @@ public class TestMasterCoprocessorExceptionWithAbort {
@Override
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
// cause a NullPointerException and don't catch it: this will cause the
// master to abort().
Integer i;

View File

@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
@ -81,7 +82,7 @@ public class TestMasterCoprocessorExceptionWithRemove {
@SuppressWarnings("null")
@Override
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
// Cause a NullPointerException and don't catch it: this should cause the
// master to throw an o.apache.hadoop.hbase.DoNotRetryIOException to the
// client.

View File

@ -46,12 +46,14 @@ import org.apache.hadoop.hbase.ProcedureInfo;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.MasterSwitchType;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
import org.apache.hadoop.hbase.master.RegionPlan;
@ -316,7 +318,7 @@ public class TestMasterObserver {
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
if (bypass) {
env.bypass();
}
@ -325,7 +327,7 @@ public class TestMasterObserver {
@Override
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
postCreateTableCalled = true;
}
@ -396,7 +398,7 @@ public class TestMasterObserver {
@Override
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> env,
TableName tableName, HTableDescriptor htd) throws IOException {
TableName tableName, TableDescriptor htd) throws IOException {
if (bypass) {
env.bypass();
}else{
@ -407,7 +409,7 @@ public class TestMasterObserver {
@Override
public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> env,
TableName tableName, HTableDescriptor htd) throws IOException {
TableName tableName, TableDescriptor htd) throws IOException {
postModifyTableCalled = true;
}
@ -537,7 +539,7 @@ public class TestMasterObserver {
@Override
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily
TableName tableName, ColumnFamilyDescriptor columnFamily
) throws IOException {
if (bypass) {
ctx.bypass();
@ -556,7 +558,7 @@ public class TestMasterObserver {
@Override
public void postAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
postAddColumnCalled = true;
}
@ -576,7 +578,7 @@ public class TestMasterObserver {
@Override
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
if (bypass) {
ctx.bypass();
}
@ -591,7 +593,7 @@ public class TestMasterObserver {
@Override
public void postModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
postModifyColumnCalled = true;
}
@ -941,14 +943,14 @@ public class TestMasterObserver {
@Override
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
preSnapshotCalled = true;
}
@Override
public void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
postSnapshotCalled = true;
}
@ -975,14 +977,14 @@ public class TestMasterObserver {
@Override
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
preCloneSnapshotCalled = true;
}
@Override
public void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
postCloneSnapshotCalled = true;
}
@ -993,14 +995,14 @@ public class TestMasterObserver {
@Override
public void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
preRestoreSnapshotCalled = true;
}
@Override
public void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
postRestoreSnapshotCalled = true;
}
@ -1035,7 +1037,7 @@ public class TestMasterObserver {
@Override
public void preCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> env,
final HTableDescriptor desc,
final TableDescriptor desc,
final HRegionInfo[] regions) throws IOException {
if (bypass) {
env.bypass();
@ -1053,7 +1055,7 @@ public class TestMasterObserver {
@Override
public void postCompletedCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HTableDescriptor desc,
final TableDescriptor desc,
final HRegionInfo[] regions) throws IOException {
postCompletedCreateTableActionCalled = true;
tableCreationLatch.countDown();
@ -1167,7 +1169,7 @@ public class TestMasterObserver {
public void preModifyTableAction(
final ObserverContext<MasterCoprocessorEnvironment> env,
final TableName tableName,
final HTableDescriptor htd) throws IOException {
final TableDescriptor htd) throws IOException {
if (bypass) {
env.bypass();
}
@ -1178,7 +1180,7 @@ public class TestMasterObserver {
public void postCompletedModifyTableAction(
final ObserverContext<MasterCoprocessorEnvironment> env,
final TableName tableName,
final HTableDescriptor htd) throws IOException {
final TableDescriptor htd) throws IOException {
postCompletedModifyTableActionCalled = true;
}
@ -1201,7 +1203,7 @@ public class TestMasterObserver {
public void preAddColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {
final ColumnFamilyDescriptor columnFamily) throws IOException {
if (bypass) {
ctx.bypass();
}
@ -1219,7 +1221,7 @@ public class TestMasterObserver {
public void postCompletedAddColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {
final ColumnFamilyDescriptor columnFamily) throws IOException {
postCompletedAddColumnFamilyActionCalled = true;
}
@ -1242,7 +1244,7 @@ public class TestMasterObserver {
public void preModifyColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {
final ColumnFamilyDescriptor columnFamily) throws IOException {
if (bypass) {
ctx.bypass();
}
@ -1259,7 +1261,7 @@ public class TestMasterObserver {
@Override
public void postCompletedModifyColumnFamilyAction(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
ColumnFamilyDescriptor columnFamily) throws IOException {
postCompletedModifyColumnFamilyActionCalled = true;
}
@ -1390,14 +1392,14 @@ public class TestMasterObserver {
@Override
public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor> descriptors, String regex)
List<TableName> tableNamesList, List<TableDescriptor> descriptors, String regex)
throws IOException {
preGetTableDescriptorsCalled = true;
}
@Override
public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
String regex) throws IOException {
postGetTableDescriptorsCalled = true;
}
@ -1408,13 +1410,13 @@ public class TestMasterObserver {
@Override
public void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors, String regex) throws IOException {
List<TableDescriptor> descriptors, String regex) throws IOException {
preGetTableNamesCalled = true;
}
@Override
public void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors, String regex) throws IOException {
List<TableDescriptor> descriptors, String regex) throws IOException {
postGetTableNamesCalled = true;
}

View File

@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.TableDescriptors;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.ClusterConnection;
import org.apache.hadoop.hbase.client.MasterSwitchType;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.executor.ExecutorService;
import org.apache.hadoop.hbase.favored.FavoredNodesManager;
import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
@ -236,7 +237,7 @@ public class MockNoopMasterServices implements MasterServices, Server {
}
@Override
public List<HTableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException {
public List<TableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException {
return null; //To change body of implemented methods use File | Settings | File Templates.
}

View File

@ -25,8 +25,6 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Sets;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
@ -58,6 +56,7 @@ import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
@ -554,7 +553,7 @@ public class TestNamespaceAuditor {
@Override
public void preCreateTableAction(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
if (throwExceptionInPreCreateTableAction) {
throw new IOException("Throw exception as it is demanded.");
}

View File

@ -49,6 +49,7 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
@ -629,7 +630,7 @@ public class SecureTestUtil {
@Override
public void postCompletedCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
// the AccessController test, some times calls only and directly the
// postCompletedCreateTableAction()
if (tableCreationLatch != null) {

View File

@ -44,12 +44,12 @@ import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
@ -704,7 +704,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
public Object run() throws Exception {
List<TableName> tableNamesList = Lists.newArrayList();
tableNamesList.add(TEST_TABLE.getTableName());
List<HTableDescriptor> descriptors = Lists.newArrayList();
List<TableDescriptor> descriptors = Lists.newArrayList();
ACCESS_CONTROLLER.preGetTableDescriptors(ObserverContext.createAndPrepare(CP_ENV, null),
tableNamesList, descriptors, ".+");
return null;
@ -715,7 +715,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
verifyAllowed(new AccessTestAction() {
@Override
public Object run() throws Exception {
List<HTableDescriptor> descriptors = Lists.newArrayList();
List<TableDescriptor> descriptors = Lists.newArrayList();
ACCESS_CONTROLLER.preGetTableNames(ObserverContext.createAndPrepare(CP_ENV, null),
descriptors, ".+");
return null;

View File

@ -26,8 +26,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
@ -80,7 +80,7 @@ public class TestSnapshotClientRetries {
@Override
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
if (snapshotCount != null) {
snapshotCount.incrementAndGet();
@ -89,7 +89,7 @@ public class TestSnapshotClientRetries {
@Override
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
throws IOException {
if (cloneCount != null) {
cloneCount.incrementAndGet();

View File

@ -55,9 +55,9 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
@ -598,7 +598,7 @@ public class BaseTestHBaseFsck {
@Override
public void postCompletedCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HTableDescriptor desc,
final TableDescriptor desc,
final HRegionInfo[] regions) throws IOException {
// the AccessController test, some times calls only and directly the
// postCompletedCreateTableAction()