Review Board 1.7.22


HBASE-5621 Convert admin protocol of HRegionInterface to PB

Review Request #4714 - Created April 13, 2012 and submitted

Jimmy Xiang
trunk
HBASE-5621
Reviewers
hbase
hbase-git
This is the admin part of HBase-5443.  AdminProtocol part.
All unit tests passed.

Diff revision 2

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

1 2 3
1 2 3

  1. security/src/main/java/org/apache/hadoop/hbase/ipc/SecureRpcEngine.java: Loading...
  2. src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java: Loading...
  3. src/main/java/org/apache/hadoop/hbase/client/AdminProtocol.java: Loading...
  4. src/main/java/org/apache/hadoop/hbase/client/ClientProtocol.java: Loading...
  5. src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java: Loading...
  6. src/main/java/org/apache/hadoop/hbase/client/HConnection.java: Loading...
  7. src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java: Loading...
  8. src/main/java/org/apache/hadoop/hbase/client/HTable.java: Loading...
  9. src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java: Loading...
  10. src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java: Loading...
  11. src/main/java/org/apache/hadoop/hbase/ipc/ExecRPCInvoker.java: Loading...
  12. src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java: Loading...
  13. src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java: Loading...
  14. src/main/java/org/apache/hadoop/hbase/ipc/RpcEngine.java: Loading...
  15. src/main/java/org/apache/hadoop/hbase/ipc/WritableRpcEngine.java: Loading...
  16. src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java: Loading...
  17. src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java: Loading...
  18. src/main/java/org/apache/hadoop/hbase/master/ServerManager.java: Loading...
  19. src/main/java/org/apache/hadoop/hbase/protobuf/AdminProtocol.java: Loading...
  20. src/main/java/org/apache/hadoop/hbase/protobuf/ClientProtocol.java: Loading...
This diff has been split across 2 pages: 1 2 >
security/src/main/java/org/apache/hadoop/hbase/ipc/SecureRpcEngine.java
Revision 8219bea New Change
[20] 17 lines
[+20]
18

    
   
18

   
19
package org.apache.hadoop.hbase.ipc;
19
package org.apache.hadoop.hbase.ipc;
20

    
   
20

   
21
import org.apache.commons.logging.Log;
21
import org.apache.commons.logging.Log;
22
import org.apache.commons.logging.LogFactory;
22
import org.apache.commons.logging.LogFactory;
23
import org.apache.hadoop.conf.Configurable;

   
24
import org.apache.hadoop.conf.Configuration;
23
import org.apache.hadoop.conf.Configuration;
25
import org.apache.hadoop.hbase.Server;

   
26
import org.apache.hadoop.hbase.client.RetriesExhaustedException;

   
27
import org.apache.hadoop.hbase.io.HbaseObjectWritable;
24
import org.apache.hadoop.hbase.io.HbaseObjectWritable;
28
import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
25
import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;

    
   
26
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
29
import org.apache.hadoop.hbase.security.HBasePolicyProvider;
27
import org.apache.hadoop.hbase.security.HBasePolicyProvider;
30
import org.apache.hadoop.hbase.security.HBaseSaslRpcServer;
28
import org.apache.hadoop.hbase.security.HBaseSaslRpcServer;
31
import org.apache.hadoop.hbase.security.User;
29
import org.apache.hadoop.hbase.security.User;
32
import org.apache.hadoop.hbase.security.token.AuthenticationTokenSecretManager;
30
import org.apache.hadoop.hbase.security.token.AuthenticationTokenSecretManager;
33
import org.apache.hadoop.hbase.util.Objects;
31
import org.apache.hadoop.hbase.util.Objects;
34
import org.apache.hadoop.io.Writable;
32
import org.apache.hadoop.io.Writable;
35
import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate;
33
import org.apache.hadoop.ipc.RemoteException;
36
import org.apache.hadoop.net.NetUtils;

   
37
import org.apache.hadoop.security.authorize.ServiceAuthorizationManager;
34
import org.apache.hadoop.security.authorize.ServiceAuthorizationManager;
38

    
   
35

   

    
   
36
import com.google.protobuf.ServiceException;

    
   
37

   
39
import javax.net.SocketFactory;
38
import javax.net.SocketFactory;
40
import java.io.DataInput;

   
41
import java.io.DataOutput;

   
42
import java.io.IOException;
39
import java.io.IOException;
43
import java.lang.reflect.*;
40
import java.lang.reflect.*;
44
import java.net.ConnectException;

   
45
import java.net.InetSocketAddress;
41
import java.net.InetSocketAddress;
46
import java.net.SocketTimeoutException;

   
47
import java.util.HashMap;
42
import java.util.HashMap;
48
import java.util.Map;
43
import java.util.Map;
49

    
   
