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_r395319574
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
 ##########
 @@ -412,30 +426,31 @@ public void logToIndexToolOutputTable(byte[] dataRowKey, 
byte[] indexRowKey, lon
         long scanMaxTs = scan.getTimeRange().getMax();
         byte[] keyPrefix = Bytes.toBytes(Long.toString(scanMaxTs));
         byte[] rowKey;
-        // The row key for the output table is the max timestamp of the scan + 
data row key
-        if (dataRowKey != null) {
-            rowKey = new byte[keyPrefix.length + dataRowKey.length];
-            Bytes.putBytes(rowKey, 0, keyPrefix, 0, keyPrefix.length);
-            Bytes.putBytes(rowKey, keyPrefix.length, dataRowKey, 0, 
dataRowKey.length);
-        } else {
-            rowKey = new byte[keyPrefix.length];
-            Bytes.putBytes(rowKey, 0, keyPrefix, 0, keyPrefix.length);
-        }
+        int targetOffset = 0;
+        // The row key for the output table : timestamp | index table name | 
data row key
+        rowKey = new byte[keyPrefix.length + ROW_KEY_SEPARATOR_BYTE.length + 
indexHTable.getName().toBytes().length +
+                ROW_KEY_SEPARATOR_BYTE.length + dataRowKey.length];
+        Bytes.putBytes(rowKey, targetOffset, keyPrefix, 0, keyPrefix.length);
+        targetOffset += keyPrefix.length;
 
 Review comment:
   likewise, extracting to a method to build the output table row key would be 
good. 

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