From a31d0e5f31faf73b9d1b29e0099cb53220d2a523 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 27 Jun 2007 04:50:10 +0000 Subject: [PATCH] HADOOP-1534. [hbase] Memcache scanner fails if start key not present * src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMemcache.java (findFirstRow): Change compare from startsWith -- looking for an 'exact' match -- to instead use compareTo and if >= 0, then we are at first key. * src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionServer.java Add logging of problematic directory if server won't start because log file exists. git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@551039 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 4 ++-- src/java/org/apache/hadoop/hbase/HMemcache.java | 4 ++-- src/java/org/apache/hadoop/hbase/HRegionServer.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8467de51758..35a444018d3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -38,5 +38,5 @@ Trunk (unreleased changes) 23. HADOOP-1509. Made methods/inner classes in HRegionServer and HClient protected instead of private for easier extension. Also made HRegion and HRegionInfo public too. Added an hbase-default.xml property for specifying what HRegionInterface extension to use - for proxy server connection. - + for proxy server connection. + 24. HADOOP-1534. [hbase] Memcache scanner fails if start key not present diff --git a/src/java/org/apache/hadoop/hbase/HMemcache.java b/src/java/org/apache/hadoop/hbase/HMemcache.java index 585e51306c8..03eb6320b5f 100644 --- a/src/java/org/apache/hadoop/hbase/HMemcache.java +++ b/src/java/org/apache/hadoop/hbase/HMemcache.java @@ -332,8 +332,8 @@ public class HMemcache { * @return true if this is the first row */ boolean findFirstRow(int i, Text firstRow) { - return ((firstRow.getLength() == 0) - || (keys[i].getRow().toString().startsWith(firstRow.toString()))); + return firstRow.getLength() == 0 || + keys[i].getRow().compareTo(firstRow) >= 0; } /** diff --git a/src/java/org/apache/hadoop/hbase/HRegionServer.java b/src/java/org/apache/hadoop/hbase/HRegionServer.java index d9245cf00ba..f1c79a0f45e 100644 --- a/src/java/org/apache/hadoop/hbase/HRegionServer.java +++ b/src/java/org/apache/hadoop/hbase/HRegionServer.java @@ -446,7 +446,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable { if(fs.exists(logdir)) { throw new RegionServerRunningException("region server already running at " + this.serverInfo.getServerAddress().toString() + " because logdir " + - " exists"); + logdir.toString() + " exists"); } this.log = new HLog(fs, logdir, conf);