Review Board 1.7.22


[Coprocessors] Support configuration of coprocessor at load time

Review Request #984 - Created June 30, 2011 and submitted

Andrew Purtell
trunk
HBASE-4048
Reviewers
hbase
hbase-git
Users should be able to pass configuration options to coprocessors. These options should be applied at load time.

- For system coprocessors, just use the configuration of the container.

- Extend table coprocessor load specification to allow arbitrary key-value pairs at the end (<key>=<value>{,}).

Also fixes the outstanding issue where coprocessor priority is supposed to be an integer range but is constrained by the Coprocessor.Priority enum to 4 values. 
Modified o.a.h.h.coprocessor.TestClassLoading to check new functionality.
src/main/java/org/apache/hadoop/hbase/coprocessor/Coprocessor.java
Revision c2ea442 New Change
[20] 19 lines
[+20]
20

    
   
20

   
21
/**
21
/**
22
 * Coprocess interface.
22
 * Coprocess interface.
23
 */
23
 */
24
public interface Coprocessor {
24
public interface Coprocessor {
25
  public static final int VERSION = 1;
25
  static final int VERSION = 1;
26

    
   
26

   
27
  /**
27
  /** Highest installation priority */
28
   * Installation priority. Coprocessors will be executed in sequence
28
  static final int PRIORITY_HIGHEST = 0;
29
   * by the order of coprocessor priority.
29
  /** High (system) installation priority */
30
   */
30
  static final int PRIORITY_SYSTEM = Integer.MAX_VALUE / 4;
31
  public enum Priority {
31
  /** Default installation priority for user coprocessors */
32
    HIGHEST(0),
32
  static final int PRIORITY_USER = Integer.MAX_VALUE / 2;
33
    SYSTEM(Integer.MAX_VALUE/4),
33
  /** Lowest installation priority */
34
    USER(Integer.MAX_VALUE/2),
34
  static final int PRIORITY_LOWEST = Integer.MAX_VALUE;
35
    LOWEST(Integer.MAX_VALUE);

   
36

    
   

   
37
    private int prio;

   
38

    
   

   
39
    Priority(int prio) {

   
40
      this.prio = prio;

   
41
    }

   
42

    
   

   
43
    public int intValue() {

   
44
      return prio;

   
45
    }

   
46
  }

   
47

    
   
35

   
48
  /**
36
  /**
49
   * Lifecycle state of a given coprocessor instance.
37
   * Lifecycle state of a given coprocessor instance.
50
   */
38
   */
51
  public enum State {
39
  public enum State {
[+20] [20] 13 lines
src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorEnvironment.java
Revision ac5387a New Change
 
src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
Revision 5bae05a New Change
 
src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
Revision 4800bea New Change
 
src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
Revision 9c4916f New Change
 
src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
Revision 796742c New Change
 
src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
Revision 58a09f8 New Change
 
src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
Revision 969b1f3 New Change
 
src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
Revision 0435326 New Change
 
src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java
Revision 0cdf7d1 New Change
 
  1. src/main/java/org/apache/hadoop/hbase/coprocessor/Coprocessor.java: Loading...
  2. src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorEnvironment.java: Loading...
  3. src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java: Loading...
  4. src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java: Loading...
  5. src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java: Loading...
  6. src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java: Loading...
  7. src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java: Loading...
  8. src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java: Loading...
  9. src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java: Loading...
  10. src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java: Loading...