From b7d932f4dc1d1cee73142376baaee212df9d6ae0 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Sat, 2 Feb 2008 00:51:38 +0000 Subject: [PATCH] HADOOP-2693 NPE in getClosestRowBefore git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk/src/contrib/hbase@617724 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + src/java/org/apache/hadoop/hbase/HStore.java | 20 ++++++-------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5ddb6a6b24d..1e60afff71f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,7 @@ Trunk (unreleased changes) BUG FIXES HADOOP-2731 Under load, regions become extremely large and eventually cause region servers to become unresponsive + HADOOP-2693 NPE in getClosestRowBefore (Bryan Duxbury & Stack) IMPROVEMENTS HADOOP-2555 Refactor the HTable#get and HTable#getRow methods to avoid diff --git a/src/java/org/apache/hadoop/hbase/HStore.java b/src/java/org/apache/hadoop/hbase/HStore.java index 330f9d7bc3f..ab5f7f1fe7f 100644 --- a/src/java/org/apache/hadoop/hbase/HStore.java +++ b/src/java/org/apache/hadoop/hbase/HStore.java @@ -1830,20 +1830,13 @@ public class HStore implements HConstants { for(int i = maparray.length - 1; i >= 0; i--) { Text row_from_mapfile = rowAtOrBeforeFromMapFile(maparray[i], row, timestamp); - - // for when we have MapFile.Reader#getClosest before functionality -/* Text row_from_mapfile = null; - WritableComparable value = null; - - HStoreKey hskResult = - (HStoreKey)maparray[i].getClosest(rowKey, value, true); - - if (hskResult != null) { - row_from_mapfile = hskResult.getRow(); - }*/ - -/* LOG.debug("Best from this mapfile was " + row_from_mapfile);*/ + // if the result from the mapfile is null, then we know that + // the mapfile was empty and can move on to the next one. + if (row_from_mapfile == null) { + continue; + } + // short circuit on an exact match if (row.equals(row_from_mapfile)) { return row; @@ -1855,7 +1848,6 @@ public class HStore implements HConstants { } } -/* LOG.debug("Went searching for " + row + ", found " + bestSoFar);*/ return bestSoFar; } finally { this.lock.readLock().unlock();