You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2011/06/23 07:08:29 UTC

svn commit: r1138736 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java

Author: stack
Date: Thu Jun 23 05:08:29 2011
New Revision: 1138736

URL: http://svn.apache.org/viewvc?rev=1138736&view=rev
Log:
HBASE-4003 Cleanup Calls Conservatively On Timeout

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1138736&r1=1138735&r2=1138736&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Jun 23 05:08:29 2011
@@ -274,6 +274,7 @@ Release 0.91.0 - Unreleased
    HBASE-4010  HMaster.createTable could be heavily optimized
    HBASE-3506  Ability to disable, drop and enable tables using regex expression
                (Joey Echeverria via Ted Yu)
+   HBASE-4003  Cleanup Calls Conservatively On Timeout (Karthick Sankarachary)
 
   TASKS
    HBASE-3559  Move report of split to master OFF the heartbeat channel

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java?rev=1138736&r1=1138735&r2=1138736&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java Thu Jun 23 05:08:29 2011
@@ -167,9 +167,11 @@ public class HBaseClient {
     Writable value;                               // value, null if error
     IOException error;                            // exception, null if value
     boolean done;                                 // true when call is done
+    long startTime;
 
     protected Call(Writable param) {
       this.param = param;
+      this.startTime = System.currentTimeMillis();
       synchronized (HBaseClient.this) {
         this.id = counter++;
       }
@@ -201,6 +203,10 @@ public class HBaseClient {
       this.value = value;
       callComplete();
     }
+
+    public long getStartTime() {
+      return this.startTime;
+    }
   }
 
   /** Thread that reads responses and notifies callers.  Each connection owns a
@@ -574,7 +580,7 @@ public class HBaseClient {
           // since we expect certain responses to not make it by the specified
           // {@link ConnectionId#rpcTimeout}.
           closeException = ste;
-          cleanupCalls();
+          cleanupCalls(remoteId.rpcTimeout);
         } else {
           // Since the server did not respond within the default ping interval
           // time, treat this as a fatal condition and close this connection
@@ -635,15 +641,21 @@ public class HBaseClient {
 
     /* Cleanup all calls and mark them as done */
     private void cleanupCalls() {
+      cleanupCalls(0);
+    }
+
+    private synchronized void cleanupCalls(long rpcTimeout) {
       Iterator<Entry<Integer, Call>> itor = calls.entrySet().iterator() ;
       while (itor.hasNext()) {
         Call c = itor.next().getValue();
-        c.setException(closeException); // local exception
-        // Notify the open calls, so they are aware of what just happened
-        synchronized (c) {
-          c.notifyAll();
+        if (System.currentTimeMillis() - c.getStartTime() > rpcTimeout) {
+          c.setException(closeException); // local exception
+          // Notify the open calls, so they are aware of what just happened
+          synchronized (c) {
+            c.notifyAll();
+          }
+          itor.remove();
         }
-        itor.remove();
       }
     }
   }