hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject hbase git commit: HBASE-16769 Deprecate/remove PB references from MasterObserver and RegionServerObserver
Date Tue, 26 Sep 2017 03:22:58 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 4b208eb2b -> 3c7ab8107


HBASE-16769 Deprecate/remove PB references from MasterObserver and RegionServerObserver


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

Branch: refs/heads/master
Commit: 3c7ab8107204e730892951f323a0c231ac769bde
Parents: 4b208eb
Author: anoopsamjohn <anoopsamjohn@gmail.com>
Authored: Tue Sep 26 08:52:23 2017 +0530
Committer: anoopsamjohn <anoopsamjohn@gmail.com>
Committed: Tue Sep 26 08:52:23 2017 +0530

----------------------------------------------------------------------
 .../backup/TestBackupDeleteWithFailures.java    |  2 +-
 .../hbase/rsgroup/RSGroupAdminEndpoint.java     |  2 +-
 .../hbase/coprocessor/MasterObserver.java       |  2 +-
 .../hbase/coprocessor/RegionServerObserver.java | 25 ++++++------
 .../hbase/master/MasterCoprocessorHost.java     |  2 +-
 .../hbase/master/snapshot/SnapshotManager.java  | 43 +++++++++++++-------
 .../hbase/regionserver/RSRpcServices.java       |  4 +-
 .../RegionServerCoprocessorHost.java            | 10 ++---
 .../hbase/security/access/AccessController.java | 12 ++----
 .../snapshot/SnapshotDescriptionUtils.java      |  6 +--
 .../hbase/coprocessor/TestMasterObserver.java   |  2 +-
 .../security/access/TestAccessController.java   | 22 ++++------
 .../access/TestWithDisabledAuthorization.java   | 22 +++-------
 .../snapshot/TestSnapshotClientRetries.java     |  2 +-
 14 files changed, 73 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java
b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java
index 966f519..843ed38 100644
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java
+++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java
@@ -34,12 +34,12 @@ import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.backup.impl.BackupSystemTable;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
 import org.apache.hadoop.hbase.coprocessor.MasterObserver;
 import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.util.ToolRunner;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
index 68bde3f..657dbba 100644
--- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
+++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
@@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.NamespaceDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.constraint.ConstraintException;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
@@ -66,7 +67,6 @@ import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RSGroupAdmi
 import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveRSGroupRequest;
 import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveRSGroupResponse;
 import org.apache.hadoop.hbase.shaded.com.google.common.collect.Sets;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
 import org.apache.yetus.audience.InterfaceAudience;
 
 @InterfaceAudience.Private

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
index 16ea635..87b9679 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
 import org.apache.hadoop.hbase.client.MasterSwitchType;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.master.RegionPlan;
 import org.apache.hadoop.hbase.master.locking.LockProcedure;
@@ -44,7 +45,6 @@ import org.apache.hadoop.hbase.procedure2.Procedure;
 import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
 import org.apache.hadoop.hbase.quotas.GlobalQuotaSettings;
 import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.yetus.audience.InterfaceStability;
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/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 4e31d19..5d68eec 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
@@ -19,15 +19,12 @@
 package org.apache.hadoop.hbase.coprocessor;
 
 import java.io.IOException;
-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.replication.ReplicationEndpoint;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.yetus.audience.InterfaceStability;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WALEntry;
-import org.apache.hadoop.hbase.replication.ReplicationEndpoint;
 
 /**
  * Defines coprocessor hooks for interacting with operations on the
@@ -91,24 +88,28 @@ public interface RegionServerObserver extends Coprocessor {
     return endpoint;
   }
 
+  // TODO remove below 2 hooks when we implement AC as a core impl than a CP impl.
   /**
    * This will be called before executing replication request to shipping log entries.
    * @param ctx the environment to interact with the framework and region server.
-   * @param entries list of WALEntries to replicate
-   * @param cells Cells that the WALEntries refer to (if cells is non-null)
+   * @deprecated As of release 2.0.0 with out any replacement. This is maintained for internal
+   * usage by AccessController. Do not use these hooks in custom co-processors.
    */
