hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1158463 - in /hbase/trunk: ./ src/main/java/org/apache/hadoop/hbase/ src/main/java/org/apache/hadoop/hbase/coprocessor/ src/main/java/org/apache/hadoop/hbase/regionserver/ src/main/java/org/apache/hadoop/hbase/regionserver/wal/ src/test/ja...
Date Tue, 16 Aug 2011 22:15:07 GMT
Author: stack
Date: Tue Aug 16 22:15:06 2011
New Revision: 1158463

URL: http://svn.apache.org/viewvc?rev=1158463&view=rev
Log:
HBASE-4190 Coprocessors: pull up some cp constants from cp package to o.a.h.h.HConstants

Added:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/Coprocessor.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java
Removed:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/Coprocessor.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorEnvironment.java
Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseEndpointCoprocessor.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRegionObserver.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterCoprocessorEnvironment.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContext.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALCoprocessorEnvironment.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALObserver.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestWALObserver.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Tue Aug 16 22:15:06 2011
@@ -375,6 +375,8 @@ Release 0.91.0 - Unreleased
    HBASE-3807  Fix units in RS UI metrics (subramanian raghunathan)
    HBASE-4193  Enhance RPC debug logging to provide more details on
                call contents
+   HBASE-4190  Coprocessors: pull up some cp constants from cp package to
+               o.a.h.h.HConstants (Mingjie Lai)
 
   TASKS
    HBASE-3559  Move report of split to master OFF the heartbeat channel

Added: hbase/trunk/src/main/java/org/apache/hadoop/hbase/Coprocessor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/Coprocessor.java?rev=1158463&view=auto
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/Coprocessor.java (added)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/Coprocessor.java Tue Aug 16 22:15:06
2011
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase;
+
+import java.io.IOException;
+
+/**
+ * Coprocess interface.
+ */
+public interface Coprocessor {
+  static final int VERSION = 1;
+
+  /** Highest installation priority */
+  static final int PRIORITY_HIGHEST = 0;
+  /** High (system) installation priority */
+  static final int PRIORITY_SYSTEM = Integer.MAX_VALUE / 4;
+  /** Default installation priority for user coprocessors */
+  static final int PRIORITY_USER = Integer.MAX_VALUE / 2;
+  /** Lowest installation priority */
+  static final int PRIORITY_LOWEST = Integer.MAX_VALUE;
+
+  /**
+   * Lifecycle state of a given coprocessor instance.
+   */
+  public enum State {
+    UNINSTALLED,
+    INSTALLED,
+    STARTING,
+    ACTIVE,
+    STOPPING,
+    STOPPED
+  }
+
+  // Interface
+  void start(CoprocessorEnvironment env) throws IOException;
+
+  void stop(CoprocessorEnvironment env) throws IOException;
+}

