gjacoby126 commented on a change in pull request #737: PHOENIX-5773 Index tool 
output tables should support multiple simulta…
URL: https://github.com/apache/phoenix/pull/737#discussion_r395387700
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
 ##########
 @@ -257,16 +258,29 @@ private void logToIndexToolResultTable() throws 
IOException {
         long scanMaxTs = scan.getTimeRange().getMax();
         byte[] keyPrefix = Bytes.toBytes(Long.toString(scanMaxTs));
         byte[] regionName = 
Bytes.toBytes(region.getRegionInfo().getRegionNameAsString());
-        // The row key for the result table is the max timestamp of the scan + 
the table region name + scan start row
-        // + scan stop row
-        byte[] rowKey = new byte[keyPrefix.length + regionName.length + 
scan.getStartRow().length +
-                scan.getStopRow().length];
-        Bytes.putBytes(rowKey, 0, keyPrefix, 0, keyPrefix.length);
-        Bytes.putBytes(rowKey, keyPrefix.length, regionName, 0, 
regionName.length);
-        Bytes.putBytes(rowKey, keyPrefix.length + regionName.length, 
scan.getStartRow(), 0,
-                scan.getStartRow().length);
-        Bytes.putBytes(rowKey, keyPrefix.length + regionName.length + 
scan.getStartRow().length,
-                scan.getStopRow(), 0, scan.getStopRow().length);
+        int targetOffset = 0;
+        // The row key for the result table : timestamp | index table name | 
datable table region name |
+        //                                    scan start row | scan stop row
+        byte[] rowKey = new byte[keyPrefix.length + 
ROW_KEY_SEPARATOR_BYTE.length + indexHTable.getName().toBytes().length +
+                ROW_KEY_SEPARATOR_BYTE.length + regionName.length + 
ROW_KEY_SEPARATOR_BYTE.length +
+                scan.getStartRow().length + ROW_KEY_SEPARATOR_BYTE.length + 
scan.getStopRow().length];
+        Bytes.putBytes(rowKey, targetOffset, keyPrefix, 0, keyPrefix.length);
+        targetOffset += keyPrefix.length;
+        Bytes.putBytes(rowKey, targetOffset, ROW_KEY_SEPARATOR_BYTE, 0, 
ROW_KEY_SEPARATOR_BYTE.length);
+        targetOffset += ROW_KEY_SEPARATOR_BYTE.length;
+        Bytes.putBytes(rowKey, targetOffset, indexHTable.getName().toBytes(), 
0, indexHTable.getName().toBytes().length);
+        targetOffset += indexHTable.getName().toBytes().length;
+        Bytes.putBytes(rowKey, targetOffset, ROW_KEY_SEPARATOR_BYTE, 0, 
ROW_KEY_SEPARATOR_BYTE.length);
+        targetOffset += ROW_KEY_SEPARATOR_BYTE.length;
+        Bytes.putBytes(rowKey, targetOffset, regionName, 0, regionName.length);
+        targetOffset += regionName.length;
+        Bytes.putBytes(rowKey, targetOffset, ROW_KEY_SEPARATOR_BYTE, 0, 
ROW_KEY_SEPARATOR_BYTE.length);
+        targetOffset += ROW_KEY_SEPARATOR_BYTE.length;
+        Bytes.putBytes(rowKey, targetOffset, scan.getStartRow(), 0, 
scan.getStartRow().length);
+        targetOffset += scan.getStartRow().length;
 
 Review comment:
   Assume that a non-human has to parse this key into fields, and that this is 
not just for use manually in HBase shell. What happens if the Scan start row 
contains the bytes for "|"? 

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to