hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1594434 - in /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client: HTableClientScanner.java Scan.java
Date Wed, 14 May 2014 00:33:47 GMT
Author: liyin
Date: Wed May 14 00:33:47 2014
New Revision: 1594434

URL: http://svn.apache.org/r1594434
Log:
[master] Back compatibilty with old servers

Author: daviddeng

Summary:
In servers before Altair, if we make a scan with equal non empty start/stop rows, it returns
the row instead of returnning nothing. So we need to check on the client side.

This has been fixed in Bellatrix.

Test Plan: `TestHTableClientScanner`

Reviewers: manukranthk

Reviewed By: manukranthk

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D1325711

Task ID: 4324015

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableClientScanner.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/Scan.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableClientScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableClientScanner.java?rev=1594434&r1=1594433&r2=1594434&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableClientScanner.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableClientScanner.java
Wed May 14 00:33:47 2014
@@ -375,6 +375,15 @@ public class HTableClientScanner impleme
      */
     private Result[] scanRegionServer() throws IOException,
         InterruptedException {
+      // XXX The following checking is only for backward compatibility, remove
+      // this when all servers are after Bellatrix version.
+      if (!Bytes.rangeNotEmpty(startKey, scan.getStopRow())) {
+        // We go across stopRow, stop scanning
+        startKey = null;
+        this.numRegionsScanned.addAndGet(1);
+        return null;
+      }
+
       if (callable == null) {
         // Open a scanner
         callable = getScannerCallable(startKey);

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/Scan.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/Scan.java?rev=1594434&r1=1594433&r2=1594434&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/Scan.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/Scan.java Wed May
14 00:33:47 2014
@@ -139,7 +139,7 @@ public class Scan extends Operation impl
    * @param startRow row to start scanner at or after
    */
   public Scan(byte [] startRow) {
-    this.startRow = startRow;
+    this.startRow = Bytes.nonNull(startRow);
   }
 
   /**
@@ -148,8 +148,8 @@ public class Scan extends Operation impl
    * @param stopRow row to stop scanner before (exclusive)
    */
   public Scan(byte [] startRow, byte [] stopRow) {
-    this.startRow = startRow;
-    this.stopRow = stopRow;
+    this(startRow);
+    this.stopRow = Bytes.nonNull(stopRow);
   }
 
   /**
@@ -159,8 +159,7 @@ public class Scan extends Operation impl
    * @throws IOException When copying the values fails.
    */
   public Scan(Scan scan) throws IOException {
-    startRow = scan.getStartRow();
-    stopRow  = scan.getStopRow();
+    this(scan.getStartRow(), scan.getStopRow());
     maxVersions = scan.getMaxVersions();
     batch = scan.getBatch();
     storeLimit = scan.getMaxResultsPerColumnFamily();
@@ -222,8 +221,8 @@ public class Scan extends Operation impl
               @ThriftField(15) final int currentPartialResponseSize,
               @ThriftField(16) final TFilter tFilter,
               @ThriftField(17) final boolean preloadBlocks) throws IOException {
-    this.startRow = startRow;
-    this.stopRow = stopRow;
+    this.startRow = Bytes.nonNull(startRow);
+    this.stopRow = Bytes.nonNull(stopRow);
     this.maxVersions = maxVersions;
     this.batch = batch;
     this.storeLimit = storeLimit;
@@ -348,7 +347,7 @@ public class Scan extends Operation impl
    * @return this
    */
   public Scan setStartRow(byte [] startRow) {
-    this.startRow = startRow;
+    this.startRow = Bytes.nonNull(startRow);
     return this;
   }
 
@@ -358,7 +357,7 @@ public class Scan extends Operation impl
    * @return this
    */
   public Scan setStopRow(byte [] stopRow) {
-    this.stopRow = stopRow;
+    this.stopRow = Bytes.nonNull(stopRow);
     return this;
   }
 
@@ -574,7 +573,7 @@ public class Scan extends Operation impl
   }
 
   /**
-   * @return the startrow
+   * @return the startRow, never null.
    */
   @ThriftField(1)
   public byte [] getStartRow() {
@@ -582,7 +581,7 @@ public class Scan extends Operation impl
   }
 
   /**
-   * @return the stoprow
+   * @return the stopRow, never null.
    */
   @ThriftField(2)
   public byte [] getStopRow() {
@@ -1283,7 +1282,7 @@ public class Scan extends Operation impl
      * @return
      */
     public Builder setStopRow(byte[] stopRow) {
-      this.stopRow = stopRow;
+      this.stopRow = Bytes.nonNull(stopRow);
       return this;
     }
 



Mime
View raw message