hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-18566 [RSGROUP]Log the client IP/port of the rsgroup admin
Date Mon, 14 Aug 2017 03:29:19 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 05e6e5695 -> c6bf4d519


HBASE-18566 [RSGROUP]Log the client IP/port of the rsgroup admin

Signed-off-by: tedyu <yuzhihong@gmail.com>


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

Branch: refs/heads/master
Commit: c6bf4d51928985517c438d1efcaefdeddc9ac5ef
Parents: 05e6e56
Author: Guangxu Cheng <guangxucheng@gmail.com>
Authored: Mon Aug 14 10:44:52 2017 +0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sun Aug 13 20:29:12 2017 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java   | 15 +++++++++++++++
 .../java/org/apache/hadoop/hbase/master/HMaster.java |  2 +-
 .../apache/hadoop/hbase/master/MasterServices.java   |  2 ++
 .../hadoop/hbase/master/MockNoopMasterServices.java  |  5 +++++
 4 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c6bf4d51/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 9fda3f0..0bc5c76 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
@@ -120,6 +120,8 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
         GetRSGroupInfoRequest request, RpcCallback<GetRSGroupInfoResponse> done) {
       GetRSGroupInfoResponse.Builder builder = GetRSGroupInfoResponse.newBuilder();
       String groupName = request.getRSGroupName();
+      LOG.info(master.getClientIdAuditPrefix() + " initiates rsgroup info retrieval, group="
+              + groupName);
       try {
         RSGroupInfo rsGroupInfo = groupAdminServer.getRSGroupInfo(groupName);
         if (rsGroupInfo != null) {
@@ -137,6 +139,8 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
       GetRSGroupInfoOfTableResponse.Builder builder = GetRSGroupInfoOfTableResponse.newBuilder();
       try {
         TableName tableName = ProtobufUtil.toTableName(request.getTableName());
+        LOG.info(master.getClientIdAuditPrefix() + " initiates rsgroup info retrieval, table="
+                + tableName);
         RSGroupInfo RSGroupInfo = groupAdminServer.getRSGroupInfoOfTable(tableName);
         if (RSGroupInfo != null) {
           builder.setRSGroupInfo(RSGroupProtobufUtil.toProtoGroupInfo(RSGroupInfo));
@@ -156,6 +160,8 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
         for (HBaseProtos.ServerName el : request.getServersList()) {
           hostPorts.add(Address.fromParts(el.getHostName(), el.getPort()));
         }
+        LOG.info(master.getClientIdAuditPrefix() + " move servers " + hostPorts +" to rsgroup
"
+                + request.getTargetGroup());
         groupAdminServer.moveServers(hostPorts, request.getTargetGroup());
       } catch (IOException e) {
         CoprocessorRpcUtils.setControllerException(controller, e);
@@ -172,6 +178,8 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
         for (HBaseProtos.TableName tableName : request.getTableNameList()) {
           tables.add(ProtobufUtil.toTableName(tableName));
         }
+        LOG.info(master.getClientIdAuditPrefix() + " move tables " + tables +" to rsgroup
"
+                + request.getTargetGroup());
         groupAdminServer.moveTables(tables, request.getTargetGroup());
       } catch (IOException e) {
         CoprocessorRpcUtils.setControllerException(controller, e);
@@ -183,6 +191,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
     public void addRSGroup(RpcController controller, AddRSGroupRequest request,
         RpcCallback<AddRSGroupResponse> done) {
       AddRSGroupResponse.Builder builder = AddRSGroupResponse.newBuilder();
+      LOG.info(master.getClientIdAuditPrefix() + " add rsgroup " + request.getRSGroupName());
       try {
         groupAdminServer.addRSGroup(request.getRSGroupName());
       } catch (IOException e) {
@@ -196,6 +205,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
         RemoveRSGroupRequest request, RpcCallback<RemoveRSGroupResponse> done) {
       RemoveRSGroupResponse.Builder builder =
           RemoveRSGroupResponse.newBuilder();
+      LOG.info(master.getClientIdAuditPrefix() + " remove rsgroup " + request.getRSGroupName());
       try {
         groupAdminServer.removeRSGroup(request.getRSGroupName());
       } catch (IOException e) {
@@ -208,6 +218,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
     public void balanceRSGroup(RpcController controller,
         BalanceRSGroupRequest request, RpcCallback<BalanceRSGroupResponse> done) {
       BalanceRSGroupResponse.Builder builder = BalanceRSGroupResponse.newBuilder();
+      LOG.info(master.getClientIdAuditPrefix() + " balance rsgroup, group=" + request.getRSGroupName());
       try {
         builder.setBalanceRan(groupAdminServer.balanceRSGroup(request.getRSGroupName()));
       } catch (IOException e) {
@@ -221,6 +232,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
     public void listRSGroupInfos(RpcController controller,
         ListRSGroupInfosRequest request, RpcCallback<ListRSGroupInfosResponse> done)
{
       ListRSGroupInfosResponse.Builder builder = ListRSGroupInfosResponse.newBuilder();
+      LOG.info(master.getClientIdAuditPrefix() + " list rsgroup");
       try {
         for (RSGroupInfo RSGroupInfo : groupAdminServer.listRSGroups()) {
           builder.addRSGroupInfo(RSGroupProtobufUtil.toProtoGroupInfo(RSGroupInfo));
@@ -238,6 +250,7 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
       try {
         Address hp = Address.fromParts(request.getServer().getHostName(),
             request.getServer().getPort());
+        LOG.info(master.getClientIdAuditPrefix() + " initiates rsgroup info retrieval, server="
+ hp);
         RSGroupInfo RSGroupInfo = groupAdminServer.getRSGroupOfServer(hp);
         if (RSGroupInfo != null) {
           builder.setRSGroupInfo(RSGroupProtobufUtil.toProtoGroupInfo(RSGroupInfo));
@@ -261,6 +274,8 @@ public class RSGroupAdminEndpoint implements MasterObserver, CoprocessorService
         for (HBaseProtos.TableName tableName : request.getTableNameList()) {
           tables.add(ProtobufUtil.toTableName(tableName));
         }
+        LOG.info(master.getClientIdAuditPrefix() + " move servers " + hostPorts
+                + " and tables " + tables + " to rsgroup" + request.getTargetGroup());
         groupAdminServer.moveServersAndTables(hostPorts, tables, request.getTargetGroup());
       } catch (IOException e) {
         CoprocessorRpcUtils.setControllerException(controller, e);

http://git-wip-us.apache.org/repos/asf/hbase/blob/c6bf4d51/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index faf0893..ce83838 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -1517,7 +1517,7 @@ public class HMaster extends HRegionServer implements MasterServices
{
   /**
    * @return Client info for use as prefix on an audit log string; who did an action
    */
-  String getClientIdAuditPrefix() {
+  public String getClientIdAuditPrefix() {
     return "Client=" + RpcServer.getRequestUserName() + "/" + RpcServer.getRemoteAddress();
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/c6bf4d51/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
index f7f5d06..6e97bf4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
@@ -508,4 +508,6 @@ public interface MasterServices extends Server {
    * method to make sure meta is initialized.
    */
   boolean recoverMeta() throws IOException;
+
+  String getClientIdAuditPrefix();
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/c6bf4d51/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java
index aac0e21..27c9a5f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java
@@ -460,6 +460,11 @@ public class MockNoopMasterServices implements MasterServices, Server
{
   }
 
   @Override
+  public String getClientIdAuditPrefix() {
+    return null;
+  }
+
+  @Override
   public ProcedureEvent getInitializedEvent() {
     // TODO Auto-generated method stub
     return null;


Mime
View raw message