You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2009/10/06 00:14:14 UTC

svn commit: r822050 - in /hadoop/hbase/branches/0.20: CHANGES.txt src/java/org/apache/hadoop/hbase/master/BaseScanner.java

Author: stack
Date: Mon Oct  5 22:14:13 2009
New Revision: 822050

URL: http://svn.apache.org/viewvc?rev=822050&view=rev
Log:
HBASE-1878 BaseScanner results can't be trusted at all (Related to hbase-1784)

Modified:
    hadoop/hbase/branches/0.20/CHANGES.txt
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java

Modified: hadoop/hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=822050&r1=822049&r2=822050&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20/CHANGES.txt Mon Oct  5 22:14:13 2009
@@ -42,6 +42,8 @@
                (Keith Thomas via Stack)
    HBASE-1883  HRegion passes the wrong minSequenceNumber to doReconstructionLog
                (Clint Morgan via Stack)
+   HBASE-1878  BaseScanner results can't be trusted at all (Related to
+               hbase-1784)
 
   IMPROVEMENTS
    HBASE-1819  Update to 0.20.1 hadoop and zk 3.2.1

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java?rev=822050&r1=822049&r2=822050&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java Mon Oct  5 22:14:13 2009
@@ -365,23 +365,25 @@
     String serverName = null;
     String sa = serverAddress;
     long sc = startCode;
-    if (sa == null || sa.length() <= 0) {
-      // Scans are sloppy.  They don't respect row locks and they get and 
-      // cache a row internally so may have data that is a little stale.  Make
-      // sure that for sure this serverAddress is null.  We are trying to
-      // avoid double-assignments.  See hbase-1784.  Will have to wait till
-      // 0.21 hbase where we use zk to mediate state transitions to do better.
-      Get g = new Get(info.getRegionName());
-      g.addFamily(HConstants.CATALOG_FAMILY);
-      Result r = regionServer.get(meta.getRegionName(), g);
-      if (r != null && !r.isEmpty()) {
-        sa = getServerAddress(r);
-        if (sa != null && sa.length() > 0) {
-          // Reget startcode in case its changed in the meantime too.
-          sc = getStartCode(r);
-          LOG.debug("GET got values when meta found none: serverAddress=" + sa
-              + ", startCode=" + sc);
-        }
+    // Scans are sloppy. They don't respect row locks and they get and
+    // cache a row internally so may have data that is stale. Make sure that for
+    // sure we have the right server and servercode. We are trying to avoid
+    // double-assignments. See hbase-1784. Will have to wait till 0.21 hbase
+    // where we use zk to mediate state transitions to do better.
+    Get g = new Get(info.getRegionName());
+    g.addFamily(HConstants.CATALOG_FAMILY);
+    Result r = regionServer.get(meta.getRegionName(), g);
+    if (r != null && !r.isEmpty()) {
+      sa = getServerAddress(r);
+      if (sa != null && sa.length() > 0 && !sa.equalsIgnoreCase(serverAddress)) {
+        LOG.debug("GET on " + info.getRegionNameAsString() + " got different " +
+          "address than SCAN: sa=" + sa + ", serverAddress=" + serverAddress);
+      }
+      // Reget startcode in case its changed in the meantime too.
+      sc = getStartCode(r);
+      if (sc != startCode) {
+        LOG.debug("GET on " + info.getRegionNameAsString() + " got different " +
+          "startcode than SCAN: sc=" + sc + ", serverAddress=" + startCode);
       }
     }
     if (sa != null && sa.length() > 0) {