44

   
50
/**
45
/**
51
 * A loadable RPC engine supporting SASL authentication of connections, using
46
 * A loadable RPC engine supporting SASL authentication of connections, using
[+20] [20] 107 lines
[+20] [+] public Object invoke(Object proxy, Method method, Object[] args)
159
      final boolean logDebug = LOG.isDebugEnabled();
154
      final boolean logDebug = LOG.isDebugEnabled();
160
      long startTime = 0;
155
      long startTime = 0;
161
      if (logDebug) {
156
      if (logDebug) {
162
        startTime = System.currentTimeMillis();
157
        startTime = System.currentTimeMillis();
163
      }
158
      }

    
   
159
      try {
164
      HbaseObjectWritable value = (HbaseObjectWritable)
160
        HbaseObjectWritable value = (HbaseObjectWritable)
165
        client.call(new Invocation(method, args), address,
161
          client.call(new Invocation(method, args), address,
166
                    protocol, ticket, rpcTimeout);
162
                      protocol, ticket, rpcTimeout);
167
      if (logDebug) {
163
        if (logDebug) {
168
        long callTime = System.currentTimeMillis() - startTime;
164
          long callTime = System.currentTimeMillis() - startTime;
169
        LOG.debug("Call: " + method.getName() + " " + callTime);
165
          LOG.debug("Call: " + method.getName() + " " + callTime);
170
      }
166
        }
171
      return value.get();
167
        return value.get();

    
   
168
      } catch (Throwable t) {

    
   
169
        // For protobuf protocols, ServiceException is expected

    
   
170
        if (Invocation.PROTOBUF_PROTOCOLS.contains(protocol)) {

    
   
171
          if (t instanceof RemoteException) {

    
   
172
            Throwable cause = ((RemoteException)t).unwrapRemoteException();

    
   
173
            throw new ServiceException(cause);

    
   
174
          }

    
   
175
          throw new ServiceException(t);

    
   
176
        }

    
   
177
        throw t;

    
   
178
      }
172
    }
179
    }
173

    
   
180

   
174
    /* close the IPC client that's responsible for this invoker's RPCs */
181
    /* close the IPC client that's responsible for this invoker's RPCs */
175
    synchronized protected void close() {
182
    synchronized protected void close() {
176
      if (!isClosed) {
183
      if (!isClosed) {
[+20] [20] 211 lines
[+20] [+] public Writable call(Class<? extends VersionedProtocol> protocol,
388
      } catch (InvocationTargetException e) {
395
      } catch (InvocationTargetException e) {
389
        Throwable target = e.getTargetException();
396
        Throwable target = e.getTargetException();
390
        if (target instanceof IOException) {
397
        if (target instanceof IOException) {
391
          throw (IOException)target;
398
          throw (IOException)target;
392
        }
399
        }

    
   
400
        if (target instanceof ServiceException) {

    
   
401
          throw ProtobufUtil.getRemoteException((ServiceException)target);

    
   
402
        }
393
        IOException ioe = new IOException(target.toString());
403
        IOException ioe = new IOException(target.toString());
394
        ioe.setStackTrace(target.getStackTrace());
404
        ioe.setStackTrace(target.getStackTrace());
395
        throw ioe;
405
        throw ioe;
396
      } catch (Throwable e) {
406
      } catch (Throwable e) {
397
        if (!(e instanceof IOException)) {
407
        if (!(e instanceof IOException)) {
[+20] [20] 16 lines
src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
Revision 408db79 New Change
 
src/main/java/org/apache/hadoop/hbase/client/AdminProtocol.java
New File
 
src/main/java/org/apache/hadoop/hbase/client/ClientProtocol.java
New File
 
src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
Revision ee16e72 New Change
 
src/main/java/org/apache/hadoop/hbase/client/HConnection.java
Revision 23f8e5a New Change
 
src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Revision 820e2a9 New Change
 
src/main/java/org/apache/hadoop/hbase/client/HTable.java
Revision 2c87d50 New Change
 
src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java
Revision fe80fcf New Change
 
src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java
Revision 2a9d86e New Change
 
src/main/java/org/apache/hadoop/hbase/ipc/ExecRPCInvoker.java
Revision d71e97e New Change
 
src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java
Revision 3a3a79f New Change
 
src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java
Revision b7afa58 New Change
 
src/main/java/org/apache/hadoop/hbase/ipc/RpcEngine.java
Revision dd0a1bc New Change
 
src/main/java/org/apache/hadoop/hbase/ipc/WritableRpcEngine.java
Revision 9f159f2 New Change
 
src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java
Revision d0570b9 New Change
 
src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
Revision ab33ac7 New Change
 
src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
Revision 70901fe New Change
 
src/main/java/org/apache/hadoop/hbase/protobuf/AdminProtocol.java
Revision 422e865 New Change
 
src/main/java/org/apache/hadoop/hbase/protobuf/ClientProtocol.java
Revision 3d6a23a New Change
 
  1. security/src/main/java/org/apache/hadoop/hbase/ipc/SecureRpcEngine.java: Loading...
  2. src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java: Loading...
  3. src/main/java/org/apache/hadoop/hbase/client/AdminProtocol.java: Loading...
  4. src/main/java/org/apache/hadoop/hbase/client/ClientProtocol.java: Loading...
  5. src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java: Loading...
  6. src/main/java/org/apache/hadoop/hbase/client/HConnection.java: Loading...
  7. src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java: Loading...
  8. src/main/java/org/apache/hadoop/hbase/client/HTable.java: Loading...
  9. src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java: Loading...
  10. src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java: Loading...
  11. src/main/java/org/apache/hadoop/hbase/ipc/ExecRPCInvoker.java: Loading...
  12. src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java: Loading...
  13. src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java: Loading...
  14. src/main/java/org/apache/hadoop/hbase/ipc/RpcEngine.java: Loading...
  15. src/main/java/org/apache/hadoop/hbase/ipc/WritableRpcEngine.java: Loading...
  16. src/main/java/org/apache/hadoop/hbase/mapreduce/LoadIncrementalHFiles.java: Loading...
  17. src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java: Loading...
  18. src/main/java/org/apache/hadoop/hbase/master/ServerManager.java: Loading...
  19. src/main/java/org/apache/hadoop/hbase/protobuf/AdminProtocol.java: Loading...
  20. src/main/java/org/apache/hadoop/hbase/protobuf/ClientProtocol.java: Loading...
This diff has been split across 2 pages: 1 2 >