This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x by this push:
     new 3ccf9a0  PHOENIX-5839 CompatUtil#setStopRow semantics problem
3ccf9a0 is described below

commit 3ccf9a02e4160ce6c497100f5bc47e6b19e10e32
Author: Istvan Toth <[email protected]>
AuthorDate: Thu Apr 16 16:02:14 2020 +0200

    PHOENIX-5839 CompatUtil#setStopRow semantics problem
    
    replace setStopRow with setSingleRow which has consistent semantics
---
 .../main/java/org/apache/phoenix/index/GlobalIndexChecker.java   | 6 ++----
 .../main/java/org/apache/phoenix/compat/hbase/CompatUtil.java    | 9 ++-------
 .../main/java/org/apache/phoenix/compat/hbase/CompatUtil.java    | 4 ++--
 .../main/java/org/apache/phoenix/compat/hbase/CompatUtil.java    | 4 ++--
 4 files changed, 8 insertions(+), 15 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java 
b/phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java
index 262b584..295446c 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java
@@ -333,8 +333,7 @@ public class GlobalIndexChecker extends BaseRegionObserver {
             // Rebuild the index row from the corresponding the row in the the 
data table
             // Get the data row key from the index row key
             byte[] dataRowKey = indexMaintainer.buildDataRowKey(new 
ImmutableBytesWritable(indexRowKey), viewConstants);
-            setStartRow(buildIndexScan, dataRowKey, true);
-            setStopRow(buildIndexScan, dataRowKey, true);
+            setSingleRow(buildIndexScan, dataRowKey);
             buildIndexScan.setTimeRange(0, maxTimestamp);
             // Pass the index row key to the partial index builder which will 
rebuild the index row and check if the
             // row key of this rebuilt index row matches with the passed index 
row key
@@ -426,8 +425,7 @@ public class GlobalIndexChecker extends BaseRegionObserver {
                 // Now we will do a single row scan to retrieve the verified 
index row built from the data table row.
                 // Note we cannot read all versions in one scan as the max 
number of row versions for an index table
                 // can be 1. In that case, we will get only one (i.e., the 
most recent) version instead of all versions
-                setStartRow(singleRowIndexScan, indexRowKey, true);
-                setStopRow(singleRowIndexScan, indexRowKey, true);
+                setSingleRow(singleRowIndexScan, indexRowKey);
                 singleRowIndexScan.setTimeRange(minTimestamp, ts);
                 RegionScanner singleRowScanner = 
region.getScanner(singleRowIndexScan);
                 row.clear();
diff --git 
a/phoenix-hbase-compat-1.3.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
 
b/phoenix-hbase-compat-1.3.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
index 4392455..f1b7595 100644
--- 
a/phoenix-hbase-compat-1.3.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
+++ 
b/phoenix-hbase-compat-1.3.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
@@ -17,7 +17,6 @@
  */
 package org.apache.phoenix.compat.hbase;
 
-import org.apache.commons.lang.NotImplementedException;
 import org.apache.hadoop.hbase.client.Scan;
 
 public class CompatUtil {
@@ -37,11 +36,7 @@ public class CompatUtil {
         }
     }
 
-    public static Scan setStopRow(Scan scan, byte[] indexRowKey, boolean 
inclusive) {
-        if (inclusive) {
-            return scan.setStopRow(indexRowKey);
-        } else {
-            throw new NotImplementedException();
-        }
+    public static Scan setSingleRow(Scan scan, byte[] indexRowKey) {
+        return scan.setStartRow(indexRowKey).setStopRow(indexRowKey);
     }
 }
diff --git 
a/phoenix-hbase-compat-1.4.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
 
b/phoenix-hbase-compat-1.4.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
index 046e04e..1ce3427 100644
--- 
a/phoenix-hbase-compat-1.4.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
+++ 
b/phoenix-hbase-compat-1.4.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
@@ -30,7 +30,7 @@ public abstract class CompatUtil {
         return scan.withStartRow(indexRowKey, inclusive);
     }
 
-    public static Scan setStopRow(Scan scan, byte[] indexRowKey, boolean 
inclusive) {
-        return scan.withStopRow(indexRowKey, inclusive);
+    public static Scan setSingleRow(Scan scan, byte[] indexRowKey) {
+        return scan.withStartRow(indexRowKey, true).withStopRow(indexRowKey, 
true);
     }
 }
diff --git 
a/phoenix-hbase-compat-1.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
 
b/phoenix-hbase-compat-1.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
index 046e04e..1ce3427 100644
--- 
a/phoenix-hbase-compat-1.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
+++ 
b/phoenix-hbase-compat-1.5.0/src/main/java/org/apache/phoenix/compat/hbase/CompatUtil.java
@@ -30,7 +30,7 @@ public abstract class CompatUtil {
         return scan.withStartRow(indexRowKey, inclusive);
     }
 
-    public static Scan setStopRow(Scan scan, byte[] indexRowKey, boolean 
inclusive) {
-        return scan.withStopRow(indexRowKey, inclusive);
+    public static Scan setSingleRow(Scan scan, byte[] indexRowKey) {
+        return scan.withStartRow(indexRowKey, true).withStopRow(indexRowKey, 
true);
     }
 }

Reply via email to