Apache9 commented on a change in pull request #1774:
URL: https://github.com/apache/hbase/pull/1774#discussion_r432194015



##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
##########
@@ -2185,4 +2206,27 @@ private static Put addSequenceNum(Put p, long 
openSeqNum, int replicaId) throws
               .setValue(Bytes.toBytes(openSeqNum))
               .build());
   }
+
+  private static byte[] buildLocateRegionStartRow(TableName tableName, byte[] 
row,
+    RegionLocateType locateType) {
+    if (locateType.equals(RegionLocateType.BEFORE)) {
+      if (Bytes.equals(row, HConstants.EMPTY_END_ROW)) {
+        byte[] binaryTableName = tableName.getName();
+        return Arrays.copyOf(binaryTableName, binaryTableName.length + 1);
+      } else {
+        return createRegionName(tableName, row, ZEROES, false);
+      }
+    } else {
+      return createRegionName(tableName, row, NINES, false);
+    }
+  }
+
+  public static Scan createLocateRegionScan(TableName tableName, byte[] row,
+    RegionLocateType locateType, int prefetchLimit) {

Review comment:
       This is for abstraction, at this layer we do not care whether you are 
doing scan or what ever else, The only thing I care is how you want to locate a 
region through the given row, i.e, the direction.
   
   And we have this logic, at least for two years after we introduced async 
client. If you are talking about the code before async client, the locating 
logic is placed everywhere in code, which is not good.
   
   For supporting reverse scan, we have special logic to locate to the previous 
region in this class
   
   
https://github.com/apache/hbase/blob/branch-2/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ReversedScannerCallable.java
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to