Added: hbase/trunk/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java?rev=1158463&view=auto
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java (added)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java Tue Aug
16 22:15:06 2011
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.client.HTableInterface;
+
+/**
+ * Coprocessor environment state.
+ */
+public interface CoprocessorEnvironment {
+
+  /** @return the Coprocessor interface version */
+  public int getVersion();
+
+  /** @return the HBase version as a string (e.g. "0.21.0") */
+  public String getHBaseVersion();
+
+  /** @return the loaded coprocessor instance */
+  public Coprocessor getInstance();
+
+  /** @return the priority assigned to the loaded coprocessor */
+  public int getPriority();
+
+  /** @return the load sequence number */
+  public int getLoadSequence();
+
+  /** @return the configuration */
+  public Configuration getConfiguration();
+
+  /**
+   * @return an interface for accessing the given table
+   * @throws IOException
+   */
+  public HTableInterface getTable(byte[] tableName) throws IOException;
+}

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/HConstants.java Tue Aug 16 22:15:06
2011
@@ -25,6 +25,7 @@ import org.apache.hadoop.hbase.util.Byte
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.regex.Pattern;
 
 /**
  * HConstants holds a bunch of HBase-related constants
@@ -496,6 +497,17 @@ public final class HConstants {
           CORRUPT_DIR_NAME, Bytes.toString(META_TABLE_NAME),
           Bytes.toString(ROOT_TABLE_NAME), SPLIT_LOGDIR_NAME }));
 
+  public static final Pattern CP_HTD_ATTR_KEY_PATTERN = Pattern.compile
+      ("coprocessor\\$([0-9]+)", Pattern.CASE_INSENSITIVE);
+  public static final Pattern CP_HTD_ATTR_VALUE_PATTERN =
+      Pattern.compile("([^\\|]*)\\|([^\\|]+)\\|[\\s]*([\\d]*)[\\s]*(\\|.*)?");
+
+  public static final String CP_HTD_ATTR_VALUE_PARAM_KEY_PATTERN = "[^=,]+";
+  public static final String CP_HTD_ATTR_VALUE_PARAM_VALUE_PATTERN = "[^,]+";
+  public static final Pattern CP_HTD_ATTR_VALUE_PARAM_PATTERN = Pattern.compile(
+      "(" + CP_HTD_ATTR_VALUE_PARAM_KEY_PATTERN + ")=(" +
+      CP_HTD_ATTR_VALUE_PARAM_VALUE_PATTERN + "),?");
+
   private HConstants() {
     // Can't be instantiated with this ctor.
   }

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java Tue Aug 16 22:15:06
2011
@@ -32,10 +32,8 @@ import java.util.TreeMap;
 import java.util.regex.Matcher;
 
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.coprocessor.Coprocessor;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.io.hfile.Compression;
-import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
 import org.apache.hadoop.hbase.regionserver.StoreFile;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.WritableComparable;
@@ -705,14 +703,13 @@ public class HTableDescriptor implements
       throw new IOException("Coprocessor " + className + " already exists.");
     }
     // validate parameter kvs
-    //String kvString = "";
     StringBuilder kvString = new StringBuilder();
     if (kvs != null) {
       for (Map.Entry<String, String> e: kvs.entrySet()) {
-        if (!e.getKey().matches(RegionCoprocessorHost.PARAMETER_KEY_PATTERN)) {
+        if (!e.getKey().matches(HConstants.CP_HTD_ATTR_VALUE_PARAM_KEY_PATTERN)) {
           throw new IOException("Illegal parameter key = " + e.getKey());
         }
-        if (!e.getValue().matches(RegionCoprocessorHost.PARAMETER_VALUE_PATTERN)) {
+        if (!e.getValue().matches(HConstants.CP_HTD_ATTR_VALUE_PARAM_VALUE_PATTERN)) {
           throw new IOException("Illegal parameter (" + e.getKey() +
               ") value = " + e.getValue());
         }
@@ -731,7 +728,7 @@ public class HTableDescriptor implements
     for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e:
         this.values.entrySet()) {
       keyMatcher =
-          RegionCoprocessorHost.CP_KEY_PATTERN.matcher(
+          HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(
               Bytes.toString(e.getKey().get()));
       if (!keyMatcher.matches()) {
         continue;
@@ -754,13 +751,13 @@ public class HTableDescriptor implements
     for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e:
         this.values.entrySet()) {
       keyMatcher =
-          RegionCoprocessorHost.CP_KEY_PATTERN.matcher(
+          HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(
               Bytes.toString(e.getKey().get()));
       if (!keyMatcher.matches()) {
         continue;
       }
       valueMatcher =
-        RegionCoprocessorHost.CP_VALUE_PATTERN.matcher(
+        HConstants.CP_HTD_ATTR_VALUE_PATTERN.matcher(
             Bytes.toString(e.getValue().get()));
       if (!valueMatcher.matches()) {
         continue;

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseEndpointCoprocessor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseEndpointCoprocessor.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseEndpointCoprocessor.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseEndpointCoprocessor.java
Tue Aug 16 22:15:06 2011
@@ -18,6 +18,8 @@ package org.apache.hadoop.hbase.coproces
 
 import java.io.IOException;
 
+import org.apache.hadoop.hbase.Coprocessor;
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.ipc.CoprocessorProtocol;
 import org.apache.hadoop.ipc.VersionedProtocol;
 

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java
Tue Aug 16 22:15:06 2011
@@ -22,7 +22,7 @@ package org.apache.hadoop.hbase.coproces
 
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HServerInfo;
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.UnknownRegionException;

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRegionObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRegionObserver.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRegionObserver.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRegionObserver.java
Tue Aug 16 22:15:06 2011
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.coproces
 import java.util.List;
 import java.util.Map;
 
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Delete;

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java Tue
Aug 16 22:15:06 2011
@@ -25,6 +25,8 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Coprocessor;
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.client.*;

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterCoprocessorEnvironment.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterCoprocessorEnvironment.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterCoprocessorEnvironment.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterCoprocessorEnvironment.java
Tue Aug 16 22:15:06 2011
@@ -20,6 +20,7 @@
 
 package org.apache.hadoop.hbase.coprocessor;
 
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.master.MasterServices;
 
 public interface MasterCoprocessorEnvironment extends CoprocessorEnvironment {

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContext.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContext.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContext.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContext.java Tue
Aug 16 22:15:06 2011
@@ -20,6 +20,8 @@
 
 package org.apache.hadoop.hbase.coprocessor;
 
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
+
 /**
  * Carries the execution state for a given invocation of an Observer coprocessor
  * ({@link RegionObserver}, {@link MasterObserver}, or {@link WALObserver})

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java
Tue Aug 16 22:15:06 2011
@@ -20,6 +20,7 @@
 
 package org.apache.hadoop.hbase.coprocessor;
 
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.RegionServerServices;
 

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java Tue
Aug 16 22:15:06 2011
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.coproces
 import java.util.List;
 import java.util.Map;
 
+import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Delete;

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALCoprocessorEnvironment.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALCoprocessorEnvironment.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALCoprocessorEnvironment.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALCoprocessorEnvironment.java
Tue Aug 16 22:15:06 2011
@@ -20,6 +20,7 @@
 
 package org.apache.hadoop.hbase.coprocessor;
 
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.regionserver.wal.HLog;
 
 public interface WALCoprocessorEnvironment extends CoprocessorEnvironment {

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALObserver.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALObserver.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/WALObserver.java Tue Aug
16 22:15:06 2011
@@ -20,6 +20,7 @@
 
 package org.apache.hadoop.hbase.coprocessor;
 
+import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java
Tue Aug 16 22:15:06 2011
@@ -28,6 +28,8 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.Coprocessor;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.client.*;
 import org.apache.hadoop.hbase.coprocessor.*;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
@@ -42,7 +44,6 @@ import org.apache.hadoop.util.StringUtil
 import java.io.IOException;
 import java.util.*;
 import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 /**
  * Implements the coprocessor environment and runtime support for coprocessors
@@ -92,16 +93,6 @@ public class RegionCoprocessorHost
     }
   }
 
-  public static final Pattern CP_KEY_PATTERN = Pattern.compile
-      ("coprocessor\\$([0-9]+)", Pattern.CASE_INSENSITIVE);
-  public static final Pattern CP_VALUE_PATTERN =
-      Pattern.compile("([^\\|]*)\\|([^\\|]+)\\|[\\s]*([\\d]*)[\\s]*(\\|.*)?");
-
-  public static final String PARAMETER_KEY_PATTERN = "[^=,]+";
-  public static final String PARAMETER_VALUE_PATTERN = "[^,]+";
-  public static final Pattern CFG_SPEC_MATCH = Pattern.compile(
-      "(" + PARAMETER_KEY_PATTERN + ")=(" + PARAMETER_VALUE_PATTERN  + "),?");
-
   /** The region server services */
   RegionServerServices rsServices;
   /** The region */
