hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [20/47] hbase git commit: HBASE-18798 Remove the unused methods in RegionServerObserver
Date Sun, 24 Sep 2017 00:34:20 GMT
HBASE-18798 Remove the unused methods in RegionServerObserver


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/190a660d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/190a660d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/190a660d

Branch: refs/heads/HBASE-18467
Commit: 190a660d17c2a2cca6128edb33254e7ff851bbb3
Parents: 5c12e42
Author: Chia-Ping Tsai <chia7712@gmail.com>
Authored: Fri Sep 15 19:00:43 2017 +0800
Committer: Chia-Ping Tsai <chia7712@gmail.com>
Committed: Mon Sep 18 09:44:57 2017 +0800

----------------------------------------------------------------------
 .../hbase/coprocessor/RegionServerObserver.java | 62 ------------------
 .../RegionServerCoprocessorHost.java            | 69 --------------------
 .../hbase/security/access/AccessController.java | 27 --------
 .../hbase/namespace/TestNamespaceAuditor.java   | 13 ----
 .../security/access/TestAccessController.java   | 25 -------
 .../access/TestWithDisabledAuthorization.java   | 15 -----
 6 files changed, 211 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/190a660d/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionServerObserver.java
----------------------------------------------------------------------
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 9fce32a..4e31d19 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;
 
 /**
@@ -68,65 +65,6 @@ public interface RegionServerObserver extends Coprocessor {
     final ObserverContext<RegionServerCoprocessorEnvironment> 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<RegionServerCoprocessorEnvironment> 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<RegionServerCoprocessorEnvironment>
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<RegionServerCoprocessorEnvironment>
ctx,
-      final Region regionA, final Region regionB,
-      @MetaMutationAnnotation List<Mutation> 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<RegionServerCoprocessorEnvironment>
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<RegionServerCoprocessorEnvironment>
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<RegionServerCoprocessorEnvironment>
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.
    */

http://git-wip-us.apache.org/repos/asf/hbase/blob/190a660d/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerCoprocessorHost.java
----------------------------------------------------------------------
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 ec58d08..563e4a7 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<RegionServerCoprocessorEnvironment> 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<RegionServerCoprocessorEnvironment> ctx) throws IOException
{
-        oserver.postMerge(ctx, regionA, regionB, mergedRegion);
-      }
-    });
-  }
-
-  public boolean preMergeCommit(final HRegion regionA, final HRegion regionB,
-      final @MetaMutationAnnotation List<Mutation> metaEntries, final User user)
-      throws IOException {
-    return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) {
-      @Override
-      public void call(RegionServerObserver oserver,
-          ObserverContext<RegionServerCoprocessorEnvironment> 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<RegionServerCoprocessorEnvironment> 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<RegionServerCoprocessorEnvironment> 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<RegionServerCoprocessorEnvironment> ctx) throws IOException
{
-        oserver.postRollBackMerge(ctx, regionA, regionB);
-      }
-    });
-  }
-
   public void preRollWALWriterRequest() throws IOException {
     execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
       @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/190a660d/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
----------------------------------------------------------------------
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 c34fc6d..4c92fb1 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
@@ -2575,33 +2575,6 @@ public class AccessController implements MasterObserver, RegionObserver,
RegionS
   }
 
   @Override
-  public void preMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx, Region
regionA,
-      Region regionB) throws IOException {
-    requirePermission(getActiveUser(ctx), "mergeRegions", regionA.getTableDescriptor().getTableName(),
-        null, null, Action.ADMIN);
-  }
-
-  @Override
-  public void postMerge(ObserverContext<RegionServerCoprocessorEnvironment> c, Region
regionA,
-      Region regionB, Region mergedRegion) throws IOException { }
-
-  @Override
-  public void preMergeCommit(ObserverContext<RegionServerCoprocessorEnvironment> ctx,
-      Region regionA, Region regionB, List<Mutation> metaEntries) throws IOException
{ }
-
-  @Override
-  public void postMergeCommit(ObserverContext<RegionServerCoprocessorEnvironment> ctx,
-      Region regionA, Region regionB, Region mergedRegion) throws IOException { }
-
-  @Override
-  public void preRollBackMerge(ObserverContext<RegionServerCoprocessorEnvironment>
ctx,
-      Region regionA, Region regionB) throws IOException { }
-
-  @Override
-  public void postRollBackMerge(ObserverContext<RegionServerCoprocessorEnvironment>
ctx,
-      Region regionA, Region regionB) throws IOException { }
-
-  @Override
   public void preRollWALWriterRequest(ObserverContext<RegionServerCoprocessorEnvironment>
ctx)
       throws IOException {
     requirePermission(getActiveUser(ctx), "preRollLogWriterRequest", Permission.Action.ADMIN);

http://git-wip-us.apache.org/repos/asf/hbase/blob/190a660d/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
----------------------------------------------------------------------
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 8015115..979936f 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<RegionServerCoprocessorEnvironment>
ctx,
-        Region regionA, Region regionB) throws IOException {
-      triggered = true;
-      notifyAll();
-      if (shouldFailMerge) {
-        throw new IOException("fail merge");
-      }
-    }
   }
 
   public static class CPMasterObserver implements MasterObserver {

http://git-wip-us.apache.org/repos/asf/hbase/blob/190a660d/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
----------------------------------------------------------------------
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 bf36821..2c27e4d 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
@@ -857,31 +857,6 @@ public class TestAccessController extends SecureTestUtil {
   }
 
   @Test (timeout=180000)
-  public void testMergeRegions() throws Exception {
-    final TableName tableName = TableName.valueOf(name.getMethodName());
-    createTestTable(tableName);
-    try {
-      final List<HRegion> 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() {
       @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/190a660d/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java
----------------------------------------------------------------------
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 b118cb5..aab7ae4 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


Mime
View raw message