You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ji...@apache.org on 2007/06/11 22:52:29 UTC
svn commit: r546275 - in /lucene/hadoop/trunk/src/contrib/hbase: CHANGES.txt
src/java/org/apache/hadoop/hbase/HStore.java
Author: jimk
Date: Mon Jun 11 13:52:29 2007
New Revision: 546275
URL: http://svn.apache.org/viewvc?view=rev&rev=546275
Log:
HADOOP-1479 Fix NPE in HStore#get if store file only has keys < passed key.
Modified:
lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java
Modified: lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt?view=diff&rev=546275&r1=546274&r2=546275
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt Mon Jun 11 13:52:29 2007
@@ -28,3 +28,4 @@
15. HADOOP-1421 Failover detection, split log files.
For the files modified, also clean up javadoc, class, field and method
visibility (HADOOP-1466)
+ 16. HADOOP-1479 Fix NPE in HStore#get if store file only has keys < passed key.
Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java?view=diff&rev=546275&r1=546274&r2=546275
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HStore.java Mon Jun 11 13:52:29 2007
@@ -835,7 +835,7 @@
* If 'numVersions' is negative, the method returns all available versions.
*/
BytesWritable[] get(HStoreKey key, int numVersions) throws IOException {
- if(numVersions <= 0) {
+ if (numVersions <= 0) {
throw new IllegalArgumentException("Number of versions must be > 0");
}
@@ -852,15 +852,19 @@
BytesWritable readval = new BytesWritable();
map.reset();
HStoreKey readkey = (HStoreKey)map.getClosest(key, readval);
-
- if(readkey.matchesRowCol(key)) {
+ if (readkey == null) {
+ // map.getClosest returns null if the passed key is > than the
+ // last key in the map file. getClosest is a bit of a misnomer
+ // since it returns exact match or the next closest key AFTER not
+ // BEFORE.
+ continue;
+ }
+ if (readkey.matchesRowCol(key)) {
results.add(readval);
readval = new BytesWritable();
-
while(map.next(readkey, readval) && readkey.matchesRowCol(key)) {
- if(numVersions > 0 && (results.size() >= numVersions)) {
+ if (numVersions > 0 && (results.size() >= numVersions)) {
break;
-
}
results.add(readval);
readval = new BytesWritable();