浏览代码

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@551039 13f79535-47bb-0310-9956-ffa450edef68

Michael Stack 18 年之前
父节点
当前提交
c813b9834b

+ 2 - 2
src/contrib/hbase/CHANGES.txt

@@ -38,5 +38,5 @@ Trunk (unreleased changes)
  23. HADOOP-1509.  Made methods/inner classes in HRegionServer and HClient protected
  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.
      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
      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

+ 2 - 2
src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMemcache.java

@@ -332,8 +332,8 @@ public class HMemcache {
      * @return true if this is the first row
      * @return true if this is the first row
      */
      */
     boolean findFirstRow(int i, Text firstRow) {
     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;
     }
     }
     
     
     /**
     /**

+ 1 - 1
src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionServer.java

@@ -446,7 +446,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
       if(fs.exists(logdir)) {
       if(fs.exists(logdir)) {
         throw new RegionServerRunningException("region server already running at " +
         throw new RegionServerRunningException("region server already running at " +
           this.serverInfo.getServerAddress().toString() + " because logdir " +
           this.serverInfo.getServerAddress().toString() + " because logdir " +
-          " exists");
+          logdir.toString() + " exists");
       }
       }
       
       
       this.log = new HLog(fs, logdir, conf);
       this.log = new HLog(fs, logdir, conf);