diff --git hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java index 6bc7508..7172f06 100644 --- hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java +++ hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java @@ -310,6 +310,7 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService HRegionInfo[] regions) throws IOException { } + @Deprecated @Override public void preCreateTableHandler(ObserverContext ctx, HTableDescriptor desc, @@ -317,27 +318,56 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override + public void preCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { + } + + @Deprecated + @Override public void postCreateTableHandler(ObserverContext ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException { } @Override + public void postCompletedCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { + } + + @Override public void preDeleteTable(ObserverContext ctx, TableName tableName) throws IOException { } + @Deprecated @Override public void preDeleteTableHandler(ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void preDeleteTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + } + + @Deprecated + @Override public void postDeleteTableHandler(ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedDeleteTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + } + + @Override public void preTruncateTable(ObserverContext ctx, TableName tableName) throws IOException { } @@ -347,17 +377,31 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService TableName tableName) throws IOException { } + @Deprecated @Override public void preTruncateTableHandler(ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void preTruncateTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + } + + @Deprecated + @Override public void postTruncateTableHandler(ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedTruncateTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + } + + @Override public void preModifyTable(ObserverContext ctx, TableName tableName, HTableDescriptor htd) throws IOException { @@ -369,6 +413,7 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService HTableDescriptor htd) throws IOException { } + @Deprecated @Override public void preModifyTableHandler(ObserverContext ctx, TableName tableName, @@ -376,12 +421,27 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override + public void preModifyTableAction( + final ObserverContext ctx, + final TableName tableName, + final HTableDescriptor htd) throws IOException { + } + + @Deprecated + @Override public void postModifyTableHandler(ObserverContext ctx, TableName tableName, HTableDescriptor htd) throws IOException { } @Override + public void postCompletedModifyTableAction( + final ObserverContext ctx, + final TableName tableName, + final HTableDescriptor htd) throws IOException { + } + + @Override public void preAddColumn(ObserverContext ctx, TableName tableName, HColumnDescriptor columnFamily) throws IOException { @@ -405,6 +465,7 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService HColumnDescriptor columnFamily) throws IOException { } + @Deprecated @Override public void preAddColumnHandler(ObserverContext ctx, TableName tableName, @@ -412,11 +473,13 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override - public void preAddColumnFamilyHandler(ObserverContext ctx, - TableName tableName, - HColumnDescriptor columnFamily) throws IOException { + public void preAddColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { } + @Deprecated @Override public void postAddColumnHandler(ObserverContext ctx, TableName tableName, @@ -424,9 +487,10 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override - public void postAddColumnFamilyHandler(ObserverContext ctx, - TableName tableName, - HColumnDescriptor columnFamily) throws IOException { + public void postCompletedAddColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { } @Override @@ -453,6 +517,7 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } + @Deprecated @Override public void preModifyColumnHandler(ObserverContext ctx, TableName tableName, HColumnDescriptor columnFamily) throws IOException { @@ -460,12 +525,15 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override - public void preModifyColumnFamilyHandler(ObserverContext ctx, - TableName tableName, HColumnDescriptor columnFamily) + public void preModifyColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { } + @Deprecated @Override public void postModifyColumnHandler(ObserverContext ctx, TableName tableName, HColumnDescriptor columnFamily) throws @@ -474,8 +542,10 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override - public void postModifyColumnFamilyHandler(ObserverContext ctx, - TableName tableName, HColumnDescriptor columnFamily) + public void postCompletedModifyColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { } @@ -504,6 +574,7 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } + @Deprecated @Override public void preDeleteColumnHandler(ObserverContext ctx, TableName tableName, byte[] columnFamily) throws IOException { @@ -511,12 +582,15 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override - public void preDeleteColumnFamilyHandler(ObserverContext ctx, - TableName tableName, byte[] columnFamily) throws + public void preDeleteColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final byte[] columnFamily) throws IOException { } + @Deprecated @Override public void postDeleteColumnHandler(ObserverContext ctx, TableName tableName, byte[] columnFamily) throws IOException { @@ -524,8 +598,10 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override - public void postDeleteColumnFamilyHandler(ObserverContext ctx, - TableName tableName, byte[] columnFamily) throws + public void postCompletedDeleteColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final byte[] columnFamily) throws IOException { } @@ -542,6 +618,7 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } + @Deprecated @Override public void preEnableTableHandler(ObserverContext ctx, TableName tableName) throws IOException { @@ -549,12 +626,27 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override + public void preEnableTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + + } + + @Deprecated + @Override public void postEnableTableHandler(ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedEnableTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + + } + + @Override public void preDisableTable(ObserverContext ctx, TableName tableName) throws IOException { @@ -566,6 +658,7 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } + @Deprecated @Override public void preDisableTableHandler(ObserverContext ctx, TableName tableName) throws IOException { @@ -573,12 +666,27 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } @Override + public void preDisableTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + + } + + @Deprecated + @Override public void postDisableTableHandler(ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedDisableTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + + } + + @Override public void preMove(ObserverContext ctx, HRegionInfo region, ServerName srcServer, ServerName destServer) throws IOException { diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.java hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.java index 74d9fe1..5a69708 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.java @@ -67,6 +67,7 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver HRegionInfo regionA, HRegionInfo regionB) throws IOException { } + @Deprecated @Override public void preCreateTableHandler( final ObserverContext ctx, @@ -74,12 +75,27 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override + public void preCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { + } + + @Deprecated + @Override public void postCreateTableHandler( final ObserverContext ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException { } @Override + public void postCompletedCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { + } + + @Override public void preDeleteTable(ObserverContext ctx, TableName tableName) throws IOException { } @@ -89,6 +105,7 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver TableName tableName) throws IOException { } + @Deprecated @Override public void preDeleteTableHandler( final ObserverContext ctx, TableName tableName) @@ -96,12 +113,25 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override + public void preDeleteTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException{ + } + + @Deprecated + @Override public void postDeleteTableHandler( final ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedDeleteTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Override public void preTruncateTable(ObserverContext ctx, TableName tableName) throws IOException { } @@ -111,6 +141,7 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver TableName tableName) throws IOException { } + @Deprecated @Override public void preTruncateTableHandler( final ObserverContext ctx, TableName tableName) @@ -118,22 +149,37 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override + public void preTruncateTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Deprecated + @Override public void postTruncateTableHandler( final ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedTruncateTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Override public void preModifyTable(ObserverContext ctx, TableName tableName, HTableDescriptor htd) throws IOException { } + @Deprecated @Override public void postModifyTableHandler( ObserverContext ctx, TableName tableName, HTableDescriptor htd) throws IOException { } + @Deprecated @Override public void preModifyTableHandler( ObserverContext ctx, TableName tableName, @@ -141,6 +187,20 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override + public void preModifyTableAction( + final ObserverContext ctx, + final TableName tableName, + final HTableDescriptor htd) throws IOException { + } + + @Override + public void postCompletedModifyTableAction( + final ObserverContext ctx, + final TableName tableName, + final HTableDescriptor htd) throws IOException { + } + + @Override public void postModifyTable(ObserverContext ctx, TableName tableName, HTableDescriptor htd) throws IOException { } @@ -225,9 +285,10 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override - public void preAddColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { + public void preAddColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { } @Deprecated @@ -238,9 +299,10 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override - public void postAddColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { + public void postCompletedAddColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { } @Deprecated @@ -273,9 +335,10 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override - public void preModifyColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { + public void preModifyColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { } @Deprecated @@ -286,9 +349,10 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override - public void postModifyColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { + public void postCompletedModifyColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { } @Deprecated @@ -321,9 +385,10 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override - public void preDeleteColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - byte[] columnFamily) throws IOException { + public void preDeleteColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final byte[] columnFamily) throws IOException { } @Deprecated @@ -334,9 +399,10 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override - public void postDeleteColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - byte[] columnFamily) throws IOException { + public void postCompletedDeleteColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final byte[] columnFamily) throws IOException { } @@ -350,6 +416,7 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver TableName tableName) throws IOException { } + @Deprecated @Override public void preEnableTableHandler( ObserverContext ctx, TableName tableName) @@ -357,12 +424,24 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override + public void preEnableTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + @Deprecated + @Override public void postEnableTableHandler( ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedEnableTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Override public void preDisableTable(ObserverContext ctx, TableName tableName) throws IOException { } @@ -372,6 +451,7 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver TableName tableName) throws IOException { } + @Deprecated @Override public void preDisableTableHandler( ObserverContext ctx, TableName tableName) @@ -379,12 +459,25 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver } @Override + public void preDisableTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Deprecated + @Override public void postDisableTableHandler( ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedDisableTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Override public void preAbortProcedure( ObserverContext ctx, final ProcedureExecutor procEnv, diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java index 3574bbd..5ed4ede 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java @@ -56,6 +56,20 @@ public class BaseMasterObserver implements MasterObserver { HTableDescriptor desc, HRegionInfo[] regions) throws IOException { } + /** + * Called before a new table is created by + * {@link org.apache.hadoop.hbase.master.HMaster}. Called as part of create + * table handler and it is async to the create RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * @param ctx the environment to interact with the framework and master + * @param desc the HTableDescriptor for the table + * @param regions the initial regions created for the table + * @throws IOException + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preCreateTableAction(ObserverContext, HTableDescriptor, HRegionInfo[])}. + */ + @Deprecated @Override public void preCreateTableHandler( final ObserverContext ctx, @@ -63,12 +77,39 @@ public class BaseMasterObserver implements MasterObserver { } @Override + public void preCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { + } + + /** + * Called after the createTable operation has been requested. Called as part + * of create table RPC call. Called as part of create table handler and + * it is async to the create RPC call. + * @param ctx the environment to interact with the framework and master + * @param desc the HTableDescriptor for the table + * @param regions the initial regions created for the table + * @throws IOException + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedCreateTableAction(ObserverContext, HTableDescriptor, HRegionInfo[])} + */ + @Deprecated + @Override public void postCreateTableHandler( final ObserverContext ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException { } @Override + public void postCompletedCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { + } + + @Override public void preDispatchMerge(final ObserverContext ctx, HRegionInfo regionA, HRegionInfo regionB) throws IOException { } @@ -88,6 +129,18 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName) throws IOException { } + /** + * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a + * table. Called as part of delete table handler and + * it is async to the delete RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preDeleteTableAction(ObserverContext, TableName)}. + */ + @Deprecated @Override public void preDeleteTableHandler( final ObserverContext ctx, TableName tableName) @@ -95,12 +148,36 @@ public class BaseMasterObserver implements MasterObserver { } @Override + public void preDeleteTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException{ + } + + /** + * Called after {@link org.apache.hadoop.hbase.master.HMaster} deletes a + * table. Called as part of delete table handler and it is async to the + * delete RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedDeleteTableAction(ObserverContext, TableName)}. + */ + @Deprecated + @Override public void postDeleteTableHandler( final ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedDeleteTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Override public void preTruncateTable(ObserverContext ctx, TableName tableName) throws IOException { } @@ -110,6 +187,18 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName) throws IOException { } + /** + * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a + * table. Called as part of truncate table handler and it is sync + * to the truncate RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preTruncateTableAction(ObserverContext, TableName)}. + */ + @Deprecated @Override public void preTruncateTableHandler( final ObserverContext ctx, TableName tableName) @@ -117,31 +206,93 @@ public class BaseMasterObserver implements MasterObserver { } @Override + public void preTruncateTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + + /** + * Called after {@link org.apache.hadoop.hbase.master.HMaster} truncates a + * table. Called as part of truncate table handler and it is sync to the + * truncate RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedTruncateTableAction(ObserverContext, TableName)}. + */ + @Deprecated + @Override public void postTruncateTableHandler( final ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedTruncateTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Override public void preModifyTable(ObserverContext ctx, TableName tableName, HTableDescriptor htd) throws IOException { } @Override - public void postModifyTableHandler( + public void postModifyTable(ObserverContext ctx, + TableName tableName, HTableDescriptor htd) throws IOException { + } + + /** + * Called prior to modifying a table's properties. Called as part of modify + * table handler and it is async to the modify table RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param htd the HTableDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preModifyTableAction(ObserverContext, TableName, HTableDescriptor)}. + */ + @Deprecated + @Override + public void preModifyTableHandler( ObserverContext ctx, TableName tableName, HTableDescriptor htd) throws IOException { } @Override - public void preModifyTableHandler( + public void preModifyTableAction( + final ObserverContext ctx, + final TableName tableName, + final HTableDescriptor htd) throws IOException { + } + + /** + * Called after to modifying a table's properties. Called as part of modify + * table handler and it is async to the modify table RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param htd the HTableDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #postCompletedModifyTableAction(ObserverContext, TableName, HTableDescriptor)}. + */ + @Deprecated + @Override + public void postModifyTableHandler( ObserverContext ctx, TableName tableName, HTableDescriptor htd) throws IOException { } @Override - public void postModifyTable(ObserverContext ctx, - TableName tableName, HTableDescriptor htd) throws IOException { + public void postCompletedModifyTableAction( + final ObserverContext ctx, + final TableName tableName, + final HTableDescriptor htd) throws IOException { } @Override @@ -198,6 +349,16 @@ public class BaseMasterObserver implements MasterObserver { List descriptors) throws IOException { } + /** + * Called prior to adding a new column family to the table. Called as part of + * add column RPC call. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the HColumnDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #preAddColumnFamily(ObserverContext, TableName, HColumnDescriptor)}. + */ @Deprecated @Override public void preAddColumn(ObserverContext ctx, @@ -209,6 +370,16 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName, HColumnDescriptor columnFamily) throws IOException { } + /** + * Called after the new column family has been created. Called as part of + * add column RPC call. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the HColumnDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #postAddColumnFamily(ObserverContext, TableName, HColumnDescriptor)}. + */ @Deprecated @Override public void postAddColumn(ObserverContext ctx, @@ -220,6 +391,16 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName, HColumnDescriptor columnFamily) throws IOException { } + /** + * Called prior to adding a new column family to the table. Called as part of + * add column handler. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the HColumnDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). Use + * {@link #preAddColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}. + */ @Deprecated @Override public void preAddColumnHandler( @@ -228,11 +409,22 @@ public class BaseMasterObserver implements MasterObserver { } @Override - public void preAddColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { - } - + public void preAddColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { + } + + /** + * Called after the new column family has been created. Called as part of + * add column handler. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the HColumnDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). Use + * {@link #postCompletedAddColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}. + */ @Deprecated @Override public void postAddColumnHandler( @@ -241,11 +433,22 @@ public class BaseMasterObserver implements MasterObserver { } @Override - public void postAddColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { - } - + public void postCompletedAddColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { + } + + /** + * Called prior to modifying a column family's attributes. Called as part of + * modify column RPC call. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the HColumnDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #preModifyColumnFamily(ObserverContext, TableName, HColumnDescriptor)}. + */ @Deprecated @Override public void preModifyColumn(ObserverContext ctx, @@ -257,6 +460,16 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName, HColumnDescriptor columnFamily) throws IOException { } + /** + * Called after the column family has been updated. Called as part of modify + * column RPC call. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the HColumnDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #postModifyColumnFamily(ObserverContext, TableName, HColumnDescriptor)}. + */ @Deprecated @Override public void postModifyColumn(ObserverContext ctx, @@ -268,6 +481,16 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName, HColumnDescriptor columnFamily) throws IOException { } + /** + * Called prior to modifying a column family's attributes. Called as part of + * modify column handler. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the HColumnDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #preModifyColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}. + */ @Deprecated @Override public void preModifyColumnHandler( @@ -276,11 +499,22 @@ public class BaseMasterObserver implements MasterObserver { } @Override - public void preModifyColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { - } - + public void preModifyColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { + } + + /** + * Called after the column family has been updated. Called as part of modify + * column handler. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the HColumnDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). Use + * {@link #postCompletedModifyColumnFamilyAction(ObserverContext,TableName,HColumnDescriptor)}. + */ @Deprecated @Override public void postModifyColumnHandler( @@ -289,11 +523,22 @@ public class BaseMasterObserver implements MasterObserver { } @Override - public void postModifyColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { - } - + public void postCompletedModifyColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { + } + + /** + * Called prior to deleting the entire column family. Called as part of + * delete column RPC call. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the column family + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #preDeleteColumnFamily(ObserverContext, TableName, byte[])}. + */ @Deprecated @Override public void preDeleteColumn(ObserverContext ctx, @@ -305,6 +550,16 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName, byte[] columnFamily) throws IOException { } + /** + * Called after the column family has been deleted. Called as part of delete + * column RPC call. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the column family + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #postDeleteColumnFamily(ObserverContext, TableName, byte[])}. + */ @Deprecated @Override public void postDeleteColumn(ObserverContext ctx, @@ -316,6 +571,16 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName, byte[] columnFamily) throws IOException { } + /** + * Called prior to deleting the entire column family. Called as part of + * delete column handler. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the column family + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #preDeleteColumnFamilyAction(ObserverContext, TableName, byte[])}. + */ @Deprecated @Override public void preDeleteColumnHandler( @@ -324,11 +589,22 @@ public class BaseMasterObserver implements MasterObserver { } @Override - public void preDeleteColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - byte[] columnFamily) throws IOException { - } - + public void preDeleteColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final byte[] columnFamily) throws IOException { + } + + /** + * Called after the column family has been deleted. Called as part of + * delete column handler. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @param columnFamily the column family + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #postCompletedDeleteColumnFamilyAction(ObserverContext, TableName, byte[])}. + */ @Deprecated @Override public void postDeleteColumnHandler( @@ -337,9 +613,10 @@ public class BaseMasterObserver implements MasterObserver { } @Override - public void postDeleteColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - byte[] columnFamily) throws IOException { + public void postCompletedDeleteColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final byte[] columnFamily) throws IOException { } @@ -353,6 +630,17 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName) throws IOException { } + /** + * Called prior to enabling a table. Called as part of enable table handler + * and it is async to the enable table RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preEnableTableAction(ObserverContext, TableName)}. + */ + @Deprecated @Override public void preEnableTableHandler( ObserverContext ctx, TableName tableName) @@ -360,12 +648,34 @@ public class BaseMasterObserver implements MasterObserver { } @Override + public void preEnableTableAction( + ObserverContext ctx, final TableName tableName) + throws IOException { + } + + /** + * Called after the enableTable operation has been requested. Called as part + * of enable table handler and it is async to the enable table RPC call. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedEnableTableAction(ObserverContext, TableName)}. + */ + @Deprecated + @Override public void postEnableTableHandler( ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedEnableTableAction( + ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Override public void preDisableTable(ObserverContext ctx, TableName tableName) throws IOException { } @@ -375,6 +685,17 @@ public class BaseMasterObserver implements MasterObserver { TableName tableName) throws IOException { } + /** + * Called prior to disabling a table. Called as part of disable table handler + * and it is asyn to the disable table RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preDisableTableAction(ObserverContext, TableName)}. + */ + @Deprecated @Override public void preDisableTableHandler( ObserverContext ctx, TableName tableName) @@ -382,12 +703,34 @@ public class BaseMasterObserver implements MasterObserver { } @Override + public void preDisableTableAction( + ObserverContext ctx, final TableName tableName) + throws IOException { + } + + /** + * Called after the disableTable operation has been requested. Called as part + * of disable table handler and it is asyn to the disable table RPC call. + * @param ctx the environment to interact with the framework and master + * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedDisableTableAction(ObserverContext, TableName)}. + */ + @Deprecated + @Override public void postDisableTableHandler( ObserverContext ctx, TableName tableName) throws IOException { } @Override + public void postCompletedDisableTableAction( + ObserverContext ctx, final TableName tableName) + throws IOException { + } + + @Override public void preAbortProcedure( ObserverContext ctx, final ProcedureExecutor procEnv, diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java index 4b43cfe..0e2be66 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java @@ -74,6 +74,7 @@ public interface MasterObserver extends Coprocessor { */ void postCreateTable(final ObserverContext ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException; + /** * Called before a new table is created by * {@link org.apache.hadoop.hbase.master.HMaster}. Called as part of create @@ -83,7 +84,11 @@ public interface MasterObserver extends Coprocessor { * @param desc the HTableDescriptor for the table * @param regions the initial regions created for the table * @throws IOException + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preCreateTableAction(ObserverContext, HTableDescriptor, HRegionInfo[])}. */ + @Deprecated void preCreateTableHandler(final ObserverContext ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException; @@ -95,11 +100,54 @@ public interface MasterObserver extends Coprocessor { * @param desc the HTableDescriptor for the table * @param regions the initial regions created for the table * @throws IOException + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedCreateTableAction(ObserverContext, HTableDescriptor, HRegionInfo[])} */ + @Deprecated void postCreateTableHandler(final ObserverContext ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException; /** + * Called before a new table is created by + * {@link org.apache.hadoop.hbase.master.HMaster}. Called as part of create + * table procedure and it is async to the create RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * + * Implementation note: This replaces the deprecated + * {@link #preCreateTableHandler(ObserverContext, HTableDescriptor, HRegionInfo[])} method. + * Make sure to implement only one of the two as both are called. + * + * @param ctx the environment to interact with the framework and master + * @param desc the HTableDescriptor for the table + * @param regions the initial regions created for the table + * @throws IOException + */ + void preCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException; + + /** + * Called after the createTable operation has been requested. Called as part + * of create table RPC call. Called as part of create table procedure and + * it is async to the create RPC call. + * + * Implementation note: This replaces the deprecated + * {@link #postCreateTableHandler(ObserverContext, HTableDescriptor, HRegionInfo[])} method. + * Make sure to implement only one of the two as both are called. + * + * @param ctx the environment to interact with the framework and master + * @param desc the HTableDescriptor for the table + * @param regions the initial regions created for the table + * @throws IOException + */ + void postCompletedCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException; + + /** * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a * table. Called as part of delete table RPC call. * It can't bypass the default action, e.g., ctx.bypass() won't have effect. @@ -125,7 +173,11 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preDeleteTableAction(ObserverContext, TableName)}. */ + @Deprecated void preDeleteTableHandler( final ObserverContext ctx, TableName tableName) throws IOException; @@ -137,11 +189,48 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedDeleteTableAction(ObserverContext, TableName)}. */ + @Deprecated void postDeleteTableHandler( final ObserverContext ctx, TableName tableName) throws IOException; + /** + * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a + * table. Called as part of delete table procedure and + * it is async to the delete RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * + * Implementation note: This replaces the deprecated + * {@link #preDeleteTableHandler(ObserverContext, TableName)} method. + * 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 tableName the name of the table + */ + void preDeleteTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException; + + /** + * Called after {@link org.apache.hadoop.hbase.master.HMaster} deletes a + * table. Called as part of delete table procedure and it is async to the + * delete RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * + * Implementation note: This replaces the deprecated + * {@link #postDeleteTableHandler(ObserverContext, TableName)} method. + * 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 tableName the name of the table + */ + void postCompletedDeleteTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException; /** * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a @@ -171,7 +260,11 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preTruncateTableAction(ObserverContext, TableName)}. */ + @Deprecated void preTruncateTableHandler( final ObserverContext ctx, TableName tableName) throws IOException; @@ -183,12 +276,50 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedTruncateTableAction(ObserverContext, TableName)}. */ + @Deprecated void postTruncateTableHandler( final ObserverContext ctx, TableName tableName) throws IOException; /** + * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a + * table. Called as part of truncate table procedure and it is async + * to the truncate RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * + * Implementation note: This replaces the deprecated + * {@link #preTruncateTableHandler(ObserverContext, TableName)} method. + * 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 tableName the name of the table + */ + void preTruncateTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException; + + /** + * Called after {@link org.apache.hadoop.hbase.master.HMaster} truncates a + * table. Called as part of truncate table procedure and it is async to the + * truncate RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * + * Implementation note: This replaces the deprecated + * {@link #postTruncateTableHandler(ObserverContext, TableName)} method. + * 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 tableName the name of the table + */ + void postCompletedTruncateTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException; + + /** * Called prior to modifying a table's properties. Called as part of modify * table RPC call. * It can't bypass the default action, e.g., ctx.bypass() won't have effect. @@ -216,7 +347,11 @@ public interface MasterObserver extends Coprocessor { * @param ctx the environment to interact with the framework and master * @param tableName the name of the table * @param htd the HTableDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preModifyTableAction(ObserverContext, TableName, HTableDescriptor)}. */ + @Deprecated void preModifyTableHandler( final ObserverContext ctx, final TableName tableName, HTableDescriptor htd) throws IOException; @@ -228,12 +363,52 @@ public interface MasterObserver extends Coprocessor { * @param ctx the environment to interact with the framework and master * @param tableName the name of the table * @param htd the HTableDescriptor + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-13645). + * Use {@link #postCompletedModifyTableAction(ObserverContext, TableName, HTableDescriptor)}. */ + @Deprecated void postModifyTableHandler( final ObserverContext ctx, final TableName tableName, HTableDescriptor htd) throws IOException; /** + * Called prior to modifying a table's properties. Called as part of modify + * table procedure and it is async to the modify table RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * + * Implementation note: This replaces the deprecated + * {@link #preModifyTableHandler(ObserverContext, TableName, HTableDescriptor)} method. + * 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 tableName the name of the table + * @param htd the HTableDescriptor + */ + void preModifyTableAction( + final ObserverContext ctx, + final TableName tableName, + final HTableDescriptor htd) throws IOException; + + /** + * Called after to modifying a table's properties. Called as part of modify + * table procedure and it is async to the modify table RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * + * Implementation note: This replaces the deprecated + * {@link #postModifyTableHandler(ObserverContext, TableName, HTableDescriptor)} method. + * 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 tableName the name of the table + * @param htd the HTableDescriptor + */ + void postCompletedModifyTableAction( + final ObserverContext ctx, + final TableName tableName, + final HTableDescriptor htd) throws IOException; + + /** * Called prior to adding a new column family to the table. Called as part of * add column RPC call. * @param ctx the environment to interact with the framework and master @@ -298,8 +473,8 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-13645). Use - * {@link #preAddColumnFamilyHandler(ObserverContext, TableName, HColumnDescriptor)}. + * (HBASE-13645). Use + * {@link #preAddColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}. */ @Deprecated void preAddColumnHandler( @@ -308,7 +483,7 @@ public interface MasterObserver extends Coprocessor { /** * Called prior to adding a new column family to the table. Called as part of - * add column handler. + * add column procedure. * * Implementation note: This replaces the deprecated * {@link #preAddColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method. @@ -318,10 +493,10 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the HColumnDescriptor */ - void preAddColumnFamilyHandler( + void preAddColumnFamilyAction( final ObserverContext ctx, - TableName tableName, HColumnDescriptor columnFamily) throws IOException; - + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException; /** * Called after the new column family has been created. Called as part of @@ -330,8 +505,8 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-13645). Use - * {@link #postAddColumnFamilyHandler(ObserverContext, TableName, HColumnDescriptor)}. + * (HBASE-13645). Use + * {@link #postCompletedAddColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}. */ @Deprecated void postAddColumnHandler( @@ -340,7 +515,7 @@ public interface MasterObserver extends Coprocessor { /** * Called after the new column family has been created. Called as part of - * add column handler. + * add column procedure. * * Implementation note: This replaces the deprecated * {@link #postAddColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method. @@ -350,9 +525,10 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the HColumnDescriptor */ - void postAddColumnFamilyHandler( + void postCompletedAddColumnFamilyAction( final ObserverContext ctx, - TableName tableName, HColumnDescriptor columnFamily) throws IOException; + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException; /** * Called prior to modifying a column family's attributes. Called as part of @@ -419,8 +595,8 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-13645). - * Use {@link #preModifyColumnFamilyHandler(ObserverContext, TableName, HColumnDescriptor)}. + * (HBASE-13645). + * Use {@link #preModifyColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}. */ @Deprecated void preModifyColumnHandler( @@ -429,7 +605,7 @@ public interface MasterObserver extends Coprocessor { /** * Called prior to modifying a column family's attributes. Called as part of - * modify column handler. + * modify column procedure. * * Implementation note: This replaces the deprecated * {@link #preModifyColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method. @@ -439,9 +615,10 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the HColumnDescriptor */ - void preModifyColumnFamilyHandler( + void preModifyColumnFamilyAction( final ObserverContext ctx, - TableName tableName, HColumnDescriptor columnFamily) throws IOException; + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException; /** * Called after the column family has been updated. Called as part of modify @@ -450,8 +627,8 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the HColumnDescriptor * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-13645). - * Use {@link #postModifyColumnFamilyHandler(ObserverContext, TableName, HColumnDescriptor)}. + * (HBASE-13645). Use + * {@link #postCompletedModifyColumnFamilyAction(ObserverContext,TableName,HColumnDescriptor)}. */ @Deprecated void postModifyColumnHandler( @@ -460,7 +637,7 @@ public interface MasterObserver extends Coprocessor { /** * Called after the column family has been updated. Called as part of modify - * column handler. + * column procedure. * * Implementation note: This replaces the deprecated * {@link #postModifyColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method. @@ -470,9 +647,10 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the HColumnDescriptor */ - void postModifyColumnFamilyHandler( + void postCompletedModifyColumnFamilyAction( final ObserverContext ctx, - TableName tableName, HColumnDescriptor columnFamily) throws IOException; + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException; /** * Called prior to deleting the entire column family. Called as part of @@ -540,7 +718,7 @@ public interface MasterObserver extends Coprocessor { * @param columnFamily the column family * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 * (HBASE-13645). - * Use {@link #preDeleteColumnFamilyHandler(ObserverContext, TableName, byte[])}. + * Use {@link #preDeleteColumnFamilyAction(ObserverContext, TableName, byte[])}. */ @Deprecated void preDeleteColumnHandler( @@ -549,7 +727,7 @@ public interface MasterObserver extends Coprocessor { /** * Called prior to deleting the entire column family. Called as part of - * delete column handler. + * delete column procedure. * * Implementation note: This replaces the deprecated * {@link #preDeleteColumnHandler(ObserverContext, TableName, byte[])} method. @@ -559,7 +737,7 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the column family */ - void preDeleteColumnFamilyHandler( + void preDeleteColumnFamilyAction( final ObserverContext ctx, final TableName tableName, final byte[] columnFamily) throws IOException; @@ -570,8 +748,8 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the column family * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * (HBASE-13645). - * Use {@link #postDeleteColumnFamilyHandler(ObserverContext, TableName, byte[])}. + * (HBASE-13645). + * Use {@link #postCompletedDeleteColumnFamilyAction(ObserverContext, TableName, byte[])}. */ @Deprecated void postDeleteColumnHandler( @@ -580,7 +758,7 @@ public interface MasterObserver extends Coprocessor { /** * Called after the column family has been deleted. Called as part of - * delete column handler. + * delete column procedure. * * Implementation note: This replaces the deprecated * {@link #postDeleteColumnHandler(ObserverContext, TableName, byte[])} method. @@ -590,7 +768,7 @@ public interface MasterObserver extends Coprocessor { * @param tableName the name of the table * @param columnFamily the column family */ - void postDeleteColumnFamilyHandler( + void postCompletedDeleteColumnFamilyAction( final ObserverContext ctx, final TableName tableName, final byte[] columnFamily) throws IOException; @@ -618,7 +796,11 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preEnableTableAction(ObserverContext, TableName)}. */ + @Deprecated void preEnableTableHandler( final ObserverContext ctx, final TableName tableName) throws IOException; @@ -628,12 +810,47 @@ public interface MasterObserver extends Coprocessor { * of enable table handler and it is async to the enable table RPC call. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedEnableTableAction(ObserverContext, TableName)}. */ + @Deprecated void postEnableTableHandler( final ObserverContext ctx, final TableName tableName) throws IOException; /** + * Called prior to enabling a table. Called as part of enable table procedure + * and it is async to the enable table RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * + * Implementation note: This replaces the deprecated + * {@link #preEnableTableHandler(ObserverContext, TableName)} method. + * 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 tableName the name of the table + */ + void preEnableTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException; + + /** + * Called after the enableTable operation has been requested. Called as part + * of enable table procedure and it is async to the enable table RPC call. + * + * Implementation note: This replaces the deprecated + * {@link #postEnableTableHandler(ObserverContext, TableName)} method. + * 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 tableName the name of the table + */ + void postCompletedEnableTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException; + + /** * Called prior to disabling a table. Called as part of disable table RPC * call. * It can't bypass the default action, e.g., ctx.bypass() won't have effect. @@ -658,7 +875,11 @@ public interface MasterObserver extends Coprocessor { * It can't bypass the default action, e.g., ctx.bypass() won't have effect. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #preDisableTableAction(ObserverContext, TableName)}. */ + @Deprecated void preDisableTableHandler( final ObserverContext ctx, final TableName tableName) throws IOException; @@ -668,15 +889,52 @@ public interface MasterObserver extends Coprocessor { * of disable table handler and it is asyn to the disable table RPC call. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * (HBASE-15575). + * Use {@link #postCompletedDisableTableAction(ObserverContext, TableName)}. */ + @Deprecated void postDisableTableHandler( final ObserverContext ctx, final TableName tableName) throws IOException; /** + * Called prior to disabling a table. Called as part of disable table procedure + * and it is asyn to the disable table RPC call. + * It can't bypass the default action, e.g., ctx.bypass() won't have effect. + * + * Implementation note: This replaces the deprecated + * {@link #preDisableTableHandler(ObserverContext, TableName)} method. + * 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 tableName the name of the table + */ + void preDisableTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException; + + /** + * Called after the disableTable operation has been requested. Called as part + * of disable table procedure and it is asyn to the disable table RPC call. + * + * Implementation note: This replaces the deprecated + * {@link #postDisableTableHandler(ObserverContext, TableName)} method. + * 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 tableName the name of the table + */ + void postCompletedDisableTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException; + + /** * Called before a abortProcedure request has been processed. * @param ctx the environment to interact with the framework and master - * @throws IOException + * @param procEnv procedure executor + * @param procId the Id of the procedure + * @throws IOException if something went wrong */ public void preAbortProcedure( ObserverContext ctx, @@ -686,6 +944,7 @@ public interface MasterObserver extends Coprocessor { /** * Called after a abortProcedure request has been processed. * @param ctx the environment to interact with the framework and master + * @throws IOException if something went wrong */ public void postAbortProcedure(ObserverContext ctx) throws IOException; @@ -693,7 +952,7 @@ public interface MasterObserver extends Coprocessor { /** * Called before a listProcedures request has been processed. * @param ctx the environment to interact with the framework and master - * @throws IOException + * @throws IOException if something went wrong */ void preListProcedures(ObserverContext ctx) throws IOException; @@ -702,6 +961,7 @@ public interface MasterObserver extends Coprocessor { * Called after a listProcedures request has been processed. * @param ctx the environment to interact with the framework and master * @param procInfoList the list of procedures about to be returned + * @throws IOException if something went wrong */ void postListProcedures( ObserverContext ctx, diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index ff3d792..c2cab33 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -1082,7 +1082,7 @@ public class HMaster extends HRegionServer implements MasterServices { // at a time. To do concurrency, would need fencing of enable/disable of // tables. // Any time changing this maxThreads to > 1, pls see the comment at - // AccessController#postCreateTableHandler + // AccessController#postCompletedCreateTableAction this.service.startExecutorService(ExecutorType.MASTER_TABLE_OPERATIONS, 1); startProcedureExecutor(); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java index 14e8c20..459fd01 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java @@ -240,24 +240,26 @@ public class MasterCoprocessorHost }); } - public void preCreateTableHandler(final HTableDescriptor htd, final HRegionInfo[] regions) + public void preCreateTableAction(final HTableDescriptor htd, final HRegionInfo[] regions) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.preCreateTableHandler(ctx, htd, regions); + oserver.preCreateTableAction(ctx, htd, regions); } }); } - public void postCreateTableHandler(final HTableDescriptor htd, final HRegionInfo[] regions) - throws IOException { + public void postCompletedCreateTableAction( + final HTableDescriptor htd, final HRegionInfo[] regions) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.postCreateTableHandler(ctx, htd, regions); + oserver.postCompletedCreateTableAction(ctx, htd, regions); } }); } @@ -282,22 +284,24 @@ public class MasterCoprocessorHost }); } - public void preDeleteTableHandler(final TableName tableName) throws IOException { + public void preDeleteTableAction(final TableName tableName) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.preDeleteTableHandler(ctx, tableName); + oserver.preDeleteTableAction(ctx, tableName); } }); } - public void postDeleteTableHandler(final TableName tableName) throws IOException { + public void postCompletedDeleteTableAction(final TableName tableName) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.postDeleteTableHandler(ctx, tableName); + oserver.postCompletedDeleteTableAction(ctx, tableName); } }); } @@ -322,22 +326,24 @@ public class MasterCoprocessorHost }); } - public void preTruncateTableHandler(final TableName tableName) throws IOException { + public void preTruncateTableAction(final TableName tableName) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.preTruncateTableHandler(ctx, tableName); + oserver.preTruncateTableAction(ctx, tableName); } }); } - public void postTruncateTableHandler(final TableName tableName) throws IOException { + public void postCompletedTruncateTableAction(final TableName tableName) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.postTruncateTableHandler(ctx, tableName); + oserver.postCompletedTruncateTableAction(ctx, tableName); } }); } @@ -364,24 +370,26 @@ public class MasterCoprocessorHost }); } - public void preModifyTableHandler(final TableName tableName, final HTableDescriptor htd) + public void preModifyTableAction(final TableName tableName, final HTableDescriptor htd) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.preModifyTableHandler(ctx, tableName, htd); + oserver.preModifyTableAction(ctx, tableName, htd); } }); } - public void postModifyTableHandler(final TableName tableName, final HTableDescriptor htd) + public void postCompletedModifyTableAction(final TableName tableName, final HTableDescriptor htd) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.postModifyTableHandler(ctx, tableName, htd); + oserver.postCompletedModifyTableAction(ctx, tableName, htd); } }); } @@ -410,27 +418,30 @@ public class MasterCoprocessorHost }); } - public boolean preAddColumnHandler(final TableName tableName, - final HColumnDescriptor columnFamily) + public boolean preAddColumnFamilyAction( + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.preAddColumnHandler(ctx, tableName, columnFamily); - oserver.preAddColumnFamilyHandler(ctx, tableName, columnFamily); + oserver.preAddColumnFamilyAction(ctx, tableName, columnFamily); } }); } - public void postAddColumnHandler(final TableName tableName, final HColumnDescriptor columnFamily) + public void postCompletedAddColumnFamilyAction( + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.postAddColumnHandler(ctx, tableName, columnFamily); - oserver.postAddColumnFamilyHandler(ctx, tableName, columnFamily); + oserver.postCompletedAddColumnFamilyAction(ctx, tableName, columnFamily); } }); } @@ -459,26 +470,28 @@ public class MasterCoprocessorHost }); } - public boolean preModifyColumnHandler(final TableName tableName, + public boolean preModifyColumnFamilyAction( + final TableName tableName, final HColumnDescriptor columnFamily) throws IOException { return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.preModifyColumnHandler(ctx, tableName, columnFamily); - oserver.preModifyColumnFamilyHandler(ctx, tableName, columnFamily); + oserver.preModifyColumnFamilyAction(ctx, tableName, columnFamily); } }); } - public void postModifyColumnHandler(final TableName tableName, + public void postCompletedModifyColumnFamilyAction( + final TableName tableName, final HColumnDescriptor columnFamily) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.postModifyColumnHandler(ctx, tableName, columnFamily); - oserver.postModifyColumnFamilyHandler(ctx, tableName, columnFamily); + oserver.postCompletedModifyColumnFamilyAction(ctx, tableName, columnFamily); } }); } @@ -507,26 +520,28 @@ public class MasterCoprocessorHost }); } - public boolean preDeleteColumnHandler(final TableName tableName, final byte[] columnFamily) + public boolean preDeleteColumnFamilyAction( + final TableName tableName, + final byte[] columnFamily) throws IOException { return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.preDeleteColumnHandler(ctx, tableName, columnFamily); - oserver.preDeleteColumnFamilyHandler(ctx, tableName, columnFamily); + oserver.preDeleteColumnFamilyAction(ctx, tableName, columnFamily); } }); } - public void postDeleteColumnHandler(final TableName tableName, final byte[] columnFamily) - throws IOException { + public void postCompletedDeleteColumnFamilyAction( + final TableName tableName, final byte[] columnFamily) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.postDeleteColumnHandler(ctx, tableName, columnFamily); - oserver.postDeleteColumnFamilyHandler(ctx, tableName, columnFamily); + oserver.postCompletedDeleteColumnFamilyAction(ctx, tableName, columnFamily); } }); } @@ -551,22 +566,24 @@ public class MasterCoprocessorHost }); } - public void preEnableTableHandler(final TableName tableName) throws IOException { + public void preEnableTableAction(final TableName tableName) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.preEnableTableHandler(ctx, tableName); + oserver.preEnableTableAction(ctx, tableName); } }); } - public void postEnableTableHandler(final TableName tableName) throws IOException { + public void postCompletedEnableTableAction(final TableName tableName) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.postEnableTableHandler(ctx, tableName); + oserver.postCompletedEnableTableAction(ctx, tableName); } }); } @@ -591,22 +608,24 @@ public class MasterCoprocessorHost }); } - public void preDisableTableHandler(final TableName tableName) throws IOException { + public void preDisableTableAction(final TableName tableName) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.preDisableTableHandler(ctx, tableName); + oserver.preDisableTableAction(ctx, tableName); } }); } - public void postDisableTableHandler(final TableName tableName) throws IOException { + public void postCompletedDisableTableAction(final TableName tableName) throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override public void call(MasterObserver oserver, ObserverContext ctx) throws IOException { oserver.postDisableTableHandler(ctx, tableName); + oserver.postCompletedDisableTableAction(ctx, tableName); } }); } diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java index d34f25e..bfa9b5f 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java @@ -126,11 +126,11 @@ public class DisableTableHandler extends EventHandler { MasterCoprocessorHost cpHost = ((HMaster) this.server) .getMasterCoprocessorHost(); if (cpHost != null) { - cpHost.preDisableTableHandler(this.tableName); + cpHost.preDisableTableAction(this.tableName); } handleDisableTable(); if (cpHost != null) { - cpHost.postDisableTableHandler(this.tableName); + cpHost.postCompletedDisableTableAction(this.tableName); } } catch (IOException e) { LOG.error("Error trying to disable table " + this.tableName, e); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java index fd3d4c7..7edf3f1 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java @@ -135,11 +135,11 @@ public class EnableTableHandler extends EventHandler { MasterCoprocessorHost cpHost = ((HMaster) this.server) .getMasterCoprocessorHost(); if (cpHost != null) { - cpHost.preEnableTableHandler(this.tableName); + cpHost.preEnableTableAction(this.tableName); } handleEnableTable(); if (cpHost != null) { - cpHost.postEnableTableHandler(this.tableName); + cpHost.postCompletedEnableTableAction(this.tableName); } } catch (IOException | InterruptedException e) { LOG.error("Error trying to enable the table " + this.tableName, e); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AddColumnFamilyProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AddColumnFamilyProcedure.java index 2571829..4a6c67d 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AddColumnFamilyProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AddColumnFamilyProcedure.java @@ -383,10 +383,10 @@ public class AddColumnFamilyProcedure public Void run() throws Exception { switch (state) { case ADD_COLUMN_FAMILY_PRE_OPERATION: - cpHost.preAddColumnHandler(tableName, cfDescriptor); + cpHost.preAddColumnFamilyAction(tableName, cfDescriptor); break; case ADD_COLUMN_FAMILY_POST_OPERATION: - cpHost.postAddColumnHandler(tableName, cfDescriptor); + cpHost.postCompletedAddColumnFamilyAction(tableName, cfDescriptor); break; default: throw new UnsupportedOperationException(this + " unhandled state=" + state); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CloneSnapshotProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CloneSnapshotProcedure.java index 2a84a15..c008b36 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CloneSnapshotProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CloneSnapshotProcedure.java @@ -376,7 +376,7 @@ public class CloneSnapshotProcedure user.doAs(new PrivilegedExceptionAction() { @Override public Void run() throws Exception { - cpHost.preCreateTableHandler(hTableDescriptor, null); + cpHost.preCreateTableAction(hTableDescriptor, null); return null; } }); @@ -398,7 +398,7 @@ public class CloneSnapshotProcedure user.doAs(new PrivilegedExceptionAction() { @Override public Void run() throws Exception { - cpHost.postCreateTableHandler(hTableDescriptor, regions); + cpHost.postCompletedCreateTableAction(hTableDescriptor, regions); return null; } }); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.java index 51fc74c..110bccd 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CreateTableProcedure.java @@ -311,7 +311,7 @@ public class CreateTableProcedure user.doAs(new PrivilegedExceptionAction() { @Override public Void run() throws Exception { - cpHost.preCreateTableHandler(hTableDescriptor, regions); + cpHost.preCreateTableAction(hTableDescriptor, regions); return null; } }); @@ -327,7 +327,7 @@ public class CreateTableProcedure user.doAs(new PrivilegedExceptionAction() { @Override public Void run() throws Exception { - cpHost.postCreateTableHandler(hTableDescriptor, regions); + cpHost.postCompletedCreateTableAction(hTableDescriptor, regions); return null; } }); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteColumnFamilyProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteColumnFamilyProcedure.java index 442ed72..1e510b3 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteColumnFamilyProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteColumnFamilyProcedure.java @@ -408,10 +408,10 @@ public class DeleteColumnFamilyProcedure public Void run() throws Exception { switch (state) { case DELETE_COLUMN_FAMILY_PRE_OPERATION: - cpHost.preDeleteColumnHandler(tableName, familyName); + cpHost.preDeleteColumnFamilyAction(tableName, familyName); break; case DELETE_COLUMN_FAMILY_POST_OPERATION: - cpHost.postDeleteColumnHandler(tableName, familyName); + cpHost.postCompletedDeleteColumnFamilyAction(tableName, familyName); break; default: throw new UnsupportedOperationException(this + " unhandled state=" + state); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java index ff22b88..4c92fb5 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java @@ -269,7 +269,7 @@ public class DeleteTableProcedure user.doAs(new PrivilegedExceptionAction() { @Override public Void run() throws Exception { - cpHost.preDeleteTableHandler(tableName); + cpHost.preDeleteTableAction(tableName); return null; } }); @@ -287,7 +287,7 @@ public class DeleteTableProcedure user.doAs(new PrivilegedExceptionAction() { @Override public Void run() throws Exception { - cpHost.postDeleteTableHandler(tableName); + cpHost.postCompletedDeleteTableAction(tableName); return null; } }); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DisableTableProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DisableTableProcedure.java index 005069d..6a65690 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DisableTableProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DisableTableProcedure.java @@ -464,10 +464,10 @@ public class DisableTableProcedure public Void run() throws Exception { switch (state) { case DISABLE_TABLE_PRE_OPERATION: - cpHost.preDisableTableHandler(tableName); + cpHost.preDisableTableAction(tableName); break; case DISABLE_TABLE_POST_OPERATION: - cpHost.postDisableTableHandler(tableName); + cpHost.postCompletedDisableTableAction(tableName); break; default: throw new UnsupportedOperationException(this + " unhandled state=" + state); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/EnableTableProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/EnableTableProcedure.java index d8af419..862231e 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/EnableTableProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/EnableTableProcedure.java @@ -566,10 +566,10 @@ public class EnableTableProcedure public Void run() throws Exception { switch (state) { case ENABLE_TABLE_PRE_OPERATION: - cpHost.preEnableTableHandler(getTableName()); + cpHost.preEnableTableAction(getTableName()); break; case ENABLE_TABLE_POST_OPERATION: - cpHost.postEnableTableHandler(getTableName()); + cpHost.postCompletedEnableTableAction(getTableName()); break; default: throw new UnsupportedOperationException(this + " unhandled state=" + state); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ModifyColumnFamilyProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ModifyColumnFamilyProcedure.java index 0479c36..0b7d8a2 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ModifyColumnFamilyProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ModifyColumnFamilyProcedure.java @@ -364,10 +364,10 @@ public class ModifyColumnFamilyProcedure public Void run() throws Exception { switch (state) { case MODIFY_COLUMN_FAMILY_PRE_OPERATION: - cpHost.preModifyColumnHandler(tableName, cfDescriptor); + cpHost.preModifyColumnFamilyAction(tableName, cfDescriptor); break; case MODIFY_COLUMN_FAMILY_POST_OPERATION: - cpHost.postModifyColumnHandler(tableName, cfDescriptor); + cpHost.postCompletedModifyColumnFamilyAction(tableName, cfDescriptor); break; default: throw new UnsupportedOperationException(this + " unhandled state=" + state); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ModifyTableProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ModifyTableProcedure.java index 8e907ec..8f088da 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ModifyTableProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ModifyTableProcedure.java @@ -477,10 +477,10 @@ public class ModifyTableProcedure public Void run() throws Exception { switch (state) { case MODIFY_TABLE_PRE_OPERATION: - cpHost.preModifyTableHandler(getTableName(), modifiedHTableDescriptor); + cpHost.preModifyTableAction(getTableName(), modifiedHTableDescriptor); break; case MODIFY_TABLE_POST_OPERATION: - cpHost.postModifyTableHandler(getTableName(), modifiedHTableDescriptor); + cpHost.postCompletedModifyTableAction(getTableName(), modifiedHTableDescriptor); break; default: throw new UnsupportedOperationException(this + " unhandled state=" + state); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/TruncateTableProcedure.java hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/TruncateTableProcedure.java index 40f8157..9abed52 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/TruncateTableProcedure.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/TruncateTableProcedure.java @@ -264,7 +264,7 @@ public class TruncateTableProcedure user.doAs(new PrivilegedExceptionAction() { @Override public Void run() throws Exception { - cpHost.preTruncateTableHandler(tableName); + cpHost.preTruncateTableAction(tableName); return null; } }); @@ -280,7 +280,7 @@ public class TruncateTableProcedure user.doAs(new PrivilegedExceptionAction() { @Override public Void run() throws Exception { - cpHost.postTruncateTableHandler(tableName); + cpHost.postCompletedTruncateTableAction(tableName); return null; } }); diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java index e866f29..f21d8e2 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java @@ -1005,8 +1005,10 @@ public class AccessController extends BaseMasterAndRegionObserver } @Override - public void postCreateTableHandler(final ObserverContext c, - HTableDescriptor desc, HRegionInfo[] regions) throws IOException { + public void postCompletedCreateTableAction( + final ObserverContext c, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { // When AC is used, it should be configured as the 1st CP. // In Master, the table operations like create, are handled by a Thread pool but the max size // for this pool is 1. So if multiple CPs create tables on startup, these creations will happen diff --git hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java index 5257cee..73917cd 100644 --- hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java +++ hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java @@ -152,24 +152,24 @@ public class TestMasterObserver { private boolean postRestoreSnapshotCalled; private boolean preDeleteSnapshotCalled; private boolean postDeleteSnapshotCalled; - private boolean preCreateTableHandlerCalled; - private boolean postCreateTableHandlerCalled; - private boolean preDeleteTableHandlerCalled; - private boolean postDeleteTableHandlerCalled; - private boolean preTruncateTableHandlerCalled; - private boolean postTruncateTableHandlerCalled; - private boolean preAddColumnHandlerCalled; - private boolean postAddColumnHandlerCalled; - private boolean preModifyColumnHandlerCalled; - private boolean postModifyColumnHandlerCalled; - private boolean preDeleteColumnHandlerCalled; - private boolean postDeleteColumnHandlerCalled; - private boolean preEnableTableHandlerCalled; - private boolean postEnableTableHandlerCalled; - private boolean preDisableTableHandlerCalled; - private boolean postDisableTableHandlerCalled; - private boolean preModifyTableHandlerCalled; - private boolean postModifyTableHandlerCalled; + private boolean preCreateTableActionCalled; + private boolean postCompletedCreateTableActionCalled; + private boolean preDeleteTableActionCalled; + private boolean postCompletedDeleteTableActionCalled; + private boolean preTruncateTableActionCalled; + private boolean postCompletedTruncateTableActionCalled; + private boolean preAddColumnFamilyActionCalled; + private boolean postCompletedAddColumnFamilyActionCalled; + private boolean preModifyColumnFamilyActionCalled; + private boolean postCompletedModifyColumnFamilyActionCalled; + private boolean preDeleteColumnFamilyActionCalled; + private boolean postCompletedDeleteColumnFamilyActionCalled; + private boolean preEnableTableActionCalled; + private boolean postCompletedEnableTableActionCalled; + private boolean preDisableTableActionCalled; + private boolean postCompletedDisableTableActionCalled; + private boolean preModifyTableActionCalled; + private boolean postCompletedModifyTableActionCalled; private boolean preGetTableDescriptorsCalled; private boolean postGetTableDescriptorsCalled; private boolean postGetTableNamesCalled; @@ -236,24 +236,24 @@ public class TestMasterObserver { postRestoreSnapshotCalled = false; preDeleteSnapshotCalled = false; postDeleteSnapshotCalled = false; - preCreateTableHandlerCalled = false; - postCreateTableHandlerCalled = false; - preDeleteTableHandlerCalled = false; - postDeleteTableHandlerCalled = false; - preTruncateTableHandlerCalled = false; - postTruncateTableHandlerCalled = false; - preModifyTableHandlerCalled = false; - postModifyTableHandlerCalled = false; - preAddColumnHandlerCalled = false; - postAddColumnHandlerCalled = false; - preModifyColumnHandlerCalled = false; - postModifyColumnHandlerCalled = false; - preDeleteColumnHandlerCalled = false; - postDeleteColumnHandlerCalled = false; - preEnableTableHandlerCalled = false; - postEnableTableHandlerCalled = false; - preDisableTableHandlerCalled = false; - postDisableTableHandlerCalled = false; + preCreateTableActionCalled = false; + postCompletedCreateTableActionCalled = false; + preDeleteTableActionCalled = false; + postCompletedDeleteTableActionCalled = false; + preTruncateTableActionCalled = false; + postCompletedTruncateTableActionCalled = false; + preModifyTableActionCalled = false; + postCompletedModifyTableActionCalled = false; + preAddColumnFamilyActionCalled = false; + postCompletedAddColumnFamilyActionCalled = false; + preModifyColumnFamilyActionCalled = false; + postCompletedModifyColumnFamilyActionCalled = false; + preDeleteColumnFamilyActionCalled = false; + postCompletedDeleteColumnFamilyActionCalled = false; + preEnableTableActionCalled = false; + postCompletedEnableTableActionCalled = false; + preDisableTableActionCalled = false; + postCompletedDisableTableActionCalled = false; preGetTableDescriptorsCalled = false; postGetTableDescriptorsCalled = false; postGetTableNamesCalled = false; @@ -962,109 +962,169 @@ public class TestMasterObserver { return preDeleteSnapshotCalled && postDeleteSnapshotCalled; } + @Deprecated @Override public void preCreateTableHandler( ObserverContext env, HTableDescriptor desc, HRegionInfo[] regions) throws IOException { + } + + @Override + public void preCreateTableAction( + final ObserverContext env, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { if (bypass) { env.bypass(); } - preCreateTableHandlerCalled = true; + preCreateTableActionCalled = true; } + @Deprecated @Override public void postCreateTableHandler( ObserverContext ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException { - postCreateTableHandlerCalled = true; + } + + @Override + public void postCompletedCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { + postCompletedCreateTableActionCalled = true; tableCreationLatch.countDown(); } - public boolean wasPreCreateTableHandlerCalled(){ - return preCreateTableHandlerCalled; + public boolean wasPreCreateTableActionCalled(){ + return preCreateTableActionCalled; } - public boolean wasCreateTableHandlerCalled() { - return preCreateTableHandlerCalled && postCreateTableHandlerCalled; + public boolean wasCreateTableActionCalled() { + return preCreateTableActionCalled && postCompletedCreateTableActionCalled; } - public boolean wasCreateTableHandlerCalledOnly() { - return preCreateTableHandlerCalled && !postCreateTableHandlerCalled; + public boolean wasCreateTableActionCalledOnly() { + return preCreateTableActionCalled && !postCompletedCreateTableActionCalled; } + @Deprecated @Override public void preDeleteTableHandler( ObserverContext env, TableName tableName) throws IOException { + } + + @Deprecated + @Override + public void postDeleteTableHandler( + ObserverContext ctx, TableName tableName) + throws IOException { + } + + @Override + public void preDeleteTableAction( + final ObserverContext env, final TableName tableName) + throws IOException { if (bypass) { env.bypass(); } - preDeleteTableHandlerCalled = true; + preDeleteTableActionCalled = true; } @Override - public void postDeleteTableHandler( - ObserverContext ctx, TableName tableName) + public void postCompletedDeleteTableAction( + final ObserverContext ctx, final TableName tableName) throws IOException { - postDeleteTableHandlerCalled = true; + postCompletedDeleteTableActionCalled = true; tableDeletionLatch.countDown(); } - public boolean wasDeleteTableHandlerCalled() { - return preDeleteTableHandlerCalled && postDeleteTableHandlerCalled; + public boolean wasDeleteTableActionCalled() { + return preDeleteTableActionCalled && postCompletedDeleteTableActionCalled; } - public boolean wasDeleteTableHandlerCalledOnly() { - return preDeleteTableHandlerCalled && !postDeleteTableHandlerCalled; + public boolean wasDeleteTableActionCalledOnly() { + return preDeleteTableActionCalled && !postCompletedDeleteTableActionCalled; } + @Deprecated @Override public void preTruncateTableHandler( ObserverContext env, TableName tableName) throws IOException { + } + + @Deprecated + @Override + public void postTruncateTableHandler( + ObserverContext ctx, TableName tableName) + throws IOException { + } + + @Override + public void preTruncateTableAction( + final ObserverContext env, final TableName tableName) + throws IOException { if (bypass) { env.bypass(); } - preTruncateTableHandlerCalled = true; + preTruncateTableActionCalled = true; } @Override - public void postTruncateTableHandler( - ObserverContext ctx, TableName tableName) + public void postCompletedTruncateTableAction( + final ObserverContext ctx, final TableName tableName) throws IOException { - postTruncateTableHandlerCalled = true; + postCompletedTruncateTableActionCalled = true; } - public boolean wasTruncateTableHandlerCalled() { - return preTruncateTableHandlerCalled && postTruncateTableHandlerCalled; + public boolean wasTruncateTableActionCalled() { + return preTruncateTableActionCalled && postCompletedTruncateTableActionCalled; } - public boolean wasTruncateTableHandlerCalledOnly() { - return preTruncateTableHandlerCalled && !postTruncateTableHandlerCalled; + public boolean wasTruncateTableActionCalledOnly() { + return preTruncateTableActionCalled && !postCompletedTruncateTableActionCalled; } + @Deprecated @Override public void preModifyTableHandler( ObserverContext env, TableName tableName, HTableDescriptor htd) throws IOException { - if (bypass) { - env.bypass(); - } - preModifyTableHandlerCalled = true; } + @Deprecated @Override public void postModifyTableHandler( ObserverContext env, TableName tableName, HTableDescriptor htd) throws IOException { - postModifyTableHandlerCalled = true; } - public boolean wasModifyTableHandlerCalled() { - return preModifyColumnHandlerCalled && postModifyColumnHandlerCalled; + @Override + public void preModifyTableAction( + final ObserverContext env, + final TableName tableName, + final HTableDescriptor htd) throws IOException { + if (bypass) { + env.bypass(); + } + preModifyTableActionCalled = true; + } + + @Override + public void postCompletedModifyTableAction( + final ObserverContext env, + final TableName tableName, + final HTableDescriptor htd) throws IOException { + postCompletedModifyTableActionCalled = true; + } + + public boolean wasModifyTableActionCalled() { + return preModifyColumnFamilyActionCalled && postCompletedModifyColumnFamilyActionCalled; } - public boolean wasModifyTableHandlerCalledOnly() { - return preModifyColumnHandlerCalled && !postModifyColumnHandlerCalled; + public boolean wasModifyTableActionCalledOnly() { + return preModifyColumnFamilyActionCalled && !postCompletedModifyColumnFamilyActionCalled; } @Deprecated @@ -1075,13 +1135,14 @@ public class TestMasterObserver { } @Override - public void preAddColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { + public void preAddColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { if (bypass) { ctx.bypass(); } - preAddColumnHandlerCalled = true; + preAddColumnFamilyActionCalled = true; } @Deprecated @@ -1092,18 +1153,19 @@ public class TestMasterObserver { } @Override - public void postAddColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { - postAddColumnHandlerCalled = true; + public void postCompletedAddColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { + postCompletedAddColumnFamilyActionCalled = true; } - public boolean wasAddColumnHandlerCalled() { - return preAddColumnHandlerCalled && postAddColumnHandlerCalled; + public boolean wasAddColumnFamilyActionCalled() { + return preAddColumnFamilyActionCalled && postCompletedAddColumnFamilyActionCalled; } - public boolean preAddColumnHandlerCalledOnly() { - return preAddColumnHandlerCalled && !postAddColumnHandlerCalled; + public boolean preAddColumnFamilyActionCalledOnly() { + return preAddColumnFamilyActionCalled && !postCompletedAddColumnFamilyActionCalled; } @Deprecated @@ -1114,13 +1176,14 @@ public class TestMasterObserver { } @Override - public void preModifyColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - HColumnDescriptor columnFamily) throws IOException { + public void preModifyColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final HColumnDescriptor columnFamily) throws IOException { if (bypass) { ctx.bypass(); } - preModifyColumnHandlerCalled = true; + preModifyColumnFamilyActionCalled = true; } @Deprecated @@ -1131,18 +1194,18 @@ public class TestMasterObserver { } @Override - public void postModifyColumnFamilyHandler( + public void postCompletedModifyColumnFamilyAction( ObserverContext ctx, TableName tableName, HColumnDescriptor columnFamily) throws IOException { - postModifyColumnHandlerCalled = true; + postCompletedModifyColumnFamilyActionCalled = true; } - public boolean wasModifyColumnHandlerCalled() { - return preModifyColumnHandlerCalled && postModifyColumnHandlerCalled; + public boolean wasModifyColumnFamilyActionCalled() { + return preModifyColumnFamilyActionCalled && postCompletedModifyColumnFamilyActionCalled; } - public boolean preModifyColumnHandlerCalledOnly() { - return preModifyColumnHandlerCalled && !postModifyColumnHandlerCalled; + public boolean preModifyColumnFamilyActionCalledOnly() { + return preModifyColumnFamilyActionCalled && !postCompletedModifyColumnFamilyActionCalled; } @Deprecated @@ -1153,13 +1216,14 @@ public class TestMasterObserver { } @Override - public void preDeleteColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - byte[] columnFamily) throws IOException { + public void preDeleteColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final byte[] columnFamily) throws IOException { if (bypass) { ctx.bypass(); } - preDeleteColumnHandlerCalled = true; + preDeleteColumnFamilyActionCalled = true; } @Deprecated @@ -1170,68 +1234,95 @@ public class TestMasterObserver { } @Override - public void postDeleteColumnFamilyHandler( - ObserverContext ctx, TableName tableName, - byte[] columnFamily) throws IOException { - postDeleteColumnHandlerCalled = true; + public void postCompletedDeleteColumnFamilyAction( + final ObserverContext ctx, + final TableName tableName, + final byte[] columnFamily) throws IOException { + postCompletedDeleteColumnFamilyActionCalled = true; } - public boolean wasDeleteColumnHandlerCalled() { - return preDeleteColumnHandlerCalled && postDeleteColumnHandlerCalled; + public boolean wasDeleteColumnFamilyActionCalled() { + return preDeleteColumnFamilyActionCalled && postCompletedDeleteColumnFamilyActionCalled; } - public boolean preDeleteColumnHandlerCalledOnly() { - return preDeleteColumnHandlerCalled && !postDeleteColumnHandlerCalled; + public boolean preDeleteColumnFamilyActionCalledOnly() { + return preDeleteColumnFamilyActionCalled && !postCompletedDeleteColumnFamilyActionCalled; } + @Deprecated @Override public void preEnableTableHandler( ObserverContext env, TableName tableName) throws IOException { - if (bypass) { - env.bypass(); - } - preEnableTableHandlerCalled = true; } + @Deprecated @Override public void postEnableTableHandler( ObserverContext ctx, TableName tableName) throws IOException { - postEnableTableHandlerCalled = true; } - public boolean wasEnableTableHandlerCalled() { - return preEnableTableHandlerCalled && postEnableTableHandlerCalled; + @Override + public void preEnableTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + if (bypass) { + ctx.bypass(); + } + preEnableTableActionCalled = true; + } + + @Override + public void postCompletedEnableTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + postCompletedEnableTableActionCalled = true; } - public boolean preEnableTableHandlerCalledOnly() { - return preEnableTableHandlerCalled && !postEnableTableHandlerCalled; + public boolean wasEnableTableActionCalled() { + return preEnableTableActionCalled && postCompletedEnableTableActionCalled; + } + + public boolean preEnableTableActionCalledOnly() { + return preEnableTableActionCalled && !postCompletedEnableTableActionCalled; } @Override public void preDisableTableHandler( ObserverContext env, TableName tableName) throws IOException { - if (bypass) { - env.bypass(); - } - preDisableTableHandlerCalled = true; } @Override public void postDisableTableHandler( ObserverContext ctx, TableName tableName) throws IOException { - postDisableTableHandlerCalled = true; } - public boolean wasDisableTableHandlerCalled() { - return preDisableTableHandlerCalled && postDisableTableHandlerCalled; + @Override + public void preDisableTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + if (bypass) { + ctx.bypass(); + } + preDisableTableActionCalled = true; + } + + @Override + public void postCompletedDisableTableAction( + final ObserverContext ctx, final TableName tableName) + throws IOException { + postCompletedDisableTableActionCalled = true; + } + + public boolean wasDisableTableActionCalled() { + return preDisableTableActionCalled && postCompletedDisableTableActionCalled; } - public boolean preDisableTableHandlerCalledOnly() { - return preDisableTableHandlerCalled && !postDisableTableHandlerCalled; + public boolean preDisableTableActionCalledOnly() { + return preDisableTableActionCalled && !postCompletedDisableTableActionCalled; } @Override @@ -1445,9 +1536,9 @@ public class TestMasterObserver { assertTrue("Test table should be created", cp.wasCreateTableCalled()); tableCreationLatch.await(); assertTrue("Table pre create handler called.", cp - .wasPreCreateTableHandlerCalled()); + .wasPreCreateTableActionCalled()); assertTrue("Table create handler should be called.", - cp.wasCreateTableHandlerCalled()); + cp.wasCreateTableActionCalled()); RegionLocator regionLocator = connection.getRegionLocator(htd.getTableName()); List regions = regionLocator.getAllRegionLocations(); @@ -1464,7 +1555,7 @@ public class TestMasterObserver { assertTrue("Coprocessor should have been called on table disable", cp.wasDisableTableCalled()); assertTrue("Disable table handler should be called.", - cp.wasDisableTableHandlerCalled()); + cp.wasDisableTableActionCalled()); // enable assertFalse(cp.wasEnableTableCalled()); @@ -1474,7 +1565,7 @@ public class TestMasterObserver { assertTrue("Coprocessor should have been called on table enable", cp.wasEnableTableCalled()); assertTrue("Enable table handler should be called.", - cp.wasEnableTableHandlerCalled()); + cp.wasEnableTableActionCalled()); admin.disableTable(tableName); assertTrue(admin.isTableDisabled(tableName)); @@ -1511,7 +1602,7 @@ public class TestMasterObserver { assertTrue("Coprocessor should have been called on table delete", cp.wasDeleteTableCalled()); assertTrue("Delete table handler should be called.", - cp.wasDeleteTableHandlerCalled()); + cp.wasDeleteTableActionCalled()); // turn off bypass, run the tests again cp.enableBypass(false); @@ -1521,19 +1612,19 @@ public class TestMasterObserver { assertTrue("Test table should be created", cp.wasCreateTableCalled()); tableCreationLatch.await(); assertTrue("Table pre create handler called.", cp - .wasPreCreateTableHandlerCalled()); + .wasPreCreateTableActionCalled()); assertTrue("Table create handler should be called.", - cp.wasCreateTableHandlerCalled()); + cp.wasCreateTableActionCalled()); // disable assertFalse(cp.wasDisableTableCalled()); - assertFalse(cp.wasDisableTableHandlerCalled()); + assertFalse(cp.wasDisableTableActionCalled()); admin.disableTable(tableName); assertTrue(admin.isTableDisabled(tableName)); assertTrue("Coprocessor should have been called on table disable", cp.wasDisableTableCalled()); assertTrue("Disable table handler should be called.", - cp.wasDisableTableHandlerCalled()); + cp.wasDisableTableActionCalled()); // modify table htd.setMaxFileSize(512 * 1024 * 1024); @@ -1545,7 +1636,7 @@ public class TestMasterObserver { assertTrue("New column family should have been added to test table", cp.wasAddColumnCalled()); assertTrue("Add column handler should be called.", - cp.wasAddColumnHandlerCalled()); + cp.wasAddColumnFamilyActionCalled()); // modify a column family HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY2); @@ -1554,17 +1645,17 @@ public class TestMasterObserver { assertTrue("Second column family should be modified", cp.wasModifyColumnCalled()); assertTrue("Modify table handler should be called.", - cp.wasModifyColumnHandlerCalled()); + cp.wasModifyColumnFamilyActionCalled()); // enable assertFalse(cp.wasEnableTableCalled()); - assertFalse(cp.wasEnableTableHandlerCalled()); + assertFalse(cp.wasEnableTableActionCalled()); admin.enableTable(tableName); assertTrue(admin.isTableEnabled(tableName)); assertTrue("Coprocessor should have been called on table enable", cp.wasEnableTableCalled()); assertTrue("Enable table handler should be called.", - cp.wasEnableTableHandlerCalled()); + cp.wasEnableTableActionCalled()); // disable again admin.disableTable(tableName); @@ -1573,7 +1664,7 @@ public class TestMasterObserver { // delete column assertFalse("No column family deleted yet", cp.wasDeleteColumnCalled()); assertFalse("Delete table column handler should not be called.", - cp.wasDeleteColumnHandlerCalled()); + cp.wasDeleteColumnFamilyActionCalled()); admin.deleteColumnFamily(tableName, TEST_FAMILY2); HTableDescriptor tableDesc = admin.getTableDescriptor(tableName); assertNull("'"+Bytes.toString(TEST_FAMILY2)+"' should have been removed", @@ -1581,19 +1672,19 @@ public class TestMasterObserver { assertTrue("Coprocessor should have been called on column delete", cp.wasDeleteColumnCalled()); assertTrue("Delete table column handler should be called.", - cp.wasDeleteColumnHandlerCalled()); + cp.wasDeleteColumnFamilyActionCalled()); // delete table assertFalse("No table deleted yet", cp.wasDeleteTableCalled()); assertFalse("Delete table handler should not be called.", - cp.wasDeleteTableHandlerCalled()); + cp.wasDeleteTableActionCalled()); deleteTable(admin, tableName); assertFalse("Test table should have been deleted", admin.tableExists(tableName)); assertTrue("Coprocessor should have been called on table delete", cp.wasDeleteTableCalled()); assertTrue("Delete table handler should be called.", - cp.wasDeleteTableHandlerCalled()); + cp.wasDeleteTableActionCalled()); } } diff --git hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableLockManager.java hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableLockManager.java index 14e4844..573fdcb 100644 --- hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableLockManager.java +++ hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableLockManager.java @@ -104,18 +104,19 @@ public class TestTableLockManager { public static class TestLockTimeoutExceptionMasterObserver extends BaseMasterObserver { @Override - public void preDeleteColumnFamilyHandler(ObserverContext ctx, + public void preDeleteColumnFamilyAction(ObserverContext ctx, TableName tableName, byte[] columnFamily) throws IOException { deleteColumn.countDown(); } @Override - public void postDeleteColumnFamilyHandler(ObserverContext ctx, + public void postCompletedDeleteColumnFamilyAction( + ObserverContext ctx, TableName tableName, byte[] columnFamily) throws IOException { Threads.sleep(10000); } @Override - public void preAddColumnFamilyHandler(ObserverContext ctx, + public void preAddColumnFamilyAction(ObserverContext ctx, TableName tableName, HColumnDescriptor columnFamily) throws IOException { fail("Add column should have timeouted out for acquiring the table lock"); } @@ -169,14 +170,15 @@ public class TestTableLockManager { public static class TestAlterAndDisableMasterObserver extends BaseMasterObserver { @Override - public void preAddColumnFamilyHandler(ObserverContext ctx, + public void preAddColumnFamilyAction(ObserverContext ctx, TableName tableName, HColumnDescriptor columnFamily) throws IOException { LOG.debug("addColumn called"); addColumn.countDown(); } @Override - public void postAddColumnFamilyHandler(ObserverContext ctx, + public void postCompletedAddColumnFamilyAction( + ObserverContext ctx, TableName tableName, HColumnDescriptor columnFamily) throws IOException { Threads.sleep(6000); try { diff --git hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java index a260d50..a01ccc4 100644 --- hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java +++ hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java @@ -192,17 +192,21 @@ public class TestEnableTableHandler { volatile CountDownLatch tableDeletionLatch = null; @Override - public void postCreateTableHandler(final ObserverContext ctx, - HTableDescriptor desc, HRegionInfo[] regions) throws IOException { - // the AccessController test, some times calls only and directly the postCreateTableHandler() + public void postCompletedCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { + // the AccessController test, some times calls only and directly the + // postCompletedCreateTableAction() if (tableCreationLatch != null) { tableCreationLatch.countDown(); } } @Override - public void postDeleteTableHandler(final ObserverContext ctx, - TableName tableName) + public void postCompletedDeleteTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { // the AccessController test, some times calls only and directly the postDeleteTableHandler() if (tableDeletionLatch != null) { diff --git hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java index 40732f6..d8b1b2e 100644 --- hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java +++ hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java @@ -513,7 +513,7 @@ public class TestNamespaceAuditor { byte[] columnFamily = Bytes.toBytes("info"); HTableDescriptor tableDescOne = new HTableDescriptor(tableOne); tableDescOne.addFamily(new HColumnDescriptor(columnFamily)); - MasterSyncObserver.throwExceptionInPreCreateTableHandler = true; + MasterSyncObserver.throwExceptionInPreCreateTableAction = true; try { try { ADMIN.createTable(tableDescOne); @@ -527,7 +527,7 @@ public class TestNamespaceAuditor { assertEquals("First table creation failed in namespace so number of tables in namespace " + "should be 0.", 0, nstate.getTables().size()); - MasterSyncObserver.throwExceptionInPreCreateTableHandler = false; + MasterSyncObserver.throwExceptionInPreCreateTableAction = false; try { ADMIN.createTable(tableDescOne); } catch (Exception e) { @@ -539,7 +539,7 @@ public class TestNamespaceAuditor { assertEquals("First table was created successfully so table size in namespace should " + "be one now.", 1, nstate.getTables().size()); } finally { - MasterSyncObserver.throwExceptionInPreCreateTableHandler = false; + MasterSyncObserver.throwExceptionInPreCreateTableAction = false; if (ADMIN.tableExists(tableOne)) { ADMIN.disableTable(tableOne); deleteTable(tableOne); @@ -660,7 +660,7 @@ public class TestNamespaceAuditor { public static class MasterSyncObserver extends BaseMasterObserver { volatile CountDownLatch tableDeletionLatch; - static boolean throwExceptionInPreCreateTableHandler; + static boolean throwExceptionInPreCreateTableAction; @Override public void preDeleteTable(ObserverContext ctx, @@ -669,16 +669,16 @@ public class TestNamespaceAuditor { } @Override - public void postDeleteTableHandler( - final ObserverContext ctx, TableName tableName) - throws IOException { + public void postCompletedDeleteTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { tableDeletionLatch.countDown(); } @Override - public void preCreateTableHandler(ObserverContext ctx, + public void preCreateTableAction(ObserverContext ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException { - if (throwExceptionInPreCreateTableHandler) { + if (throwExceptionInPreCreateTableAction) { throw new IOException("Throw exception as it is demanded."); } } diff --git hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/SecureTestUtil.java hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/SecureTestUtil.java index 22a9748..f0e7ac9 100644 --- hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/SecureTestUtil.java +++ hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/SecureTestUtil.java @@ -628,20 +628,22 @@ public class SecureTestUtil { volatile CountDownLatch tableDeletionLatch = null; @Override - public void postCreateTableHandler( + public void postCompletedCreateTableAction( final ObserverContext ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException { - // the AccessController test, some times calls only and directly the postCreateTableHandler() + // the AccessController test, some times calls only and directly the + // postCompletedCreateTableAction() if (tableCreationLatch != null) { tableCreationLatch.countDown(); } } @Override - public void postDeleteTableHandler( - final ObserverContext ctx, TableName tableName) - throws IOException { - // the AccessController test, some times calls only and directly the postDeleteTableHandler() + public void postCompletedDeleteTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + // the AccessController test, some times calls only and directly the + // postCompletedDeleteTableAction() if (tableDeletionLatch != null) { tableDeletionLatch.countDown(); } diff --git hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java index 35560f5..1dfb526 100644 --- hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java +++ hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java @@ -608,19 +608,23 @@ public class BaseTestHBaseFsck { volatile CountDownLatch tableDeletionLatch = null; @Override - public void postCreateTableHandler(final ObserverContext ctx, - HTableDescriptor desc, HRegionInfo[] regions) throws IOException { - // the AccessController test, some times calls only and directly the postCreateTableHandler() + public void postCompletedCreateTableAction( + final ObserverContext ctx, + final HTableDescriptor desc, + final HRegionInfo[] regions) throws IOException { + // the AccessController test, some times calls only and directly the + // postCompletedCreateTableAction() if (tableCreationLatch != null) { tableCreationLatch.countDown(); } } @Override - public void postDeleteTableHandler(final ObserverContext ctx, - TableName tableName) - throws IOException { - // the AccessController test, some times calls only and directly the postDeleteTableHandler() + public void postCompletedDeleteTableAction( + final ObserverContext ctx, + final TableName tableName) throws IOException { + // the AccessController test, some times calls only and directly the + // postCompletedDeleteTableAction() if (tableDeletionLatch != null) { tableDeletionLatch.countDown(); }