HBASE-3401. Region IPC operations should be high priority
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1056041 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
857d41472f
commit
7a678034af
|
@ -821,6 +821,7 @@ Release 0.90.0 - Unreleased
|
||||||
HBASE-3423 hbase-env.sh over-rides HBASE_OPTS incorrectly (Ted Dunning via
|
HBASE-3423 hbase-env.sh over-rides HBASE_OPTS incorrectly (Ted Dunning via
|
||||||
Andrew Purtell)
|
Andrew Purtell)
|
||||||
HBASE-3407 hbck should pause between fixing and re-checking state
|
HBASE-3407 hbck should pause between fixing and re-checking state
|
||||||
|
HBASE-3401 Region IPC operations should be high priority
|
||||||
|
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
|
|
@ -532,7 +532,7 @@ public abstract class HBaseServer implements RpcServer {
|
||||||
} catch (InterruptedException ieo) {
|
} catch (InterruptedException ieo) {
|
||||||
throw ieo;
|
throw ieo;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.debug(getName() + ": readAndProcess threw exception " + e + ". Count of bytes read: " + count, e);
|
LOG.warn(getName() + ": readAndProcess threw exception " + e + ". Count of bytes read: " + count, e);
|
||||||
count = -1; //so that the (count < 0) block is executed
|
count = -1; //so that the (count < 0) block is executed
|
||||||
}
|
}
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
|
|
|
@ -21,9 +21,12 @@ package org.apache.hadoop.hbase.regionserver;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.Thread.UncaughtExceptionHandler;
|
import java.lang.Thread.UncaughtExceptionHandler;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.lang.management.MemoryUsage;
|
import java.lang.management.MemoryUsage;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.net.BindException;
|
import java.net.BindException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -348,7 +351,26 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
private static final int QOS_THRESHOLD = 10; // the line between low and high qos
|
private static final int QOS_THRESHOLD = 10; // the line between low and high qos
|
||||||
private static final int HIGH_QOS = 100;
|
private static final int HIGH_QOS = 100;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
private @interface QosPriority {
|
||||||
|
int priority() default 0;
|
||||||
|
}
|
||||||
|
|
||||||
class QosFunction implements Function<Writable,Integer> {
|
class QosFunction implements Function<Writable,Integer> {
|
||||||
|
private final Map<String, Integer> annotatedQos;
|
||||||
|
|
||||||
|
public QosFunction() {
|
||||||
|
Map<String, Integer> qosMap = new HashMap<String, Integer>();
|
||||||
|
for (Method m : HRegionServer.class.getMethods()) {
|
||||||
|
QosPriority p = m.getAnnotation(QosPriority.class);
|
||||||
|
if (p != null) {
|
||||||
|
qosMap.put(m.getName(), p.priority());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
annotatedQos = qosMap;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isMetaRegion(byte[] regionName) {
|
public boolean isMetaRegion(byte[] regionName) {
|
||||||
HRegion region;
|
HRegion region;
|
||||||
try {
|
try {
|
||||||
|
@ -365,6 +387,11 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
|
|
||||||
Invocation inv = (Invocation) from;
|
Invocation inv = (Invocation) from;
|
||||||
String methodName = inv.getMethodName();
|
String methodName = inv.getMethodName();
|
||||||
|
|
||||||
|
Integer priorityByAnnotation = annotatedQos.get(methodName);
|
||||||
|
if (priorityByAnnotation != null) {
|
||||||
|
return priorityByAnnotation;
|
||||||
|
}
|
||||||
|
|
||||||
// scanner methods...
|
// scanner methods...
|
||||||
if (methodName.equals("next") || methodName.equals("close")) {
|
if (methodName.equals("next") || methodName.equals("close")) {
|
||||||
|
@ -386,13 +413,6 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
return HIGH_QOS;
|
return HIGH_QOS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (methodName.equals("getHServerInfo")
|
|
||||||
|| methodName.equals("getRegionsAssignment")
|
|
||||||
|| methodName.equals("unlockRow")
|
|
||||||
|| methodName.equals("getProtocolVersion")
|
|
||||||
|| methodName.equals("getClosestRowBefore")) {
|
|
||||||
// LOG.debug("High priority method: " + methodName);
|
|
||||||
return HIGH_QOS;
|
|
||||||
} else if (inv.getParameterClasses().length == 0) {
|
} else if (inv.getParameterClasses().length == 0) {
|
||||||
// Just let it through. This is getOnlineRegions, etc.
|
// Just let it through. This is getOnlineRegions, etc.
|
||||||
} else if (inv.getParameterClasses()[0] == byte[].class) {
|
} else if (inv.getParameterClasses()[0] == byte[].class) {
|
||||||
|
@ -1575,6 +1595,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public HRegionInfo getRegionInfo(final byte[] regionName)
|
public HRegionInfo getRegionInfo(final byte[] regionName)
|
||||||
throws NotServingRegionException {
|
throws NotServingRegionException {
|
||||||
requestCount.incrementAndGet();
|
requestCount.incrementAndGet();
|
||||||
|
@ -2016,6 +2037,8 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
return rl;
|
return rl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public void unlockRow(byte[] regionName, long lockId) throws IOException {
|
public void unlockRow(byte[] regionName, long lockId) throws IOException {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
NullPointerException npe = null;
|
NullPointerException npe = null;
|
||||||
|
@ -2080,6 +2103,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
// Region open/close direct RPCs
|
// Region open/close direct RPCs
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public void openRegion(HRegionInfo region)
|
public void openRegion(HRegionInfo region)
|
||||||
throws RegionServerStoppedException {
|
throws RegionServerStoppedException {
|
||||||
LOG.info("Received request to open region: " +
|
LOG.info("Received request to open region: " +
|
||||||
|
@ -2095,6 +2119,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public void openRegions(List<HRegionInfo> regions)
|
public void openRegions(List<HRegionInfo> regions)
|
||||||
throws RegionServerStoppedException {
|
throws RegionServerStoppedException {
|
||||||
LOG.info("Received request to open " + regions.size() + " region(s)");
|
LOG.info("Received request to open " + regions.size() + " region(s)");
|
||||||
|
@ -2102,12 +2127,14 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public boolean closeRegion(HRegionInfo region)
|
public boolean closeRegion(HRegionInfo region)
|
||||||
throws NotServingRegionException {
|
throws NotServingRegionException {
|
||||||
return closeRegion(region, true);
|
return closeRegion(region, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public boolean closeRegion(HRegionInfo region, final boolean zk)
|
public boolean closeRegion(HRegionInfo region, final boolean zk)
|
||||||
throws NotServingRegionException {
|
throws NotServingRegionException {
|
||||||
LOG.info("Received close region: " + region.getRegionNameAsString());
|
LOG.info("Received close region: " + region.getRegionNameAsString());
|
||||||
|
@ -2148,6 +2175,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
// Manual remote region administration RPCs
|
// Manual remote region administration RPCs
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public void flushRegion(HRegionInfo regionInfo)
|
public void flushRegion(HRegionInfo regionInfo)
|
||||||
throws NotServingRegionException, IOException {
|
throws NotServingRegionException, IOException {
|
||||||
LOG.info("Flushing " + regionInfo.getRegionNameAsString());
|
LOG.info("Flushing " + regionInfo.getRegionNameAsString());
|
||||||
|
@ -2156,6 +2184,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public void splitRegion(HRegionInfo regionInfo)
|
public void splitRegion(HRegionInfo regionInfo)
|
||||||
throws NotServingRegionException, IOException {
|
throws NotServingRegionException, IOException {
|
||||||
splitRegion(regionInfo, null);
|
splitRegion(regionInfo, null);
|
||||||
|
@ -2175,6 +2204,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public void compactRegion(HRegionInfo regionInfo, boolean major)
|
public void compactRegion(HRegionInfo regionInfo, boolean major)
|
||||||
throws NotServingRegionException, IOException {
|
throws NotServingRegionException, IOException {
|
||||||
HRegion region = getRegion(regionInfo.getRegionName());
|
HRegion region = getRegion(regionInfo.getRegionName());
|
||||||
|
@ -2214,6 +2244,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public List<HRegionInfo> getOnlineRegions() {
|
public List<HRegionInfo> getOnlineRegions() {
|
||||||
List<HRegionInfo> list = new ArrayList<HRegionInfo>();
|
List<HRegionInfo> list = new ArrayList<HRegionInfo>();
|
||||||
synchronized(this.onlineRegions) {
|
synchronized(this.onlineRegions) {
|
||||||
|
@ -2414,6 +2445,8 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
return regionsToCheck;
|
return regionsToCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public long getProtocolVersion(final String protocol, final long clientVersion)
|
public long getProtocolVersion(final String protocol, final long clientVersion)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (protocol.equals(HRegionInterface.class.getName())) {
|
if (protocol.equals(HRegionInterface.class.getName())) {
|
||||||
|
@ -2549,6 +2582,8 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
@QosPriority(priority=HIGH_QOS)
|
||||||
public HServerInfo getHServerInfo() throws IOException {
|
public HServerInfo getHServerInfo() throws IOException {
|
||||||
return serverInfo;
|
return serverInfo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue