You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nk...@apache.org on 2013/12/06 21:11:12 UTC
svn commit: r1548712 - in
/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase:
ipc/RpcCallContext.java ipc/RpcServer.java regionserver/HRegion.java
Author: nkeywal
Date: Fri Dec 6 20:11:12 2013
New Revision: 1548712
URL: http://svn.apache.org/r1548712
Log:
HBASE-10097 Remove a region name string creation in HRegion#nextInternal
Modified:
hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java
hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java?rev=1548712&r1=1548711&r2=1548712&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java (original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java Fri Dec 6 20:11:12 2013
@@ -20,11 +20,12 @@ package org.apache.hadoop.hbase.ipc;
public interface RpcCallContext extends Delayable {
/**
- * Throw an exception if the caller who made this IPC call has disconnected.
+ * Check if the caller who made this IPC call has disconnected.
* If called from outside the context of IPC, this does nothing.
- * @throws CallerDisconnectedException
+ * @return < 0 if the caller is still connected. The time in ms
+ * since the disconnection otherwise
*/
- void throwExceptionIfCallerDisconnected(String regionName) throws CallerDisconnectedException;
+ long disconnectSince();
/**
* If the client connected and specified a codec to use, then we will use this codec making
Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java?rev=1548712&r1=1548711&r2=1548712&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java (original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java Fri Dec 6 20:11:12 2013
@@ -461,14 +461,11 @@ public class RpcServer implements RpcSer
}
@Override
- public void throwExceptionIfCallerDisconnected(String regionName)
- throws CallerDisconnectedException {
+ public long disconnectSince() {
if (!connection.channel.isOpen()) {
- long afterTime = System.currentTimeMillis() - timestamp;
- throw new CallerDisconnectedException(
- "Aborting on region " + regionName + ", call " +
- this + " after " + afterTime + " ms, since " +
- "caller disconnected");
+ return System.currentTimeMillis() - timestamp;
+ } else {
+ return -1L;
}
}
Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1548712&r1=1548711&r2=1548712&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Fri Dec 6 20:11:12 2013
@@ -108,6 +108,7 @@ import org.apache.hadoop.hbase.io.HeapSi
import org.apache.hadoop.hbase.io.TimeRange;
import org.apache.hadoop.hbase.io.hfile.BlockCache;
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.ipc.CallerDisconnectedException;
import org.apache.hadoop.hbase.ipc.RpcCallContext;
import org.apache.hadoop.hbase.ipc.RpcServer;
import org.apache.hadoop.hbase.master.AssignmentManager;
@@ -3609,7 +3610,13 @@ public class HRegion implements HeapSize
// client might time out and disconnect while the server side
// is still processing the request. We should abort aggressively
// in that case.
- rpcCall.throwExceptionIfCallerDisconnected(getRegionNameAsString());
+ long afterTime = rpcCall.disconnectSince();
+ if (afterTime >= 0) {
+ throw new CallerDisconnectedException(
+ "Aborting on region " + getRegionNameAsString() + ", call " +
+ this + " after " + afterTime + " ms, since " +
+ "caller disconnected");
+ }
}
// Let's see what we have in the storeHeap.