-  default void preReplicateLogEntries(final ObserverContext<RegionServerCoprocessorEnvironment>
ctx,
-      List<WALEntry> entries, CellScanner cells) throws IOException {}
+  @Deprecated
+  default void preReplicateLogEntries(final ObserverContext<RegionServerCoprocessorEnvironment>
ctx)
+      throws IOException {
+  }
 
   /**
    * This will be called after executing replication request to shipping log entries.
    * @param ctx the environment to interact with the framework and region server.
-   * @param entries list of WALEntries to replicate
-   * @param cells Cells that the WALEntries refer to (if cells is non-null)
+   * @deprecated As of release 2.0.0 with out any replacement. This is maintained for internal
+   * usage by AccessController. Do not use these hooks in custom co-processors.
    */
+  @Deprecated
   default void postReplicateLogEntries(
-      final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
-      List<WALEntry> entries, CellScanner cells) throws IOException {}
+      final ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException
{
+  }
 
   /**
    * This will be called before clearing compaction queues

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
index 8a65f0c..30d8015 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
 import org.apache.hadoop.hbase.client.MasterSwitchType;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
@@ -55,7 +56,6 @@ import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
 import org.apache.hadoop.hbase.quotas.GlobalQuotaSettings;
 import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
 import org.apache.hadoop.hbase.security.User;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
 import org.apache.yetus.audience.InterfaceAudience;
 
 /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
index 229e7da..7bd069b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
@@ -199,16 +199,18 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
    * @throws IOException File system exception
    */
   public List<SnapshotDescription> getCompletedSnapshots() throws IOException {
-    return getCompletedSnapshots(SnapshotDescriptionUtils.getSnapshotsDir(rootDir));
+    return getCompletedSnapshots(SnapshotDescriptionUtils.getSnapshotsDir(rootDir), true);
   }
 
   /**
    * Gets the list of all completed snapshots.
    * @param snapshotDir snapshot directory
+   * @param withCpCall Whether to call CP hooks
    * @return list of SnapshotDescriptions
    * @throws IOException File system exception
    */
