HBASE-18502 Change MasterObserver to use TableDescriptor and ColumnFamilyDescriptor
This commit is contained in:
parent
a7014ce46c
commit
fd76eb39d7
|
@ -24,8 +24,8 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.hbase.CoprocessorEnvironment;
|
import org.apache.hadoop.hbase.CoprocessorEnvironment;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
|
||||||
import org.apache.hadoop.hbase.TableName;
|
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.MasterObserver;
|
||||||
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
||||||
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
|
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
|
||||||
|
@ -68,7 +68,7 @@ public class ExampleMasterObserverWithMetrics implements MasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
// 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.
|
// when the operation starts before the operation is executing.
|
||||||
this.createTableStartTime = System.currentTimeMillis();
|
this.createTableStartTime = System.currentTimeMillis();
|
||||||
|
@ -76,7 +76,7 @@ public class ExampleMasterObserverWithMetrics implements MasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
||||||
if (this.createTableStartTime > 0) {
|
if (this.createTableStartTime > 0) {
|
||||||
long time = System.currentTimeMillis() - this.createTableStartTime;
|
long time = System.currentTimeMillis() - this.createTableStartTime;
|
||||||
LOG.info("Create table took: " + time);
|
LOG.info("Create table took: " + time);
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
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.constraint.ConstraintException;
|
||||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
|
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
|
||||||
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
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 =
|
String groupName =
|
||||||
master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString())
|
master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString())
|
||||||
.getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP);
|
.getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP);
|
||||||
|
@ -293,7 +294,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
|
||||||
// Assign table to default RSGroup.
|
// Assign table to default RSGroup.
|
||||||
@Override
|
@Override
|
||||||
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
||||||
assignTableToGroup(desc);
|
assignTableToGroup(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +331,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
SnapshotDescription snapshot, HTableDescriptor desc) throws IOException {
|
SnapshotDescription snapshot, TableDescriptor desc) throws IOException {
|
||||||
assignTableToGroup(desc);
|
assignTableToGroup(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,10 @@ import org.apache.hadoop.hbase.ServerName;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceStability;
|
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.MasterSwitchType;
|
||||||
import org.apache.hadoop.hbase.client.Mutation;
|
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.RegionPlan;
|
||||||
import org.apache.hadoop.hbase.master.locking.LockProcedure;
|
import org.apache.hadoop.hbase.master.locking.LockProcedure;
|
||||||
import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
|
import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
|
||||||
|
@ -83,21 +85,21 @@ public interface MasterObserver extends Coprocessor {
|
||||||
* table RPC call.
|
* table RPC call.
|
||||||
* It can't bypass the default action, e.g., ctx.bypass() won't have effect.
|
* 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 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
|
* @param regions the initial regions created for the table
|
||||||
*/
|
*/
|
||||||
default void preCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
* Called after the createTable operation has been requested. Called as part
|
||||||
* of create table RPC call.
|
* of create table RPC call.
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @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
|
* @param regions the initial regions created for the table
|
||||||
*/
|
*/
|
||||||
default void postCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
* 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
|
* @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
|
* @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>).
|
* (<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
|
@Deprecated
|
||||||
default void preCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
|
default void preCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
|
||||||
|
@ -124,7 +126,7 @@ public interface MasterObserver extends Coprocessor {
|
||||||
* @param regions the initial regions created 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
|
* @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>).
|
* (<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
|
@Deprecated
|
||||||
default void postCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
|
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.
|
* 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 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
|
* @param regions the initial regions created for the table
|
||||||
*/
|
*/
|
||||||
default void preCreateTableAction(
|
default void preCreateTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final HTableDescriptor desc,
|
final TableDescriptor desc,
|
||||||
final HRegionInfo[] regions) throws IOException {}
|
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.
|
* 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 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
|
* @param regions the initial regions created for the table
|
||||||
*/
|
*/
|
||||||
default void postCompletedCreateTableAction(
|
default void postCompletedCreateTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final HTableDescriptor desc,
|
final TableDescriptor desc,
|
||||||
final HRegionInfo[] regions) throws IOException {}
|
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.
|
* 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 ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param htd the HTableDescriptor
|
* @param htd the TableDescriptor
|
||||||
*/
|
*/
|
||||||
default void preModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
* Called after the modifyTable operation has been requested. Called as part
|
||||||
* of modify table RPC call.
|
* of modify table RPC call.
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @param ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param htd the HTableDescriptor
|
* @param htd the TableDescriptor
|
||||||
*/
|
*/
|
||||||
default void postModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
* 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
|
* @param htd the HTableDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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>).
|
* (<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
|
@Deprecated
|
||||||
default void preModifyTableHandler(
|
default void preModifyTableHandler(
|
||||||
|
@ -385,7 +387,7 @@ public interface MasterObserver extends Coprocessor {
|
||||||
* @param htd the HTableDescriptor
|
* @param htd the HTableDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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>).
|
* (<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
|
@Deprecated
|
||||||
default void postModifyTableHandler(
|
default void postModifyTableHandler(
|
||||||
|
@ -403,12 +405,12 @@ public interface MasterObserver extends Coprocessor {
|
||||||
*
|
*
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @param ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param htd the HTableDescriptor
|
* @param htd the TableDescriptor
|
||||||
*/
|
*/
|
||||||
default void preModifyTableAction(
|
default void preModifyTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final TableName tableName,
|
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
|
* 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 ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param htd the HTableDescriptor
|
* @param htd the TableDescriptor
|
||||||
*/
|
*/
|
||||||
default void postCompletedModifyTableAction(
|
default void postCompletedModifyTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final TableName tableName,
|
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
|
* 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
|
* @param columnFamily the HColumnDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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>).
|
* (<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
|
@Deprecated
|
||||||
default void preAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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 ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param columnFamily the HColumnDescriptor
|
* @param columnFamily the ColumnFamilyDescriptor
|
||||||
*/
|
*/
|
||||||
default void preAddColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
* 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
|
* @param columnFamily the HColumnDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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>).
|
* (<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
|
@Deprecated
|
||||||
default void postAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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 ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param columnFamily the HColumnDescriptor
|
* @param columnFamily the ColumnFamilyDescriptor
|
||||||
*/
|
*/
|
||||||
default void postAddColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
* 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
|
* @param columnFamily the HColumnDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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
|
* (<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
|
@Deprecated
|
||||||
default void preAddColumnHandler(
|
default void preAddColumnHandler(
|
||||||
|
@ -511,12 +513,12 @@ public interface MasterObserver extends Coprocessor {
|
||||||
*
|
*
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @param ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param columnFamily the HColumnDescriptor
|
* @param columnFamily the ColumnFamilyDescriptor
|
||||||
*/
|
*/
|
||||||
default void preAddColumnFamilyAction(
|
default void preAddColumnFamilyAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final TableName tableName,
|
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
|
* 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
|
* @param columnFamily the HColumnDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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
|
* (<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
|
@Deprecated
|
||||||
default void postAddColumnHandler(
|
default void postAddColumnHandler(
|
||||||
|
@ -543,12 +545,12 @@ public interface MasterObserver extends Coprocessor {
|
||||||
*
|
*
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @param ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param columnFamily the HColumnDescriptor
|
* @param columnFamily the ColumnFamilyDescriptor
|
||||||
*/
|
*/
|
||||||
default void postCompletedAddColumnFamilyAction(
|
default void postCompletedAddColumnFamilyAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final TableName tableName,
|
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
|
* 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
|
* @param columnFamily the HColumnDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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>).
|
* (<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
|
@Deprecated
|
||||||
default void preModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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 ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param columnFamily the HColumnDescriptor
|
* @param columnFamily the ColumnFamilyDescriptor
|
||||||
*/
|
*/
|
||||||
default void preModifyColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
* 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
|
* @param columnFamily the HColumnDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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>).
|
* (<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
|
@Deprecated
|
||||||
default void postModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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 ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param columnFamily the HColumnDescriptor
|
* @param columnFamily the ColumnFamilyDescriptor
|
||||||
*/
|
*/
|
||||||
default void postModifyColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
* 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
|
* @param columnFamily the HColumnDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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>).
|
* (<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
|
@Deprecated
|
||||||
default void preModifyColumnHandler(
|
default void preModifyColumnHandler(
|
||||||
|
@ -633,12 +635,12 @@ public interface MasterObserver extends Coprocessor {
|
||||||
*
|
*
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @param ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param columnFamily the HColumnDescriptor
|
* @param columnFamily the ColumnFamilyDescriptor
|
||||||
*/
|
*/
|
||||||
default void preModifyColumnFamilyAction(
|
default void preModifyColumnFamilyAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final TableName tableName,
|
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
|
* 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
|
* @param columnFamily the HColumnDescriptor
|
||||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
|
* @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
|
* (<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
|
@Deprecated
|
||||||
default void postModifyColumnHandler(
|
default void postModifyColumnHandler(
|
||||||
|
@ -665,12 +667,12 @@ public interface MasterObserver extends Coprocessor {
|
||||||
*
|
*
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @param ctx the environment to interact with the framework and master
|
||||||
* @param tableName the name of the table
|
* @param tableName the name of the table
|
||||||
* @param columnFamily the HColumnDescriptor
|
* @param columnFamily the ColumnFamilyDescriptor
|
||||||
*/
|
*/
|
||||||
default void postCompletedModifyColumnFamilyAction(
|
default void postCompletedModifyColumnFamilyAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final TableName tableName,
|
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
|
* 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.
|
* 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 ctx the environment to interact with the framework and master
|
||||||
* @param snapshot the SnapshotDescriptor for the snapshot
|
* @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,
|
default void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {}
|
throws IOException {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1293,10 +1295,10 @@ public interface MasterObserver extends Coprocessor {
|
||||||
* Called as part of snapshot RPC call.
|
* Called as part of snapshot RPC call.
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @param ctx the environment to interact with the framework and master
|
||||||
* @param snapshot the SnapshotDescriptor for the snapshot
|
* @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,
|
default void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {}
|
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.
|
* 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 ctx the environment to interact with the framework and master
|
||||||
* @param snapshot the SnapshotDescriptor for the snapshot
|
* @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,
|
default void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {}
|
throws IOException {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1334,10 +1336,10 @@ public interface MasterObserver extends Coprocessor {
|
||||||
* Called as part of restoreSnapshot RPC call.
|
* Called as part of restoreSnapshot RPC call.
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @param ctx the environment to interact with the framework and master
|
||||||
* @param snapshot the SnapshotDescriptor for the snapshot
|
* @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,
|
default void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {}
|
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.
|
* 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 ctx the environment to interact with the framework and master
|
||||||
* @param snapshot the SnapshotDescriptor for the snapshot
|
* @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,
|
default void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {}
|
throws IOException {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1357,10 +1359,10 @@ public interface MasterObserver extends Coprocessor {
|
||||||
* Called as part of restoreSnapshot RPC call.
|
* Called as part of restoreSnapshot RPC call.
|
||||||
* @param ctx the environment to interact with the framework and master
|
* @param ctx the environment to interact with the framework and master
|
||||||
* @param snapshot the SnapshotDescriptor for the snapshot
|
* @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,
|
default void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {}
|
throws IOException {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1390,7 +1392,7 @@ public interface MasterObserver extends Coprocessor {
|
||||||
* @param regex regular expression used for filtering the table names
|
* @param regex regular expression used for filtering the table names
|
||||||
*/
|
*/
|
||||||
default void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
default void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
|
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
|
||||||
String regex) throws IOException {}
|
String regex) throws IOException {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1401,7 +1403,7 @@ public interface MasterObserver extends Coprocessor {
|
||||||
* @param regex regular expression used for filtering the table names
|
* @param regex regular expression used for filtering the table names
|
||||||
*/
|
*/
|
||||||
default void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
default void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
|
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
|
||||||
String regex) throws IOException {}
|
String regex) throws IOException {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1411,7 +1413,7 @@ public interface MasterObserver extends Coprocessor {
|
||||||
* @param regex regular expression used for filtering the table names
|
* @param regex regular expression used for filtering the table names
|
||||||
*/
|
*/
|
||||||
default void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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.
|
* 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
|
* @param regex regular expression used for filtering the table names
|
||||||
*/
|
*/
|
||||||
default void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
default void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
List<HTableDescriptor> descriptors, String regex) throws IOException {}
|
List<TableDescriptor> descriptors, String regex) throws IOException {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ code, see the {@link org.apache.hadoop.hbase.client.coprocessor} package documen
|
||||||
|
|
||||||
<h2><a name="load">Coprocessor loading</a></h2>
|
<h2><a name="load">Coprocessor loading</a></h2>
|
||||||
A customized coprocessor can be loaded by two different ways, by configuration,
|
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>
|
<p>
|
||||||
(Currently we don't really have an on demand coprocessor loading mechanism for
|
(Currently we don't really have an on demand coprocessor loading mechanism for
|
||||||
opened regions.)
|
opened regions.)
|
||||||
|
@ -255,13 +255,14 @@ policy implementations, perhaps) ahead of observers.
|
||||||
"TestClassloading.jar");
|
"TestClassloading.jar");
|
||||||
|
|
||||||
// create a table that references the jar
|
// create a table that references the jar
|
||||||
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(getClass().getTableName()));
|
TableDescriptor htd = TableDescriptorBuilder
|
||||||
htd.addFamily(new HColumnDescriptor("test"));
|
.newBuilder(TableName.valueOf(getClass().getTableName()))
|
||||||
htd.setValue("Coprocessor$1",
|
.addColumnFamily(ColumnFamilyDescriptorBuilder.of("test"))
|
||||||
path.toString() +
|
.setValue(Bytes.toBytes("Coprocessor$1", path.toString()+
|
||||||
":" + classFullName +
|
":" + classFullName +
|
||||||
":" + Coprocessor.Priority.USER);
|
":" + Coprocessor.Priority.USER))
|
||||||
HBaseAdmin admin = new HBaseAdmin(this.conf);
|
.build();
|
||||||
|
Admin admin = connection.getAdmin();
|
||||||
admin.createTable(htd);
|
admin.createTable(htd);
|
||||||
</pre></blockquote>
|
</pre></blockquote>
|
||||||
<h3>Chain of RegionObservers</h3>
|
<h3>Chain of RegionObservers</h3>
|
||||||
|
|
|
@ -53,6 +53,7 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.hbase.client.TableDescriptor;
|
||||||
import org.apache.hadoop.hbase.ClusterStatus;
|
import org.apache.hadoop.hbase.ClusterStatus;
|
||||||
import org.apache.hadoop.hbase.CoordinatedStateException;
|
import org.apache.hadoop.hbase.CoordinatedStateException;
|
||||||
import org.apache.hadoop.hbase.CoordinatedStateManager;
|
import org.apache.hadoop.hbase.CoordinatedStateManager;
|
||||||
|
@ -2975,7 +2976,7 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HTableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException {
|
public List<TableDescriptor> listTableDescriptorsByNamespace(String name) throws IOException {
|
||||||
checkInitialized();
|
checkInitialized();
|
||||||
return listTableDescriptors(name, null, null, true);
|
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
|
* @param includeSysTables False to match only against userspace tables
|
||||||
* @return the list of table descriptors
|
* @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)
|
final List<TableName> tableNameList, final boolean includeSysTables)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
List<HTableDescriptor> htds = new ArrayList<>();
|
List<TableDescriptor> htds = new ArrayList<>();
|
||||||
boolean bypass = cpHost != null?
|
boolean bypass = cpHost != null?
|
||||||
cpHost.preGetTableDescriptors(tableNameList, htds, regex): false;
|
cpHost.preGetTableDescriptors(tableNameList, htds, regex): false;
|
||||||
if (!bypass) {
|
if (!bypass) {
|
||||||
|
@ -3066,14 +3067,14 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
*/
|
*/
|
||||||
public List<TableName> listTableNames(final String namespace, final String regex,
|
public List<TableName> listTableNames(final String namespace, final String regex,
|
||||||
final boolean includeSysTables) throws IOException {
|
final boolean includeSysTables) throws IOException {
|
||||||
List<HTableDescriptor> htds = new ArrayList<>();
|
List<TableDescriptor> htds = new ArrayList<>();
|
||||||
boolean bypass = cpHost != null? cpHost.preGetTableNames(htds, regex): false;
|
boolean bypass = cpHost != null? cpHost.preGetTableNames(htds, regex): false;
|
||||||
if (!bypass) {
|
if (!bypass) {
|
||||||
htds = getTableDescriptors(htds, namespace, regex, null, includeSysTables);
|
htds = getTableDescriptors(htds, namespace, regex, null, includeSysTables);
|
||||||
if (cpHost != null) cpHost.postGetTableNames(htds, regex);
|
if (cpHost != null) cpHost.postGetTableNames(htds, regex);
|
||||||
}
|
}
|
||||||
List<TableName> result = new ArrayList<>(htds.size());
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3082,7 +3083,7 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
* tables, etc.
|
* tables, etc.
|
||||||
* @throws IOException
|
* @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 String namespace, final String regex, final List<TableName> tableNameList,
|
||||||
final boolean includeSysTables)
|
final boolean includeSysTables)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -3123,12 +3124,12 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
* @param descriptors list of table descriptors to filter
|
* @param descriptors list of table descriptors to filter
|
||||||
* @param pattern the regex to use
|
* @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 Pattern pattern) {
|
||||||
final String defaultNS = NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR;
|
final String defaultNS = NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR;
|
||||||
Iterator<HTableDescriptor> itr = descriptors.iterator();
|
Iterator<TableDescriptor> itr = descriptors.iterator();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
HTableDescriptor htd = itr.next();
|
TableDescriptor htd = itr.next();
|
||||||
String tableName = htd.getTableName().getNameAsString();
|
String tableName = htd.getTableName().getNameAsString();
|
||||||
boolean matched = pattern.matcher(tableName).matches();
|
boolean matched = pattern.matcher(tableName).matches();
|
||||||
if (!matched && htd.getTableName().getNamespaceAsString().equals(defaultNS)) {
|
if (!matched && htd.getTableName().getNamespaceAsString().equals(defaultNS)) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.master;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang.ClassUtils;
|
import org.apache.commons.lang.ClassUtils;
|
||||||
import org.apache.commons.logging.Log;
|
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.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.client.MasterSwitchType;
|
import org.apache.hadoop.hbase.client.MasterSwitchType;
|
||||||
import org.apache.hadoop.hbase.client.Mutation;
|
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.CoprocessorHost;
|
||||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
|
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
|
||||||
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
||||||
|
@ -1259,7 +1261,7 @@ public class MasterCoprocessorHost
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean preGetTableDescriptors(final List<TableName> tableNamesList,
|
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() {
|
return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
|
||||||
@Override
|
@Override
|
||||||
public void call(MasterObserver oserver, ObserverContext<MasterCoprocessorEnvironment> ctx)
|
public void call(MasterObserver oserver, ObserverContext<MasterCoprocessorEnvironment> ctx)
|
||||||
|
@ -1270,7 +1272,7 @@ public class MasterCoprocessorHost
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postGetTableDescriptors(final List<TableName> tableNamesList,
|
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() {
|
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
|
||||||
@Override
|
@Override
|
||||||
public void call(MasterObserver oserver, ObserverContext<MasterCoprocessorEnvironment> ctx)
|
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 {
|
final String regex) throws IOException {
|
||||||
return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
|
return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
|
||||||
@Override
|
@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 {
|
final String regex) throws IOException {
|
||||||
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
|
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.UnknownRegionException;
|
import org.apache.hadoop.hbase.UnknownRegionException;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.client.MasterSwitchType;
|
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.TableState;
|
||||||
import org.apache.hadoop.hbase.client.VersionInfoUtil;
|
import org.apache.hadoop.hbase.client.VersionInfoUtil;
|
||||||
import org.apache.hadoop.hbase.client.replication.ReplicationSerDeHelper;
|
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());
|
tableNameList, req.getIncludeSysTables());
|
||||||
|
|
||||||
GetTableDescriptorsResponse.Builder builder = GetTableDescriptorsResponse.newBuilder();
|
GetTableDescriptorsResponse.Builder builder = GetTableDescriptorsResponse.newBuilder();
|
||||||
if (descriptors != null && descriptors.size() > 0) {
|
if (descriptors != null && descriptors.size() > 0) {
|
||||||
// Add the table descriptors to the response
|
// Add the table descriptors to the response
|
||||||
for (HTableDescriptor htd: descriptors) {
|
for (TableDescriptor htd: descriptors) {
|
||||||
builder.addTableSchema(ProtobufUtil.convertToTableSchema(htd));
|
builder.addTableSchema(ProtobufUtil.convertToTableSchema(htd));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1114,7 +1115,7 @@ public class MasterRpcServices extends RSRpcServices
|
||||||
try {
|
try {
|
||||||
ListTableDescriptorsByNamespaceResponse.Builder b =
|
ListTableDescriptorsByNamespaceResponse.Builder b =
|
||||||
ListTableDescriptorsByNamespaceResponse.newBuilder();
|
ListTableDescriptorsByNamespaceResponse.newBuilder();
|
||||||
for (HTableDescriptor htd : master
|
for (TableDescriptor htd : master
|
||||||
.listTableDescriptorsByNamespace(request.getNamespaceName())) {
|
.listTableDescriptorsByNamespace(request.getNamespaceName())) {
|
||||||
b.addTableSchema(ProtobufUtil.convertToTableSchema(htd));
|
b.addTableSchema(ProtobufUtil.convertToTableSchema(htd));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.TableNotDisabledException;
|
||||||
import org.apache.hadoop.hbase.TableNotFoundException;
|
import org.apache.hadoop.hbase.TableNotFoundException;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.client.MasterSwitchType;
|
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.executor.ExecutorService;
|
||||||
import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
|
import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
|
||||||
import org.apache.hadoop.hbase.master.locking.LockManager;
|
import org.apache.hadoop.hbase.master.locking.LockManager;
|
||||||
|
@ -381,7 +382,7 @@ public interface MasterServices extends Server {
|
||||||
* @return descriptors
|
* @return descriptors
|
||||||
* @throws IOException
|
* @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
|
* Get list of table names by namespace
|
||||||
|
|
|
@ -59,6 +59,7 @@ import org.apache.hadoop.hbase.client.Result;
|
||||||
import org.apache.hadoop.hbase.client.ResultScanner;
|
import org.apache.hadoop.hbase.client.ResultScanner;
|
||||||
import org.apache.hadoop.hbase.client.Scan;
|
import org.apache.hadoop.hbase.client.Scan;
|
||||||
import org.apache.hadoop.hbase.client.Table;
|
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.exceptions.DeserializationException;
|
||||||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||||
import org.apache.hadoop.hbase.filter.QualifierFilter;
|
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.
|
* 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());
|
return ACL_TABLE_NAME.equals(desc.getTableName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,10 +43,8 @@ import org.apache.hadoop.hbase.CompoundConfiguration;
|
||||||
import org.apache.hadoop.hbase.CoprocessorEnvironment;
|
import org.apache.hadoop.hbase.CoprocessorEnvironment;
|
||||||
import org.apache.hadoop.hbase.DoNotRetryIOException;
|
import org.apache.hadoop.hbase.DoNotRetryIOException;
|
||||||
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
|
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
|
||||||
import org.apache.hadoop.hbase.KeyValue;
|
import org.apache.hadoop.hbase.KeyValue;
|
||||||
import org.apache.hadoop.hbase.KeyValue.Type;
|
import org.apache.hadoop.hbase.KeyValue.Type;
|
||||||
import org.apache.hadoop.hbase.MetaTableAccessor;
|
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.Tag;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.client.Append;
|
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.Delete;
|
||||||
import org.apache.hadoop.hbase.client.Durability;
|
import org.apache.hadoop.hbase.client.Durability;
|
||||||
import org.apache.hadoop.hbase.client.Get;
|
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.Result;
|
||||||
import org.apache.hadoop.hbase.client.Scan;
|
import org.apache.hadoop.hbase.client.Scan;
|
||||||
import org.apache.hadoop.hbase.client.Table;
|
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.BulkLoadObserver;
|
||||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
|
import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
|
||||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
|
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.RpcCallback;
|
||||||
import com.google.protobuf.RpcController;
|
import com.google.protobuf.RpcController;
|
||||||
import com.google.protobuf.Service;
|
import com.google.protobuf.Service;
|
||||||
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides basic authorization checks for data access and administrative
|
* Provides basic authorization checks for data access and administrative
|
||||||
|
@ -988,8 +987,8 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> c,
|
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> c,
|
||||||
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
||||||
Set<byte[]> families = desc.getFamiliesKeys();
|
Set<byte[]> families = desc.getColumnFamilyNames();
|
||||||
Map<byte[], Set<byte[]>> familyMap = new TreeMap<>(Bytes.BYTES_COMPARATOR);
|
Map<byte[], Set<byte[]>> familyMap = new TreeMap<>(Bytes.BYTES_COMPARATOR);
|
||||||
for (byte[] family: families) {
|
for (byte[] family: families) {
|
||||||
familyMap.put(family, null);
|
familyMap.put(family, null);
|
||||||
|
@ -1001,7 +1000,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
||||||
@Override
|
@Override
|
||||||
public void postCompletedCreateTableAction(
|
public void postCompletedCreateTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> c,
|
final ObserverContext<MasterCoprocessorEnvironment> c,
|
||||||
final HTableDescriptor desc,
|
final TableDescriptor desc,
|
||||||
final HRegionInfo[] regions) throws IOException {
|
final HRegionInfo[] regions) throws IOException {
|
||||||
// When AC is used, it should be configured as the 1st CP.
|
// 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
|
// 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
|
@Override
|
||||||
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName,
|
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> c, TableName tableName,
|
||||||
HTableDescriptor htd) throws IOException {
|
TableDescriptor htd) throws IOException {
|
||||||
requirePermission(getActiveUser(c), "modifyTable", tableName, null, null,
|
requirePermission(getActiveUser(c), "modifyTable", tableName, null, null,
|
||||||
Action.ADMIN, Action.CREATE);
|
Action.ADMIN, Action.CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> c,
|
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();
|
final Configuration conf = c.getEnvironment().getConfiguration();
|
||||||
// default the table owner to current user, if not specified.
|
// default the table owner to current user, if not specified.
|
||||||
final String owner = (htd.getOwnerString() != null) ? htd.getOwnerString() :
|
final String owner = (htd.getOwnerString() != null) ? htd.getOwnerString() :
|
||||||
|
@ -1134,7 +1133,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HColumnDescriptor columnFamily)
|
TableName tableName, ColumnFamilyDescriptor columnFamily)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
requireTablePermission(getActiveUser(ctx), "addColumn", tableName, columnFamily.getName(), null,
|
requireTablePermission(getActiveUser(ctx), "addColumn", tableName, columnFamily.getName(), null,
|
||||||
Action.ADMIN, Action.CREATE);
|
Action.ADMIN, Action.CREATE);
|
||||||
|
@ -1142,7 +1141,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HColumnDescriptor columnFamily)
|
TableName tableName, ColumnFamilyDescriptor columnFamily)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
requirePermission(getActiveUser(ctx), "modifyColumn", tableName, columnFamily.getName(), null,
|
requirePermission(getActiveUser(ctx), "modifyColumn", tableName, columnFamily.getName(), null,
|
||||||
Action.ADMIN, Action.CREATE);
|
Action.ADMIN, Action.CREATE);
|
||||||
|
@ -1318,7 +1317,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
requirePermission(getActiveUser(ctx), "snapshot " + snapshot.getName(), hTableDescriptor.getTableName(), null, null,
|
requirePermission(getActiveUser(ctx), "snapshot " + snapshot.getName(), hTableDescriptor.getTableName(), null, null,
|
||||||
Permission.Action.ADMIN);
|
Permission.Action.ADMIN);
|
||||||
|
@ -1340,11 +1339,11 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
User user = getActiveUser(ctx);
|
User user = getActiveUser(ctx);
|
||||||
if (SnapshotDescriptionUtils.isSnapshotOwner(snapshot, user)
|
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
|
// Snapshot owner is allowed to create a table with the same name as the snapshot he took
|
||||||
AuthResult result = AuthResult.allow("cloneSnapshot " + snapshot.getName(),
|
AuthResult result = AuthResult.allow("cloneSnapshot " + snapshot.getName(),
|
||||||
"Snapshot owner check allowed", user, null, hTableDescriptor.getTableName(), null);
|
"Snapshot owner check allowed", user, null, hTableDescriptor.getTableName(), null);
|
||||||
|
@ -1356,7 +1355,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
User user = getActiveUser(ctx);
|
User user = getActiveUser(ctx);
|
||||||
if (SnapshotDescriptionUtils.isSnapshotOwner(snapshot, user)) {
|
if (SnapshotDescriptionUtils.isSnapshotOwner(snapshot, user)) {
|
||||||
|
@ -2521,7 +2520,7 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
|
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
|
||||||
String regex) throws IOException {
|
String regex) throws IOException {
|
||||||
// We are delegating the authorization check to postGetTableDescriptors as we don't have
|
// 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.
|
// 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
|
@Override
|
||||||
public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
|
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
|
||||||
String regex) throws IOException {
|
String regex) throws IOException {
|
||||||
// Skipping as checks in this case are already done by preGetTableDescriptors.
|
// Skipping as checks in this case are already done by preGetTableDescriptors.
|
||||||
if (regex == null && tableNamesList != null && !tableNamesList.isEmpty()) {
|
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
|
// Retains only those which passes authorization checks, as the checks weren't done as part
|
||||||
// of preGetTableDescriptors.
|
// of preGetTableDescriptors.
|
||||||
Iterator<HTableDescriptor> itr = descriptors.iterator();
|
Iterator<TableDescriptor> itr = descriptors.iterator();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
HTableDescriptor htd = itr.next();
|
TableDescriptor htd = itr.next();
|
||||||
try {
|
try {
|
||||||
requirePermission(getActiveUser(ctx), "getTableDescriptors", htd.getTableName(), null, null,
|
requirePermission(getActiveUser(ctx), "getTableDescriptors", htd.getTableName(), null, null,
|
||||||
Action.ADMIN, Action.CREATE);
|
Action.ADMIN, Action.CREATE);
|
||||||
|
@ -2564,11 +2563,11 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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.
|
// Retains only those which passes authorization checks.
|
||||||
Iterator<HTableDescriptor> itr = descriptors.iterator();
|
Iterator<TableDescriptor> itr = descriptors.iterator();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
HTableDescriptor htd = itr.next();
|
TableDescriptor htd = itr.next();
|
||||||
try {
|
try {
|
||||||
requireAccess(getActiveUser(ctx), "getTableNames", htd.getTableName(), Action.values());
|
requireAccess(getActiveUser(ctx), "getTableNames", htd.getTableName(), Action.values());
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
|
|
|
@ -19,10 +19,7 @@
|
||||||
package org.apache.hadoop.hbase.security.access;
|
package org.apache.hadoop.hbase.security.access;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
|
||||||
import java.nio.file.PathMatcher;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import org.apache.commons.io.FilenameUtils;
|
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.HBaseInterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
|
||||||
import org.apache.hadoop.hbase.master.MasterServices;
|
import org.apache.hadoop.hbase.master.MasterServices;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
|
import org.apache.hadoop.hbase.client.TableDescriptor;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,13 +55,13 @@ public class CoprocessorWhitelistMasterObserver implements MasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HTableDescriptor htd) throws IOException {
|
TableName tableName, TableDescriptor htd) throws IOException {
|
||||||
verifyCoprocessors(ctx, htd);
|
verifyCoprocessors(ctx, htd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
HTableDescriptor htd, HRegionInfo[] regions) throws IOException {
|
TableDescriptor htd, HRegionInfo[] regions) throws IOException {
|
||||||
verifyCoprocessors(ctx, htd);
|
verifyCoprocessors(ctx, htd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +140,7 @@ public class CoprocessorWhitelistMasterObserver implements MasterObserver {
|
||||||
* @param htd as passed in from the coprocessor
|
* @param htd as passed in from the coprocessor
|
||||||
*/
|
*/
|
||||||
private void verifyCoprocessors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
private void verifyCoprocessors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
HTableDescriptor htd) throws IOException {
|
TableDescriptor htd) throws IOException {
|
||||||
|
|
||||||
MasterServices services = ctx.getEnvironment().getMasterServices();
|
MasterServices services = ctx.getEnvironment().getMasterServices();
|
||||||
Configuration conf = services.getConfiguration();
|
Configuration conf = services.getConfiguration();
|
||||||
|
@ -152,9 +149,8 @@ public class CoprocessorWhitelistMasterObserver implements MasterObserver {
|
||||||
conf.getStringCollection(
|
conf.getStringCollection(
|
||||||
CP_COPROCESSOR_WHITELIST_PATHS_KEY);
|
CP_COPROCESSOR_WHITELIST_PATHS_KEY);
|
||||||
|
|
||||||
List<String> coprocs = htd.getCoprocessors();
|
Collection<String> coprocs = htd.getCoprocessors();
|
||||||
for (int i = 0; i < coprocs.size(); i++) {
|
for (int i = 0; i < coprocs.size(); i++) {
|
||||||
String coproc = coprocs.get(i);
|
|
||||||
|
|
||||||
String coprocSpec = Bytes.toString(htd.getValue(
|
String coprocSpec = Bytes.toString(htd.getValue(
|
||||||
Bytes.toBytes("coprocessor$" + (i + 1))));
|
Bytes.toBytes("coprocessor$" + (i + 1))));
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.apache.hadoop.hbase.TagType;
|
||||||
import org.apache.hadoop.hbase.TagUtil;
|
import org.apache.hadoop.hbase.TagUtil;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.client.Append;
|
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.Delete;
|
||||||
import org.apache.hadoop.hbase.client.Get;
|
import org.apache.hadoop.hbase.client.Get;
|
||||||
import org.apache.hadoop.hbase.client.Increment;
|
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.Put;
|
||||||
import org.apache.hadoop.hbase.client.Result;
|
import org.apache.hadoop.hbase.client.Result;
|
||||||
import org.apache.hadoop.hbase.client.Scan;
|
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.constraint.ConstraintException;
|
||||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
|
import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
|
||||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
|
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
|
||||||
|
@ -215,7 +217,7 @@ public class VisibilityController implements MasterObserver, RegionObserver,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HTableDescriptor htd) throws IOException {
|
TableName tableName, TableDescriptor htd) throws IOException {
|
||||||
if (!authorizationEnabled) {
|
if (!authorizationEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +228,7 @@ public class VisibilityController implements MasterObserver, RegionObserver,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HColumnDescriptor columnFamily)
|
TableName tableName, ColumnFamilyDescriptor columnFamily)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (!authorizationEnabled) {
|
if (!authorizationEnabled) {
|
||||||
return;
|
return;
|
||||||
|
@ -238,7 +240,7 @@ public class VisibilityController implements MasterObserver, RegionObserver,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
|
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
|
||||||
if (!authorizationEnabled) {
|
if (!authorizationEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,11 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
|
import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
|
||||||
import org.apache.hadoop.hbase.client.Admin;
|
import org.apache.hadoop.hbase.client.Admin;
|
||||||
import org.apache.hadoop.hbase.client.Connection;
|
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.CoprocessorHost;
|
||||||
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
||||||
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
|
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
|
||||||
|
@ -81,7 +81,7 @@ public class TestBackupDeleteWithFailures extends TestBackupBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
if (failures.contains(Failure.PRE_SNAPSHOT_FAILURE)) {
|
if (failures.contains(Failure.PRE_SNAPSHOT_FAILURE)) {
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class TestEnableTable {
|
||||||
@Override
|
@Override
|
||||||
public void postCompletedCreateTableAction(
|
public void postCompletedCreateTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final HTableDescriptor desc,
|
final TableDescriptor desc,
|
||||||
final HRegionInfo[] regions) throws IOException {
|
final HRegionInfo[] regions) throws IOException {
|
||||||
// the AccessController test, some times calls only and directly the
|
// the AccessController test, some times calls only and directly the
|
||||||
// postCompletedCreateTableAction()
|
// postCompletedCreateTableAction()
|
||||||
|
|
|
@ -47,6 +47,7 @@ import org.apache.hadoop.hbase.client.Mutation;
|
||||||
import org.apache.hadoop.hbase.client.Put;
|
import org.apache.hadoop.hbase.client.Put;
|
||||||
import org.apache.hadoop.hbase.client.RegionLocator;
|
import org.apache.hadoop.hbase.client.RegionLocator;
|
||||||
import org.apache.hadoop.hbase.client.Table;
|
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.ipc.CoprocessorRpcChannel;
|
||||||
import org.apache.hadoop.hbase.metrics.Counter;
|
import org.apache.hadoop.hbase.metrics.Counter;
|
||||||
import org.apache.hadoop.hbase.metrics.Metric;
|
import org.apache.hadoop.hbase.metrics.Metric;
|
||||||
|
@ -101,14 +102,14 @@ public class TestCoprocessorMetrics {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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 rely on the fact that there is only 1 instance of our MasterObserver
|
||||||
this.start = System.currentTimeMillis();
|
this.start = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
||||||
if (this.start > 0) {
|
if (this.start > 0) {
|
||||||
long time = System.currentTimeMillis() - start;
|
long time = System.currentTimeMillis() - start;
|
||||||
LOG.info("Create table took: " + time);
|
LOG.info("Create table took: " + time);
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.MiniHBaseCluster;
|
import org.apache.hadoop.hbase.MiniHBaseCluster;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.client.Admin;
|
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.HMaster;
|
||||||
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
|
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
|
||||||
import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
|
import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
|
||||||
|
@ -104,7 +105,7 @@ public class TestMasterCoprocessorExceptionWithAbort {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
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
|
// cause a NullPointerException and don't catch it: this will cause the
|
||||||
// master to abort().
|
// master to abort().
|
||||||
Integer i;
|
Integer i;
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.MiniHBaseCluster;
|
import org.apache.hadoop.hbase.MiniHBaseCluster;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.client.Admin;
|
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.HMaster;
|
||||||
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
|
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
|
||||||
import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
|
import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
|
||||||
|
@ -81,7 +82,7 @@ public class TestMasterCoprocessorExceptionWithRemove {
|
||||||
@SuppressWarnings("null")
|
@SuppressWarnings("null")
|
||||||
@Override
|
@Override
|
||||||
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
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
|
// Cause a NullPointerException and don't catch it: this should cause the
|
||||||
// master to throw an o.apache.hadoop.hbase.DoNotRetryIOException to the
|
// master to throw an o.apache.hadoop.hbase.DoNotRetryIOException to the
|
||||||
// client.
|
// client.
|
||||||
|
|
|
@ -46,12 +46,14 @@ import org.apache.hadoop.hbase.ProcedureInfo;
|
||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.client.Admin;
|
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.Connection;
|
||||||
import org.apache.hadoop.hbase.client.ConnectionFactory;
|
import org.apache.hadoop.hbase.client.ConnectionFactory;
|
||||||
import org.apache.hadoop.hbase.client.MasterSwitchType;
|
import org.apache.hadoop.hbase.client.MasterSwitchType;
|
||||||
import org.apache.hadoop.hbase.client.Mutation;
|
import org.apache.hadoop.hbase.client.Mutation;
|
||||||
import org.apache.hadoop.hbase.client.RegionLocator;
|
import org.apache.hadoop.hbase.client.RegionLocator;
|
||||||
import org.apache.hadoop.hbase.client.Table;
|
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.HMaster;
|
||||||
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
|
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
|
||||||
import org.apache.hadoop.hbase.master.RegionPlan;
|
import org.apache.hadoop.hbase.master.RegionPlan;
|
||||||
|
@ -316,7 +318,7 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
||||||
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
env.bypass();
|
env.bypass();
|
||||||
}
|
}
|
||||||
|
@ -325,7 +327,7 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
||||||
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
||||||
postCreateTableCalled = true;
|
postCreateTableCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +398,7 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
||||||
TableName tableName, HTableDescriptor htd) throws IOException {
|
TableName tableName, TableDescriptor htd) throws IOException {
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
env.bypass();
|
env.bypass();
|
||||||
}else{
|
}else{
|
||||||
|
@ -407,7 +409,7 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> env,
|
||||||
TableName tableName, HTableDescriptor htd) throws IOException {
|
TableName tableName, TableDescriptor htd) throws IOException {
|
||||||
postModifyTableCalled = true;
|
postModifyTableCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +539,7 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HColumnDescriptor columnFamily
|
TableName tableName, ColumnFamilyDescriptor columnFamily
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
ctx.bypass();
|
ctx.bypass();
|
||||||
|
@ -556,7 +558,7 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
|
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
|
||||||
postAddColumnCalled = true;
|
postAddColumnCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +578,7 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
|
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
ctx.bypass();
|
ctx.bypass();
|
||||||
}
|
}
|
||||||
|
@ -591,7 +593,7 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
|
TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
|
||||||
postModifyColumnCalled = true;
|
postModifyColumnCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,14 +943,14 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
preSnapshotCalled = true;
|
preSnapshotCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
postSnapshotCalled = true;
|
postSnapshotCalled = true;
|
||||||
}
|
}
|
||||||
|
@ -975,14 +977,14 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
preCloneSnapshotCalled = true;
|
preCloneSnapshotCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
postCloneSnapshotCalled = true;
|
postCloneSnapshotCalled = true;
|
||||||
}
|
}
|
||||||
|
@ -993,14 +995,14 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
preRestoreSnapshotCalled = true;
|
preRestoreSnapshotCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
postRestoreSnapshotCalled = true;
|
postRestoreSnapshotCalled = true;
|
||||||
}
|
}
|
||||||
|
@ -1035,7 +1037,7 @@ public class TestMasterObserver {
|
||||||
@Override
|
@Override
|
||||||
public void preCreateTableAction(
|
public void preCreateTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> env,
|
final ObserverContext<MasterCoprocessorEnvironment> env,
|
||||||
final HTableDescriptor desc,
|
final TableDescriptor desc,
|
||||||
final HRegionInfo[] regions) throws IOException {
|
final HRegionInfo[] regions) throws IOException {
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
env.bypass();
|
env.bypass();
|
||||||
|
@ -1053,7 +1055,7 @@ public class TestMasterObserver {
|
||||||
@Override
|
@Override
|
||||||
public void postCompletedCreateTableAction(
|
public void postCompletedCreateTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final HTableDescriptor desc,
|
final TableDescriptor desc,
|
||||||
final HRegionInfo[] regions) throws IOException {
|
final HRegionInfo[] regions) throws IOException {
|
||||||
postCompletedCreateTableActionCalled = true;
|
postCompletedCreateTableActionCalled = true;
|
||||||
tableCreationLatch.countDown();
|
tableCreationLatch.countDown();
|
||||||
|
@ -1167,7 +1169,7 @@ public class TestMasterObserver {
|
||||||
public void preModifyTableAction(
|
public void preModifyTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> env,
|
final ObserverContext<MasterCoprocessorEnvironment> env,
|
||||||
final TableName tableName,
|
final TableName tableName,
|
||||||
final HTableDescriptor htd) throws IOException {
|
final TableDescriptor htd) throws IOException {
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
env.bypass();
|
env.bypass();
|
||||||
}
|
}
|
||||||
|
@ -1178,7 +1180,7 @@ public class TestMasterObserver {
|
||||||
public void postCompletedModifyTableAction(
|
public void postCompletedModifyTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> env,
|
final ObserverContext<MasterCoprocessorEnvironment> env,
|
||||||
final TableName tableName,
|
final TableName tableName,
|
||||||
final HTableDescriptor htd) throws IOException {
|
final TableDescriptor htd) throws IOException {
|
||||||
postCompletedModifyTableActionCalled = true;
|
postCompletedModifyTableActionCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1201,7 +1203,7 @@ public class TestMasterObserver {
|
||||||
public void preAddColumnFamilyAction(
|
public void preAddColumnFamilyAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final TableName tableName,
|
final TableName tableName,
|
||||||
final HColumnDescriptor columnFamily) throws IOException {
|
final ColumnFamilyDescriptor columnFamily) throws IOException {
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
ctx.bypass();
|
ctx.bypass();
|
||||||
}
|
}
|
||||||
|
@ -1219,7 +1221,7 @@ public class TestMasterObserver {
|
||||||
public void postCompletedAddColumnFamilyAction(
|
public void postCompletedAddColumnFamilyAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final TableName tableName,
|
final TableName tableName,
|
||||||
final HColumnDescriptor columnFamily) throws IOException {
|
final ColumnFamilyDescriptor columnFamily) throws IOException {
|
||||||
postCompletedAddColumnFamilyActionCalled = true;
|
postCompletedAddColumnFamilyActionCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1242,7 +1244,7 @@ public class TestMasterObserver {
|
||||||
public void preModifyColumnFamilyAction(
|
public void preModifyColumnFamilyAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final TableName tableName,
|
final TableName tableName,
|
||||||
final HColumnDescriptor columnFamily) throws IOException {
|
final ColumnFamilyDescriptor columnFamily) throws IOException {
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
ctx.bypass();
|
ctx.bypass();
|
||||||
}
|
}
|
||||||
|
@ -1259,7 +1261,7 @@ public class TestMasterObserver {
|
||||||
@Override
|
@Override
|
||||||
public void postCompletedModifyColumnFamilyAction(
|
public void postCompletedModifyColumnFamilyAction(
|
||||||
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
|
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
|
||||||
HColumnDescriptor columnFamily) throws IOException {
|
ColumnFamilyDescriptor columnFamily) throws IOException {
|
||||||
postCompletedModifyColumnFamilyActionCalled = true;
|
postCompletedModifyColumnFamilyActionCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1390,14 +1392,14 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
List<TableName> tableNamesList, List<HTableDescriptor> descriptors, String regex)
|
List<TableName> tableNamesList, List<TableDescriptor> descriptors, String regex)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
preGetTableDescriptorsCalled = true;
|
preGetTableDescriptorsCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
|
List<TableName> tableNamesList, List<TableDescriptor> descriptors,
|
||||||
String regex) throws IOException {
|
String regex) throws IOException {
|
||||||
postGetTableDescriptorsCalled = true;
|
postGetTableDescriptorsCalled = true;
|
||||||
}
|
}
|
||||||
|
@ -1408,13 +1410,13 @@ public class TestMasterObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
List<HTableDescriptor> descriptors, String regex) throws IOException {
|
List<TableDescriptor> descriptors, String regex) throws IOException {
|
||||||
preGetTableNamesCalled = true;
|
preGetTableNamesCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
List<HTableDescriptor> descriptors, String regex) throws IOException {
|
List<TableDescriptor> descriptors, String regex) throws IOException {
|
||||||
postGetTableNamesCalled = true;
|
postGetTableNamesCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.TableDescriptors;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.client.ClusterConnection;
|
import org.apache.hadoop.hbase.client.ClusterConnection;
|
||||||
import org.apache.hadoop.hbase.client.MasterSwitchType;
|
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.executor.ExecutorService;
|
||||||
import org.apache.hadoop.hbase.favored.FavoredNodesManager;
|
import org.apache.hadoop.hbase.favored.FavoredNodesManager;
|
||||||
import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
|
import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
|
||||||
|
@ -236,7 +237,7 @@ public class MockNoopMasterServices implements MasterServices, Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.
|
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
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.ConnectionFactory;
|
||||||
import org.apache.hadoop.hbase.client.RegionLocator;
|
import org.apache.hadoop.hbase.client.RegionLocator;
|
||||||
import org.apache.hadoop.hbase.client.Table;
|
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.CoprocessorHost;
|
||||||
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
||||||
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
|
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
|
||||||
|
@ -554,7 +553,7 @@ public class TestNamespaceAuditor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCreateTableAction(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preCreateTableAction(ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
TableDescriptor desc, HRegionInfo[] regions) throws IOException {
|
||||||
if (throwExceptionInPreCreateTableAction) {
|
if (throwExceptionInPreCreateTableAction) {
|
||||||
throw new IOException("Throw exception as it is demanded.");
|
throw new IOException("Throw exception as it is demanded.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
|
||||||
import org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException;
|
import org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException;
|
||||||
import org.apache.hadoop.hbase.client.Admin;
|
import org.apache.hadoop.hbase.client.Admin;
|
||||||
import org.apache.hadoop.hbase.client.Table;
|
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.MasterObserver;
|
||||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
|
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
|
||||||
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
|
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
|
||||||
|
@ -629,7 +630,7 @@ public class SecureTestUtil {
|
||||||
@Override
|
@Override
|
||||||
public void postCompletedCreateTableAction(
|
public void postCompletedCreateTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
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
|
// the AccessController test, some times calls only and directly the
|
||||||
// postCompletedCreateTableAction()
|
// postCompletedCreateTableAction()
|
||||||
if (tableCreationLatch != null) {
|
if (tableCreationLatch != null) {
|
||||||
|
|
|
@ -44,12 +44,12 @@ import org.apache.hadoop.hbase.client.Delete;
|
||||||
import org.apache.hadoop.hbase.client.Durability;
|
import org.apache.hadoop.hbase.client.Durability;
|
||||||
import org.apache.hadoop.hbase.client.Get;
|
import org.apache.hadoop.hbase.client.Get;
|
||||||
import org.apache.hadoop.hbase.client.Increment;
|
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.Put;
|
||||||
import org.apache.hadoop.hbase.client.Result;
|
import org.apache.hadoop.hbase.client.Result;
|
||||||
import org.apache.hadoop.hbase.client.ResultScanner;
|
import org.apache.hadoop.hbase.client.ResultScanner;
|
||||||
import org.apache.hadoop.hbase.client.Scan;
|
import org.apache.hadoop.hbase.client.Scan;
|
||||||
import org.apache.hadoop.hbase.client.Table;
|
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.MasterCoprocessorEnvironment;
|
||||||
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
|
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
|
||||||
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
|
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
|
||||||
|
@ -704,7 +704,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
List<TableName> tableNamesList = Lists.newArrayList();
|
List<TableName> tableNamesList = Lists.newArrayList();
|
||||||
tableNamesList.add(TEST_TABLE.getTableName());
|
tableNamesList.add(TEST_TABLE.getTableName());
|
||||||
List<HTableDescriptor> descriptors = Lists.newArrayList();
|
List<TableDescriptor> descriptors = Lists.newArrayList();
|
||||||
ACCESS_CONTROLLER.preGetTableDescriptors(ObserverContext.createAndPrepare(CP_ENV, null),
|
ACCESS_CONTROLLER.preGetTableDescriptors(ObserverContext.createAndPrepare(CP_ENV, null),
|
||||||
tableNamesList, descriptors, ".+");
|
tableNamesList, descriptors, ".+");
|
||||||
return null;
|
return null;
|
||||||
|
@ -715,7 +715,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
|
||||||
verifyAllowed(new AccessTestAction() {
|
verifyAllowed(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
List<HTableDescriptor> descriptors = Lists.newArrayList();
|
List<TableDescriptor> descriptors = Lists.newArrayList();
|
||||||
ACCESS_CONTROLLER.preGetTableNames(ObserverContext.createAndPrepare(CP_ENV, null),
|
ACCESS_CONTROLLER.preGetTableNames(ObserverContext.createAndPrepare(CP_ENV, null),
|
||||||
descriptors, ".+");
|
descriptors, ".+");
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -26,8 +26,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
|
||||||
import org.apache.hadoop.hbase.TableName;
|
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.MasterObserver;
|
||||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
|
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
|
||||||
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
||||||
|
@ -80,7 +80,7 @@ public class TestSnapshotClientRetries {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (snapshotCount != null) {
|
if (snapshotCount != null) {
|
||||||
snapshotCount.incrementAndGet();
|
snapshotCount.incrementAndGet();
|
||||||
|
@ -89,7 +89,7 @@ public class TestSnapshotClientRetries {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
|
final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (cloneCount != null) {
|
if (cloneCount != null) {
|
||||||
cloneCount.incrementAndGet();
|
cloneCount.incrementAndGet();
|
||||||
|
|
|
@ -55,9 +55,9 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
|
||||||
import org.apache.hadoop.hbase.client.Delete;
|
import org.apache.hadoop.hbase.client.Delete;
|
||||||
import org.apache.hadoop.hbase.client.Put;
|
import org.apache.hadoop.hbase.client.Put;
|
||||||
import org.apache.hadoop.hbase.client.RegionLocator;
|
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.Scan;
|
||||||
import org.apache.hadoop.hbase.client.Table;
|
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.MasterObserver;
|
||||||
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
|
||||||
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
|
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
|
||||||
|
@ -598,7 +598,7 @@ public class BaseTestHBaseFsck {
|
||||||
@Override
|
@Override
|
||||||
public void postCompletedCreateTableAction(
|
public void postCompletedCreateTableAction(
|
||||||
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
final ObserverContext<MasterCoprocessorEnvironment> ctx,
|
||||||
final HTableDescriptor desc,
|
final TableDescriptor desc,
|
||||||
final HRegionInfo[] regions) throws IOException {
|
final HRegionInfo[] regions) throws IOException {
|
||||||
// the AccessController test, some times calls only and directly the
|
// the AccessController test, some times calls only and directly the
|
||||||
// postCompletedCreateTableAction()
|
// postCompletedCreateTableAction()
|
||||||
|
|
Loading…
Reference in New Issue