diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionServerObserver.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionServerObserver.java index 9fce32a6b07..4e31d1949e4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionServerObserver.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionServerObserver.java @@ -24,12 +24,9 @@ import java.util.List; import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.Coprocessor; import org.apache.hadoop.hbase.HBaseInterfaceAudience; -import org.apache.hadoop.hbase.MetaMutationAnnotation; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; -import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WALEntry; -import org.apache.hadoop.hbase.regionserver.Region; import org.apache.hadoop.hbase.replication.ReplicationEndpoint; /** @@ -67,65 +64,6 @@ public interface RegionServerObserver extends Coprocessor { default void preStopRegionServer( final ObserverContext ctx) throws IOException {} - /** - * Called before the regions merge. - * Call {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} to skip the merge. - * @param ctx the environment to interact with the framework and region server. - * @param regionA region being merged. - * @param regionB region being merged. - */ - default void preMerge(final ObserverContext ctx, - final Region regionA, final Region regionB) throws IOException {} - - /** - * called after the regions merge. - * @param ctx the environment to interact with the framework and region server. - * @param regionA region being merged. - * @param regionB region being merged. - */ - default void postMerge(final ObserverContext ctx, - final Region regionA, final Region regionB, final Region mergedRegion) throws IOException {} - - /** - * This will be called before PONR step as part of regions merge transaction. Calling - * {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} rollback the merge - * @param ctx the environment to interact with the framework and region server. - * @param regionA region being merged. - * @param regionB region being merged. - * @param metaEntries mutations to execute on hbase:meta atomically with regions merge updates. - * Any puts or deletes to execute on hbase:meta can be added to the mutations. - */ - default void preMergeCommit(final ObserverContext ctx, - final Region regionA, final Region regionB, - @MetaMutationAnnotation List metaEntries) throws IOException {} - - /** - * This will be called after PONR step as part of regions merge transaction. - * @param ctx the environment to interact with the framework and region server. - * @param regionA region being merged. - * @param regionB region being merged. - */ - default void postMergeCommit(final ObserverContext ctx, - final Region regionA, final Region regionB, final Region mergedRegion) throws IOException {} - - /** - * This will be called before the roll back of the regions merge. - * @param ctx the environment to interact with the framework and region server. - * @param regionA region being merged. - * @param regionB region being merged. - */ - default void preRollBackMerge(final ObserverContext ctx, - final Region regionA, final Region regionB) throws IOException {} - - /** - * This will be called after the roll back of the regions merge. - * @param ctx the environment to interact with the framework and region server. - * @param regionA region being merged. - * @param regionB region being merged. - */ - default void postRollBackMerge(final ObserverContext ctx, - final Region regionA, final Region regionB) throws IOException {} - /** * This will be called before executing user request to roll a region server WAL. * @param ctx the environment to interact with the framework and region server. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java index ec58d0889c7..563e4a71612 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java @@ -30,10 +30,8 @@ import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.Coprocessor; import org.apache.hadoop.hbase.CoprocessorEnvironment; import org.apache.hadoop.hbase.HBaseInterfaceAudience; -import org.apache.hadoop.hbase.MetaMutationAnnotation; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; -import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; import org.apache.hadoop.hbase.coprocessor.MetricsCoprocessor; import org.apache.hadoop.hbase.coprocessor.ObserverContext; @@ -97,73 +95,6 @@ public class RegionServerCoprocessorHost extends }); } - public boolean preMerge(final HRegion regionA, final HRegion regionB, final User user) throws IOException { - return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { - @Override - public void call(RegionServerObserver oserver, - ObserverContext ctx) throws IOException { - oserver.preMerge(ctx, regionA, regionB); - } - }); - } - - public void postMerge(final HRegion regionA, final HRegion regionB, final HRegion mergedRegion, - final User user) - throws IOException { - execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { - @Override - public void call(RegionServerObserver oserver, - ObserverContext ctx) throws IOException { - oserver.postMerge(ctx, regionA, regionB, mergedRegion); - } - }); - } - - public boolean preMergeCommit(final HRegion regionA, final HRegion regionB, - final @MetaMutationAnnotation List metaEntries, final User user) - throws IOException { - return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { - @Override - public void call(RegionServerObserver oserver, - ObserverContext ctx) throws IOException { - oserver.preMergeCommit(ctx, regionA, regionB, metaEntries); - } - }); - } - - public void postMergeCommit(final HRegion regionA, final HRegion regionB, - final HRegion mergedRegion, final User user) throws IOException { - execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { - @Override - public void call(RegionServerObserver oserver, - ObserverContext ctx) throws IOException { - oserver.postMergeCommit(ctx, regionA, regionB, mergedRegion); - } - }); - } - - public void preRollBackMerge(final HRegion regionA, final HRegion regionB, final User user) - throws IOException { - execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { - @Override - public void call(RegionServerObserver oserver, - ObserverContext ctx) throws IOException { - oserver.preRollBackMerge(ctx, regionA, regionB); - } - }); - } - - public void postRollBackMerge(final HRegion regionA, final HRegion regionB, final User user) - throws IOException { - execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) { - @Override - public void call(RegionServerObserver oserver, - ObserverContext ctx) throws IOException { - oserver.postRollBackMerge(ctx, regionA, regionB); - } - }); - } - public void preRollWALWriterRequest() throws IOException { execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() { @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java index c34fc6d6a75..4c92fb1ddd5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java @@ -2574,33 +2574,6 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS Action.ADMIN); } - @Override - public void preMerge(ObserverContext ctx, Region regionA, - Region regionB) throws IOException { - requirePermission(getActiveUser(ctx), "mergeRegions", regionA.getTableDescriptor().getTableName(), - null, null, Action.ADMIN); - } - - @Override - public void postMerge(ObserverContext c, Region regionA, - Region regionB, Region mergedRegion) throws IOException { } - - @Override - public void preMergeCommit(ObserverContext ctx, - Region regionA, Region regionB, List metaEntries) throws IOException { } - - @Override - public void postMergeCommit(ObserverContext ctx, - Region regionA, Region regionB, Region mergedRegion) throws IOException { } - - @Override - public void preRollBackMerge(ObserverContext ctx, - Region regionA, Region regionB) throws IOException { } - - @Override - public void postRollBackMerge(ObserverContext ctx, - Region regionA, Region regionB) throws IOException { } - @Override public void preRollWALWriterRequest(ObserverContext ctx) throws IOException { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java index 8015115511c..979936fcae3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java @@ -63,7 +63,6 @@ import org.apache.hadoop.hbase.coprocessor.MasterObserver; import org.apache.hadoop.hbase.coprocessor.ObserverContext; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.coprocessor.RegionObserver; -import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment; import org.apache.hadoop.hbase.coprocessor.RegionServerObserver; import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.master.MasterCoprocessorHost; @@ -71,11 +70,9 @@ import org.apache.hadoop.hbase.master.TableNamespaceManager; import org.apache.hadoop.hbase.quotas.MasterQuotaManager; import org.apache.hadoop.hbase.quotas.QuotaExceededException; import org.apache.hadoop.hbase.quotas.QuotaUtil; -import org.apache.hadoop.hbase.regionserver.Region; import org.apache.hadoop.hbase.regionserver.Store; import org.apache.hadoop.hbase.regionserver.StoreFile; import org.apache.hadoop.hbase.regionserver.compactions.CompactionLifeCycleTracker; -import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest; import org.apache.hadoop.hbase.snapshot.RestoreSnapshotException; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.util.Bytes; @@ -294,16 +291,6 @@ public class TestNamespaceAuditor { wait(); } } - - @Override - public synchronized void preMerge(ObserverContext ctx, - Region regionA, Region regionB) throws IOException { - triggered = true; - notifyAll(); - if (shouldFailMerge) { - throw new IOException("fail merge"); - } - } } public static class CPMasterObserver implements MasterObserver { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java index bf368217470..2c27e4d0030 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java @@ -856,31 +856,6 @@ public class TestAccessController extends SecureTestUtil { USER_GROUP_WRITE, USER_GROUP_CREATE); } - @Test (timeout=180000) - public void testMergeRegions() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - createTestTable(tableName); - try { - final List regions = TEST_UTIL.getHBaseCluster().findRegionsForTable(tableName); - assertTrue("not enough regions: " + regions.size(), regions.size() >= 2); - - AccessTestAction action = new AccessTestAction() { - @Override - public Object run() throws Exception { - ACCESS_CONTROLLER.preMerge(ObserverContext.createAndPrepare(RSCP_ENV, null), - regions.get(0), regions.get(1)); - return null; - } - }; - - verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_GROUP_ADMIN); - verifyDenied(action, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, - USER_GROUP_WRITE, USER_GROUP_CREATE); - } finally { - deleteTable(TEST_UTIL, tableName); - } - } - @Test (timeout=180000) public void testFlush() throws Exception { AccessTestAction action = new AccessTestAction() { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java index b118cb56bbc..aab7ae473f0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java @@ -836,21 +836,6 @@ public class TestWithDisabledAuthorization extends SecureTestUtil { } }, SUPERUSER, USER_ADMIN, USER_RW, USER_RO, USER_OWNER, USER_CREATE, USER_QUAL, USER_NONE); - // preMerge - verifyAllowed(new AccessTestAction() { - @Override - public Object run() throws Exception { - HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName()); - Region region_a = mock(Region.class); - when(region_a.getTableDescriptor()).thenReturn(htd); - Region region_b = mock(Region.class); - when(region_b.getTableDescriptor()).thenReturn(htd); - ACCESS_CONTROLLER.preMerge(ObserverContext.createAndPrepare(RSCP_ENV, null), region_a, - region_b); - return null; - } - }, SUPERUSER, USER_ADMIN, USER_RW, USER_RO, USER_OWNER, USER_CREATE, USER_QUAL, USER_NONE); - // preRollWALWriterRequest verifyAllowed(new AccessTestAction() { @Override