hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r997353 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java
Date Wed, 15 Sep 2010 14:40:01 GMT
Author: stack
Date: Wed Sep 15 14:40:00 2010
New Revision: 997353

URL: http://svn.apache.org/viewvc?rev=997353&view=rev
Log:
HBASE-2986 multi writable can npe causing client hang

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=997353&r1=997352&r2=997353&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed Sep 15 14:40:00 2010
@@ -520,6 +520,7 @@ Release 0.21.0 - Unreleased
    HBASE-2978  LoadBalancer IndexOutOfBoundsException
    HBASE-2983  TestHLog unit test is mis-comparing an assertion
                (Alex Newman via Todd Lipcon)
+   HBASE-2986  multi writable can npe causing client hang
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=997353&r1=997352&r2=997353&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Wed Sep
15 14:40:00 2010
@@ -1128,9 +1128,8 @@ public class HConnectionManager {
               for (Entry<byte[], List<Pair<Integer,Result>>> e : resp.getResults().entrySet())
{
                 byte[] regionName = e.getKey();
                 List<Pair<Integer, Result>> regionResults = e.getValue();
-                for (int i = 0; i < regionResults.size(); i++) {
-                  Pair<Integer, Result> regionResult = regionResults.get(i);
-                  if (regionResult.getSecond() == null) {
+                for (Pair<Integer, Result> regionResult : regionResults) {
+                  if (regionResult == null) {
                     // failed
                     LOG.debug("Failures for region: " + Bytes.toStringBinary(regionName)
+ ", removing from cache");
                   } else {

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java?rev=997353&r1=997352&r2=997353&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/MultiResponse.java Wed Sep 15
14:40:00 2010
@@ -61,7 +61,7 @@ public class MultiResponse implements Wr
 
   /**
    * Add the pair to the container, grouped by the regionName
-   * 
+   *
    * @param regionName
    * @param r
    *          First item in the pair is the original index of the Action
@@ -89,8 +89,12 @@ public class MultiResponse implements Wr
       List<Pair<Integer, Result>> lst = e.getValue();
       out.writeInt(lst.size());
       for (Pair<Integer, Result> r : lst) {
-        out.writeInt(r.getFirst());
-        HbaseObjectWritable.writeObject(out, r.getSecond(), Result.class, null);
+        if (r == null) {
+          out.writeInt(-1); // Cant have index -1; on other side we recognize -1 as 'null'
+        } else {
+          out.writeInt(r.getFirst()); // Can this can npe!?!
+          HbaseObjectWritable.writeObject(out, r.getSecond(), Result.class, null);
+        }
       }
     }
   }
@@ -106,8 +110,12 @@ public class MultiResponse implements Wr
           listSize);
       for (int j = 0; j < listSize; j++) {
         Integer idx = in.readInt();
-        Result r = (Result) HbaseObjectWritable.readObject(in, null);
-        lst.add(new Pair<Integer, Result>(idx, r));
+        if (idx == -1) {
+          lst.add(null); 
+        } else {
+          Result r = (Result) HbaseObjectWritable.readObject(in, null);
+          lst.add(new Pair<Integer, Result>(idx, r));
+        }
       }
       results.put(key, lst);
     }

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java?rev=997353&r1=997352&r2=997353&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java Wed Sep 15 14:40:00
2010
@@ -961,7 +961,7 @@ public abstract class HBaseServer {
             throw e;
           }
         } catch (Exception e) {
-          LOG.info(getName() + " caught: " +
+          LOG.warn(getName() + " caught: " +
                    StringUtils.stringifyException(e));
         }
       }



Mime
View raw message