HBASE-2986 multi writable can npe causing client hang

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@997353 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-09-15 14:40:00 +00:00
parent 762e374861
commit 787d807b37
4 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -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 {

View File

@ -61,7 +61,7 @@ public class MultiResponse implements Writable {
/**
* 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 Writable {
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 Writable {
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);
}

View File

@ -961,7 +961,7 @@ public abstract class HBaseServer {
throw e;
}
} catch (Exception e) {
LOG.info(getName() + " caught: " +
LOG.warn(getName() + " caught: " +
StringUtils.stringifyException(e));
}
}