You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by li...@apache.org on 2013/01/13 20:21:41 UTC

svn commit: r1432709 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java

Author: liyin
Date: Sun Jan 13 19:21:41 2013
New Revision: 1432709

URL: http://svn.apache.org/viewvc?rev=1432709&view=rev
Log:
[0.89-fb] [ HBASE-7517] Do not throw PreemptiveFastFailExceptions when caused by another PFFE

Author: aaiyer

Summary:
Sometimes, if we are looking up a region in META, and both META  and
ROOT are unavailable, then the PFFE thrown by root's unavailability seems
to gets caught in the same function and is processed twice. We should avoid
this to prevent the race condition that liyin mentioned.

Test Plan: unit tests

Reviewers: liyintang

Reviewed By: liyintang

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D672911

Task ID: 1966872

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1432709&r1=1432708&r2=1432709&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Sun Jan 13 19:21:41 2013
@@ -1046,13 +1046,16 @@ public class HConnectionManager {
           // exist. rethrow the error immediately. this should always be coming
           // from the HTable constructor.
           throw e;
+        } catch (PreemptiveFastFailException e) {
+          // already processed this. Don't process this again.
+          throw e;
         } catch (IOException e) {
           if (e instanceof RemoteException) {
             e = RemoteExceptionHandler.decodeRemoteException(
                 (RemoteException) e);
           } else if (isNetworkException(e)) {
             couldNotCommunicateWithServer = true;
-            handleFailureToServer(server);
+            handleFailureToServer(server, e);
           }
           if (tries < numRetries - 1) {
             if (LOG.isDebugEnabled()) {
@@ -1584,7 +1587,7 @@ public class HConnectionManager {
         // non-IOException.
         if (isLocalException && isNetworkException(t2)) {
           couldNotCommunicateWithServer = true;
-          handleFailureToServer(server);
+          handleFailureToServer(server, t2);
         }
 
         if (t2 instanceof IOException) {
@@ -1606,11 +1609,12 @@ public class HConnectionManager {
      * Fast fail mode.
      *
      * @param server
+     * @param t - the throwable to be handled.
      * @throws PreemptiveFastFailException
      */
-    private void handleFailureToServer(HServerAddress server)
+    private void handleFailureToServer(HServerAddress server, Throwable t)
         throws PreemptiveFastFailException {
-      if (server == null) return;
+      if (server == null || t == null) return;
 
       long currentTime = System.currentTimeMillis();
       FailureInfo fInfo = repeatedFailuresMap.get(server);
@@ -1631,6 +1635,9 @@ public class HConnectionManager {
             fInfo.timeOfLatestCacheClearMilliSec = currentTime;
             clearCachedLocationForServer(server.toString());
           }
+
+          LOG.error("Preemptive fast fail exception caused by : " +  t.toString());
+
           throw  new PreemptiveFastFailException(fInfo.numConsecutiveFailures.get(),
             fInfo.timeOfFirstFailureMilliSec, fInfo.timeOfLatestAttemptMilliSec);
       }