-  private List<SnapshotDescription> getCompletedSnapshots(Path snapshotDir) throws
IOException {
+  private List<SnapshotDescription> getCompletedSnapshots(Path snapshotDir, boolean
withCpCall)
+      throws IOException {
     List<SnapshotDescription> snapshotDescs = new ArrayList<>();
     // first create the snapshot root path and check to see if it exists
     FileSystem fs = master.getMasterFileSystem().getFileSystem();
@@ -223,6 +225,7 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
     FileStatus[] snapshots = fs.listStatus(snapshotDir,
       new SnapshotDescriptionUtils.CompletedSnaphotDirectoriesFilter(fs));
     MasterCoprocessorHost cpHost = master.getMasterCoprocessorHost();
+    withCpCall = withCpCall && cpHost != null;
     // loop through all the completed snapshots
     for (FileStatus snapshot : snapshots) {
       Path info = new Path(snapshot.getPath(), SnapshotDescriptionUtils.SNAPSHOTINFO_FILE);
@@ -235,9 +238,11 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
       try {
         in = fs.open(info);
         SnapshotDescription desc = SnapshotDescription.parseFrom(in);
-        if (cpHost != null) {
+        org.apache.hadoop.hbase.client.SnapshotDescription descPOJO = (withCpCall)
+            ? ProtobufUtil.createSnapshotDesc(desc) : null;
+        if (withCpCall) {
           try {
-            cpHost.preListSnapshot(desc);
+            cpHost.preListSnapshot(descPOJO);
           } catch (AccessDeniedException e) {
             LOG.warn("Current user does not have access to " + desc.getName() + " snapshot.
"
                 + "Either you should be owner of this snapshot or admin user.");
@@ -248,8 +253,8 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
         snapshotDescs.add(desc);
 
         // call coproc post hook
-        if (cpHost != null) {
-          cpHost.postListSnapshot(desc);
+        if (withCpCall) {
+          cpHost.postListSnapshot(descPOJO);
         }
       } catch (IOException e) {
         LOG.warn("Found a corrupted snapshot " + snapshot.getPath(), e);
@@ -300,8 +305,10 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
 
     // call coproc pre hook
     MasterCoprocessorHost cpHost = master.getMasterCoprocessorHost();
+    org.apache.hadoop.hbase.client.SnapshotDescription snapshotPOJO = null;
     if (cpHost != null) {
-      cpHost.preDeleteSnapshot(snapshot);
+      snapshotPOJO = ProtobufUtil.createSnapshotDesc(snapshot);
+      cpHost.preDeleteSnapshot(snapshotPOJO);
     }
 
     LOG.debug("Deleting snapshot: " + snapshotName);
@@ -312,7 +319,7 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
 
     // call coproc post hook
     if (cpHost != null) {
-      cpHost.postDeleteSnapshot(snapshot);
+      cpHost.postDeleteSnapshot(snapshotPOJO);
     }
 
   }
@@ -587,8 +594,10 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
 
     // call pre coproc hook
     MasterCoprocessorHost cpHost = master.getMasterCoprocessorHost();
+    org.apache.hadoop.hbase.client.SnapshotDescription snapshotPOJO = null;
     if (cpHost != null) {
-      cpHost.preSnapshot(snapshot, desc);
+      snapshotPOJO = ProtobufUtil.createSnapshotDesc(snapshot);
+      cpHost.preSnapshot(snapshotPOJO, desc);
     }
 
     // if the table is enabled, then have the RS run actually the snapshot work
@@ -616,7 +625,7 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
 
     // call post coproc hook
     if (cpHost != null) {
-      cpHost.postSnapshot(snapshot, desc);
+      cpHost.postSnapshot(snapshotPOJO, desc);
     }
   }
 
@@ -684,8 +693,10 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
       final NonceKey nonceKey, final boolean restoreAcl) throws IOException {
     MasterCoprocessorHost cpHost = master.getMasterCoprocessorHost();
     TableDescriptor htd = TableDescriptorBuilder.copy(tableName, snapshotTableDesc);
+    org.apache.hadoop.hbase.client.SnapshotDescription snapshotPOJO = null;
     if (cpHost != null) {
-      cpHost.preCloneSnapshot(reqSnapshot, htd);
+      snapshotPOJO = ProtobufUtil.createSnapshotDesc(reqSnapshot);
+      cpHost.preCloneSnapshot(snapshotPOJO, htd);
     }
     long procId;
     try {
@@ -698,7 +709,7 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
     LOG.info("Clone snapshot=" + snapshot.getName() + " as table=" + tableName);
 
     if (cpHost != null) {
-      cpHost.postCloneSnapshot(reqSnapshot, htd);
+      cpHost.postCloneSnapshot(snapshotPOJO, htd);
     }
     return procId;
   }
@@ -812,8 +823,10 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
     }
 
     // call Coprocessor pre hook
+    org.apache.hadoop.hbase.client.SnapshotDescription snapshotPOJO = null;
     if (cpHost != null) {
-      cpHost.preRestoreSnapshot(reqSnapshot, snapshotTableDesc);
+      snapshotPOJO = ProtobufUtil.createSnapshotDesc(reqSnapshot);
+      cpHost.preRestoreSnapshot(snapshotPOJO, snapshotTableDesc);
     }
 
     long procId;
@@ -827,7 +840,7 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
     LOG.info("Restore snapshot=" + snapshot.getName() + " as table=" + tableName);
 
     if (cpHost != null) {
-      cpHost.postRestoreSnapshot(reqSnapshot, snapshotTableDesc);
+      cpHost.postRestoreSnapshot(snapshotPOJO, snapshotTableDesc);
     }
 
     return procId;
@@ -1045,7 +1058,7 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
     // check if an older version of snapshot directory was present
     Path oldSnapshotDir = new Path(mfs.getRootDir(), HConstants.OLD_SNAPSHOT_DIR_NAME);
     FileSystem fs = mfs.getFileSystem();
-    List<SnapshotDescription> ss = getCompletedSnapshots(new Path(rootDir, oldSnapshotDir));
+    List<SnapshotDescription> ss = getCompletedSnapshots(new Path(rootDir, oldSnapshotDir),
false);
     if (ss != null && !ss.isEmpty()) {
       LOG.error("Snapshots from an earlier release were found under: " + oldSnapshotDir);
       LOG.error("Please rename the directory as " + HConstants.SNAPSHOT_DIR_NAME);

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index 24281c7..ebcdbb4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -2177,11 +2177,11 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
         requestCount.increment();
         List<WALEntry> entries = request.getEntryList();
         CellScanner cellScanner = ((HBaseRpcController)controller).cellScanner();
-        regionServer.getRegionServerCoprocessorHost().preReplicateLogEntries(entries, cellScanner);
+        regionServer.getRegionServerCoprocessorHost().preReplicateLogEntries();
         regionServer.replicationSinkHandler.replicateLogEntries(entries, cellScanner,
           request.getReplicationClusterId(), request.getSourceBaseNamespaceDirPath(),
           request.getSourceHFileArchiveDirPath());
-        regionServer.getRegionServerCoprocessorHost().postReplicateLogEntries(entries, cellScanner);
+        regionServer.getRegionServerCoprocessorHost().postReplicateLogEntries();
         return ReplicateWALEntryResponse.newBuilder().build();
       } else {
         throw new ServiceException("Replication services are not initialized yet");

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/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 563e4a7..2c80d54 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
@@ -26,7 +26,6 @@ import org.apache.commons.lang3.ClassUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.CellScanner;
 import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
@@ -42,7 +41,6 @@ import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.metrics.MetricRegistry;
 import org.apache.hadoop.hbase.replication.ReplicationEndpoint;
 import org.apache.hadoop.hbase.security.User;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WALEntry;
 
 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
 @InterfaceStability.Evolving
@@ -115,24 +113,24 @@ public class RegionServerCoprocessorHost extends
     });
   }
 
-  public void preReplicateLogEntries(final List<WALEntry> entries, final CellScanner
cells)
+  public void preReplicateLogEntries()
       throws IOException {
     execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
       @Override
       public void call(RegionServerObserver oserver,
           ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException
{
-        oserver.preReplicateLogEntries(ctx, entries, cells);
+        oserver.preReplicateLogEntries(ctx);
       }
     });
   }
 
-  public void postReplicateLogEntries(final List<WALEntry> entries, final CellScanner
cells)
+  public void postReplicateLogEntries()
       throws IOException {
     execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
       @Override
       public void call(RegionServerObserver oserver,
           ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException
{
-        oserver.postReplicateLogEntries(ctx, entries, cells);
+        oserver.postReplicateLogEntries(ctx);
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/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 ea5eb1c..e58b35e 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
@@ -69,6 +69,7 @@ import org.apache.hadoop.hbase.client.Query;
 import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.coprocessor.BulkLoadObserver;
@@ -121,10 +122,8 @@ import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
 import org.apache.hadoop.hbase.shaded.com.google.common.collect.MapMaker;
 import org.apache.hadoop.hbase.shaded.com.google.common.collect.Maps;
 import org.apache.hadoop.hbase.shaded.com.google.common.collect.Sets;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WALEntry;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CleanupBulkLoadRequest;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadRequest;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils;
 import org.apache.hadoop.hbase.util.ByteRange;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -2622,17 +2621,12 @@ public class AccessController implements MasterObserver, RegionObserver,
RegionS
   }
 
   @Override
-  public void preReplicateLogEntries(ObserverContext<RegionServerCoprocessorEnvironment>
ctx,
-      List<WALEntry> entries, CellScanner cells) throws IOException {
+  public void preReplicateLogEntries(ObserverContext<RegionServerCoprocessorEnvironment>
ctx)
+      throws IOException {
     requirePermission(getActiveUser(ctx), "replicateLogEntries", Action.WRITE);
   }
 
   @Override
-  public void postReplicateLogEntries(ObserverContext<RegionServerCoprocessorEnvironment>
ctx,
-      List<WALEntry> entries, CellScanner cells) throws IOException {
-  }
-
-  @Override
   public void  preClearCompactionQueues(ObserverContext<RegionServerCoprocessorEnvironment>
ctx)
           throws IOException {
     requirePermission(getActiveUser(ctx), "preClearCompactionQueues", Permission.Action.ADMIN);

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
index c0ca409..61a4a85 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
@@ -373,10 +373,10 @@ public final class SnapshotDescriptionUtils {
    * @return true if the user is the owner of the snapshot,
    *         false otherwise or the snapshot owner field is not present.
    */
-  public static boolean isSnapshotOwner(final SnapshotDescription snapshot, final User user)
{
+  public static boolean isSnapshotOwner(org.apache.hadoop.hbase.client.SnapshotDescription
snapshot,
+      User user) {
     if (user == null) return false;
-    if (!snapshot.hasOwner()) return false;
-    return snapshot.getOwner().equals(user.getShortName());
+    return user.getShortName().equals(snapshot.getOwner());
   }
 
   public static boolean isSecurityAvailable(Configuration conf) throws IOException {

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
index b4c85f1..1e36b0b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
@@ -47,6 +47,7 @@ import org.apache.hadoop.hbase.client.MasterSwitchType;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.client.RegionLocator;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.master.HMaster;
@@ -66,7 +67,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.shaded.protobuf.RequestConverter;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetTableDescriptorsRequest;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetTableNamesRequest;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.util.Bytes;

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/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 2c27e4d..70e4e92 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
@@ -72,6 +72,7 @@ import org.apache.hadoop.hbase.client.RegionLocator;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.client.security.SecurityCapability;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
@@ -136,7 +137,6 @@ import org.junit.rules.TestName;
 
 import org.apache.hadoop.hbase.shaded.ipc.protobuf.generated.TestProcedureProtos;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureState;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
 
 /**
  * Performs authorization checks for common operations, according to different
@@ -2001,10 +2001,8 @@ public class TestAccessController extends SecureTestUtil {
   public void testSnapshot() throws Exception {
     Admin admin = TEST_UTIL.getAdmin();
     final HTableDescriptor htd = admin.getTableDescriptor(TEST_TABLE);
-    SnapshotDescription.Builder builder = SnapshotDescription.newBuilder();
-    builder.setName(TEST_TABLE.getNameAsString() + "-snapshot");
-    builder.setTable(TEST_TABLE.getNameAsString());
-    final SnapshotDescription snapshot = builder.build();
+    final SnapshotDescription snapshot = new SnapshotDescription(
+        TEST_TABLE.getNameAsString() + "-snapshot", TEST_TABLE);
     AccessTestAction snapshotAction = new AccessTestAction() {
       @Override
       public Object run() throws Exception {
@@ -2062,11 +2060,9 @@ public class TestAccessController extends SecureTestUtil {
   public void testSnapshotWithOwner() throws Exception {
     Admin admin = TEST_UTIL.getAdmin();
     final HTableDescriptor htd = admin.getTableDescriptor(TEST_TABLE);
-    SnapshotDescription.Builder builder = SnapshotDescription.newBuilder();
-    builder.setName(TEST_TABLE.getNameAsString() + "-snapshot");
-    builder.setTable(TEST_TABLE.getNameAsString());
-    builder.setOwner(USER_OWNER.getName());
-    final SnapshotDescription snapshot = builder.build();
+    final SnapshotDescription snapshot = new SnapshotDescription(
+        TEST_TABLE.getNameAsString() + "-snapshot", TEST_TABLE, null, USER_OWNER.getName());
+
     AccessTestAction snapshotAction = new AccessTestAction() {
       @Override
       public Object run() throws Exception {
@@ -2904,10 +2900,8 @@ public class TestAccessController extends SecureTestUtil {
     AccessTestAction replicateLogEntriesAction = new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        ACCESS_CONTROLLER.preReplicateLogEntries(ObserverContext.createAndPrepare(RSCP_ENV,
null),
-          null, null);
-        ACCESS_CONTROLLER.postReplicateLogEntries(ObserverContext.createAndPrepare(RSCP_ENV,
null),
-          null, null);
+        ACCESS_CONTROLLER.preReplicateLogEntries(ObserverContext.createAndPrepare(RSCP_ENV,
null));
+        ACCESS_CONTROLLER.postReplicateLogEntries(ObserverContext.createAndPrepare(RSCP_ENV,
null));
         return null;
       }
     };

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/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 0c072b8..7e61d24 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
@@ -49,6 +49,7 @@ import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
@@ -65,7 +66,6 @@ import org.apache.hadoop.hbase.regionserver.RegionServerCoprocessorHost;
 import org.apache.hadoop.hbase.wal.WALEdit;
 import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.security.access.Permission.Action;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.testclassification.SecurityTests;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -633,9 +633,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
     verifyAllowed(new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        SnapshotDescription snapshot = SnapshotDescription.newBuilder()
-          .setName("foo")
-          .build();
+        SnapshotDescription snapshot = new SnapshotDescription("foo");
         HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
         ACCESS_CONTROLLER.preSnapshot(ObserverContext.createAndPrepare(CP_ENV, null),
           snapshot, htd);
@@ -647,9 +645,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
     verifyAllowed(new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        SnapshotDescription snapshot = SnapshotDescription.newBuilder()
-          .setName("foo")
-          .build();
+        SnapshotDescription snapshot = new SnapshotDescription("foo");
         ACCESS_CONTROLLER.preListSnapshot(ObserverContext.createAndPrepare(CP_ENV, null),
           snapshot);
         return null;
@@ -660,9 +656,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
     verifyAllowed(new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        SnapshotDescription snapshot = SnapshotDescription.newBuilder()
-          .setName("foo")
-          .build();
+        SnapshotDescription snapshot = new SnapshotDescription("foo");
         HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
         ACCESS_CONTROLLER.preCloneSnapshot(ObserverContext.createAndPrepare(CP_ENV, null),
           snapshot, htd);
@@ -674,9 +668,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
     verifyAllowed(new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        SnapshotDescription snapshot = SnapshotDescription.newBuilder()
-          .setName("foo")
-          .build();
+        SnapshotDescription snapshot = new SnapshotDescription("foo");
         HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
         ACCESS_CONTROLLER.preRestoreSnapshot(ObserverContext.createAndPrepare(CP_ENV, null),
           snapshot, htd);
@@ -688,9 +680,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
     verifyAllowed(new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        SnapshotDescription snapshot = SnapshotDescription.newBuilder()
-          .setName("foo")
-          .build();
+        SnapshotDescription snapshot = new SnapshotDescription("foo");
         ACCESS_CONTROLLER.preDeleteSnapshot(ObserverContext.createAndPrepare(CP_ENV, null),
           snapshot);
         return null;

http://git-wip-us.apache.org/repos/asf/hbase/blob/3c7ab810/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotClientRetries.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotClientRetries.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotClientRetries.java
index 949915c..bb28228 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotClientRetries.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotClientRetries.java
@@ -27,12 +27,12 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.coprocessor.MasterObserver;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
 import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.TestTableName;
 import org.junit.After;


Mime
View raw message