@@ -134,10 +125,10 @@ public class RegionCoprocessorHost
         region.getTableDesc().getValues().entrySet()) {
       String key = Bytes.toString(e.getKey().get()).trim();
       String spec = Bytes.toString(e.getValue().get()).trim();
-      if (CP_KEY_PATTERN.matcher(key).matches()) {
+      if (HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(key).matches()) {
         // found one
         try {
-          Matcher matcher = CP_VALUE_PATTERN.matcher(spec);
+          Matcher matcher = HConstants.CP_HTD_ATTR_VALUE_PATTERN.matcher(spec);
           if (matcher.matches()) {
             // jar file path can be empty if the cp class can be loaded
             // from class loader.
@@ -155,7 +146,7 @@ public class RegionCoprocessorHost
             if (cfgSpec != null) {
               cfgSpec = cfgSpec.substring(cfgSpec.indexOf('|') + 1);
               Configuration newConf = HBaseConfiguration.create(conf);
-              Matcher m = CFG_SPEC_MATCH.matcher(cfgSpec);
+              Matcher m = HConstants.CP_HTD_ATTR_VALUE_PARAM_PATTERN.matcher(cfgSpec);
               while (m.find()) {
                 newConf.set(m.group(1), m.group(2));
               }

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCoprocessorHost.java
Tue Aug 16 22:15:06 2011
@@ -23,6 +23,7 @@ package org.apache.hadoop.hbase.regionse
 
 import java.io.IOException;
 
+import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.coprocessor.*;
 import org.apache.hadoop.conf.Configuration;

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java Tue
Aug 16 22:15:06 2011
@@ -27,6 +27,8 @@ import org.apache.hadoop.hbase.HBaseTest
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
+import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hdfs.MiniDFSCluster;

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
Tue Aug 16 22:15:06 2011
@@ -32,6 +32,8 @@ import org.apache.hadoop.hbase.HBaseTest
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
+import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
Tue Aug 16 22:15:06 2011
@@ -39,6 +39,7 @@ import org.apache.hadoop.hbase.HTableDes
 import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.UnknownRegionException;
+import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.master.AssignmentManager;

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
Tue Aug 16 22:15:06 2011
@@ -27,6 +27,7 @@ import java.util.Arrays;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.MiniHBaseCluster;

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverStacking.java
Tue Aug 16 22:15:06 2011
@@ -30,6 +30,7 @@ import org.apache.hadoop.hbase.HBaseConf
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestWALObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestWALObserver.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestWALObserver.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestWALObserver.java Tue
Aug 16 22:15:06 2011
@@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.HRegionIn
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.regionserver.wal.HLog;
 import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter;

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java?rev=1158463&r1=1158462&r2=1158463&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java Tue Aug
16 22:15:06 2011
@@ -42,7 +42,7 @@ import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.regionserver.wal.HLog.Reader;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSUtils;
-import org.apache.hadoop.hbase.coprocessor.Coprocessor;
+import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
 import org.apache.hadoop.hbase.coprocessor.SampleRegionWALObserver;
 import org.apache.hadoop.hdfs.DFSClient;



Mime
View raw message