Review Board 1.7.22


[HBase-4120] isolation and allocation,patch for table priority, test cases are added too.

Review Request #1421 - Created Aug. 9, 2011 and updated

Jia Liu
trunk
HBase-4120
Reviewers
hbase
hbase
Patch used for table priority alone,In this patch, not only tables can have different priorities but also the different actions like "get","scan","put" and "delete" can have priorities.
Tested with test cases in  TestCase_For_TablePriority_trunk_v1.patch 
please apply the patch of HBASE-4181 first,in some circumstances this bug will affect the performance of client.

Changes between revision 8 and 25

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

  1. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java: Loading...
  2. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java: Loading...
  3. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/PriorityFunction.java: Loading...
  4. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/PriorityHBaseServer.java: Loading...
  5. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/PriorityJobQueue.java: Loading...
  6. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/QosRegionObserver.java: Loading...
  7. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java: Loading...
  8. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/allocation/test/TestForActionPriority.java: Loading...
  9. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/allocation/test/TestForPriorityJobQueue.java: Loading...
  10. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/allocation/test/TestForTablePriority.java: Loading...
  11. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterCoprocessorExceptionWithAbort.java: Loading...
  12. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterCoprocessorExceptionWithRemove.java: Loading...
  13. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/GroupTestUtil.java: Loading...
  14. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestActionPriority.java: Loading...
  15. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestPriorityJobQueue.java: Loading...
  16. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestTablePriority.java: Loading...
  17. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestTablePriorityHundredRegion.java: Loading...
  18. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestTablePriorityLargeRow.java: Loading...
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java
Diff Revision 8 Diff Revision 25
[20] 23 lines
[+20]
24
import org.apache.commons.logging.LogFactory;
24
import org.apache.commons.logging.LogFactory;
25
import org.apache.hadoop.conf.Configuration;
25
import org.apache.hadoop.conf.Configuration;
26
import org.apache.hadoop.hbase.DoNotRetryIOException;
26
import org.apache.hadoop.hbase.DoNotRetryIOException;
27
import org.apache.hadoop.hbase.HConstants;
27
import org.apache.hadoop.hbase.HConstants;
28
import org.apache.hadoop.hbase.client.RetriesExhaustedException;
28
import org.apache.hadoop.hbase.client.RetriesExhaustedException;

    
   
