HBASE-12973 RegionCoprocessorEnvironment should provide HRegionInfo directly

This commit is contained in:
Andrew Purtell 2015-02-09 17:57:40 -08:00
parent 1f830bea89
commit 1e6afa2f3c
3 changed files with 16 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.RegionServerServices;
@ -34,10 +35,12 @@ public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment {
/** @return the region associated with this coprocessor */
HRegion getRegion();
/** @return region information for the region this coprocessor is running on */
HRegionInfo getRegionInfo();
/** @return reference to the region server services */
RegionServerServices getRegionServerServices();
/** @return shared data between all instances of this coprocessor */
ConcurrentMap<String, Object> getSharedData();
ConcurrentMap<String, Object> getSharedData();
}

View File

@ -168,6 +168,11 @@ public class RegionCoprocessorHost
return latencies;
}
@Override
public HRegionInfo getRegionInfo() {
return region.getRegionInfo();
}
}
static class TableCoprocessorAttribute {

View File

@ -40,6 +40,7 @@ import org.apache.hadoop.hbase.CoordinatedStateManager;
import org.apache.hadoop.hbase.Coprocessor;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.Server;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
@ -244,6 +245,11 @@ public class TestTokenAuthentication {
public ClassLoader getClassLoader() {
return Thread.currentThread().getContextClassLoader();
}
@Override
public HRegionInfo getRegionInfo() {
return null;
}
});
started = true;