29
import org.apache.hadoop.hbase.security.User;
29
import org.apache.hadoop.io.Writable;
30
import org.apache.hadoop.io.Writable;
30
import org.apache.hadoop.hbase.ipc.VersionedProtocol;

   
31
import org.apache.hadoop.net.NetUtils;
31
import org.apache.hadoop.net.NetUtils;
32
import org.apache.hadoop.security.UserGroupInformation;

   
33
import org.apache.hadoop.util.ReflectionUtils;
32
import org.apache.hadoop.util.ReflectionUtils;
34

    
   

   
35
import javax.net.SocketFactory;
33
import javax.net.SocketFactory;
36
import java.io.IOException;
34
import java.io.IOException;
37
import java.lang.reflect.Method;
35
import java.lang.reflect.Method;
38
import java.lang.reflect.Proxy;
36
import java.lang.reflect.Proxy;
39
import java.net.ConnectException;
37
import java.net.ConnectException;
[+20] [20] 36 lines
[+20] [+] public class HBaseRPC {
76

    
   
74

   
77
  private HBaseRPC() {
75
  private HBaseRPC() {
78
    super();
76
    super();
79
  }                                  // no public ctor
77
  }                                  // no public ctor
80

    
   
78

   
81
  private static final String RPC_ENGINE_PROP = "hbase.rpc.engine";
79
  /**

    
   
80
   * Configuration key for the {@link RpcEngine} implementation to load to

    
   
81
   * handle connection protocols.  Handlers for individual protocols can be

    
   
82
   * configured using {@code "hbase.rpc.engine." + protocol.class.name}.

    
   
83
   */

    
   
84
  public static final String RPC_ENGINE_PROP = "hbase.rpc.engine";
82

    
   
85

   
83
  // cache of RpcEngines by protocol
86
  // cache of RpcEngines by protocol
84
  private static final Map<Class,RpcEngine> PROTOCOL_ENGINES
87
  private static final Map<Class,RpcEngine> PROTOCOL_ENGINES
85
    = new HashMap<Class,RpcEngine>();
88
    = new HashMap<Class,RpcEngine>();
86

    
   
89

   
[+20] [20] 96 lines
[+20] [+] public long getServerVersion() {
183
   * An error requesting an RPC protocol that the server is not serving.
186
   * An error requesting an RPC protocol that the server is not serving.
184
   */
187
   */
185
  public static class UnknownProtocolException extends DoNotRetryIOException {
188
  public static class UnknownProtocolException extends DoNotRetryIOException {
186
    private Class<?> protocol;
189
    private Class<?> protocol;
187

    
   
190

   

    
   
191
    public UnknownProtocolException(String mesg) {

    
   
192
      // required for unwrapping from a RemoteException

    
   
193
      super(mesg);

    
   
194
    }

    
   
195

   
188
    public UnknownProtocolException(Class<?> protocol) {
196
    public UnknownProtocolException(Class<?> protocol) {
189
      this(protocol, "Server is not handling protocol "+protocol.getName());
197
      this(protocol, "Server is not handling protocol "+protocol.getName());
190
    }
198
    }
191

    
   
199

   
192
    public UnknownProtocolException(Class<?> protocol, String mesg) {
200
    public UnknownProtocolException(Class<?> protocol, String mesg) {
[+20] [20] 74 lines
[+20] [+] public static VersionedProtocol waitForProxy(Class protocol,
267
   * @throws IOException e
275
   * @throws IOException e
268
   */
276
   */
269
  public static VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
277
  public static VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
270
      long clientVersion, InetSocketAddress addr, Configuration conf,
278
      long clientVersion, InetSocketAddress addr, Configuration conf,
271
      SocketFactory factory, int rpcTimeout) throws IOException {
279
      SocketFactory factory, int rpcTimeout) throws IOException {
272
    return getProxy(protocol, clientVersion, addr, null, conf, factory,
280
    return getProxy(protocol, clientVersion, addr,
273
        rpcTimeout);
281
        User.getCurrent(), conf, factory, rpcTimeout);
274
  }
282
  }
275

    
   
283

   
276
  /**
284
  /**
277
   * Construct a client-side proxy object that implements the named protocol,
285
   * Construct a client-side proxy object that implements the named protocol,
278
   * talking to a server at the named address.
286
   * talking to a server at the named address.
[+20] [20] 8 lines
[+20] public static VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
287
   * @return proxy
295
   * @return proxy
288
   * @throws IOException e
296
   * @throws IOException e
289
   */
297
   */
290
  public static VersionedProtocol getProxy(
298
  public static VersionedProtocol getProxy(
291
      Class<? extends VersionedProtocol> protocol,
299
      Class<? extends VersionedProtocol> protocol,
292
      long clientVersion, InetSocketAddress addr, UserGroupInformation ticket,
300
      long clientVersion, InetSocketAddress addr, User ticket,
293
      Configuration conf, SocketFactory factory, int rpcTimeout)
301
      Configuration conf, SocketFactory factory, int rpcTimeout)
294
  throws IOException {
302
  throws IOException {
295
    VersionedProtocol proxy =
303
    VersionedProtocol proxy =
296
        getProtocolEngine(protocol,conf)
304
        getProtocolEngine(protocol,conf)
297
            .getProxy(protocol, clientVersion, addr, ticket, conf, factory, Math.min(rpcTimeout, HBaseRPC.getRpcTimeout()));
305
            .getProxy(protocol, clientVersion, addr, ticket, conf, factory, Math.min(rpcTimeout, HBaseRPC.getRpcTimeout()));
[+20] [20] 44 lines
[+20] [+] public static void stopProxy(VersionedProtocol proxy) {
342
   * @param params array of parameters
350
   * @param params array of parameters
343
   * @param addrs array of addresses
351
   * @param addrs array of addresses
344
   * @param conf configuration
352
   * @param conf configuration
345
   * @return values
353
   * @return values
346
   * @throws IOException e
354
   * @throws IOException e

    
   
355
   * @deprecated Instead of calling statically, use

    
   
356
   *     {@link HBaseRPC#getProtocolEngine(Class, org.apache.hadoop.conf.Configuration)}

    
   
357
   *     to obtain an {@link RpcEngine} instance and then use

    
   
358
   *     {@link RpcEngine#call(java.lang.reflect.Method, Object[][], java.net.InetSocketAddress[], Class, org.apache.hadoop.hbase.security.User, org.apache.hadoop.conf.Configuration)}
347
   */
359
   */

    
   
360
  @Deprecated
348
  public static Object[] call(Method method, Object[][] params,
361
  public static Object[] call(Method method, Object[][] params,
349
      InetSocketAddress[] addrs,
362
      InetSocketAddress[] addrs,
350
      Class<? extends VersionedProtocol> protocol,
363
      Class<? extends VersionedProtocol> protocol,
351
      UserGroupInformation ticket,
364
      User ticket,
352
      Configuration conf)
365
      Configuration conf)
353
    throws IOException, InterruptedException {
366
    throws IOException, InterruptedException {
354
    return getProtocolEngine(protocol, conf)
367
    return getProtocolEngine(protocol, conf)
355
      .call(method, params, addrs, protocol, ticket, conf);
368
      .call(method, params, addrs, protocol, ticket, conf);
356
  }
369
  }
[+20] [20] 16 lines
[+20] [+] public static RpcServer getServer(final Object instance,
373
                                 final String bindAddress, final int port,
386
                                 final String bindAddress, final int port,
374
                                 final int numHandlers,
387
                                 final int numHandlers,
375
                                 int metaHandlerCount, final boolean verbose, Configuration conf, int highPriorityLevel)
388
                                 int metaHandlerCount, final boolean verbose, Configuration conf, int highPriorityLevel)
376
    throws IOException {
389
    throws IOException {
377
    if (instance instanceof HRegionInterface
390
    if (instance instanceof HRegionInterface
378
        && conf.getBoolean("hbase.tablepriority.enable", true)) {
391
        && PriorityFunction.enable(conf)) {
379
      return new PriorityHBaseServer(instance, ifaces, conf, bindAddress, port,
392
      return new PriorityHBaseServer(instance, ifaces, conf, bindAddress, port,
380
          numHandlers, metaHandlerCount, verbose, highPriorityLevel);
393
          numHandlers, metaHandlerCount, verbose, highPriorityLevel);
381
    }
394
    }
382
    return getServer(instance.getClass(), instance, ifaces, bindAddress, port, numHandlers, metaHandlerCount, verbose, conf, highPriorityLevel);
395
    return getServer(instance.getClass(), instance, ifaces, bindAddress, port, numHandlers, metaHandlerCount, verbose, conf, highPriorityLevel);
383
  }
396
  }
[+20] [20] 25 lines
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/PriorityFunction.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/PriorityHBaseServer.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/PriorityJobQueue.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/QosRegionObserver.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Diff Revision 8 Diff Revision 25 - File Reverted
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/allocation/test/TestForActionPriority.java
Diff Revision 8 Diff Revision 25 - File Reverted
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/allocation/test/TestForPriorityJobQueue.java
Diff Revision 8 Diff Revision 25 - File Reverted
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/allocation/test/TestForTablePriority.java
Diff Revision 8 Diff Revision 25 - File Reverted
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterCoprocessorExceptionWithAbort.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterCoprocessorExceptionWithRemove.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/GroupTestUtil.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestActionPriority.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestPriorityJobQueue.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestTablePriority.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestTablePriorityHundredRegion.java
Diff Revision 8 Diff Revision 25
 
http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestTablePriorityLargeRow.java
Diff Revision 8 Diff Revision 25
 
  1. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java: Loading...
  2. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java: Loading...
  3. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/PriorityFunction.java: Loading...
  4. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/PriorityHBaseServer.java: Loading...
  5. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/PriorityJobQueue.java: Loading...
  6. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/QosRegionObserver.java: Loading...
  7. http://svn.apache.org/repos/asf/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java: Loading...
  8. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/allocation/test/TestForActionPriority.java: Loading...
  9. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/allocation/test/TestForPriorityJobQueue.java: Loading...
  10. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/allocation/test/TestForTablePriority.java: Loading...
  11. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterCoprocessorExceptionWithAbort.java: Loading...
  12. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterCoprocessorExceptionWithRemove.java: Loading...
  13. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/GroupTestUtil.java: Loading...
  14. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestActionPriority.java: Loading...
  15. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestPriorityJobQueue.java: Loading...
  16. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestTablePriority.java: Loading...
  17. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestTablePriorityHundredRegion.java: Loading...
  18. http://svn.apache.org/repos/asf/hbase/trunk/src/test/java/org/apache/hadoop/hbase/ipc/TestTablePriorityLargeRow.java: Loading...