This is an automated email from the ASF dual-hosted git repository. kadir pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push: new f57b5b4 PHOENIX-5720 Multiple scans on the same table region cause incorrect IndexTool counters f57b5b4 is described below commit f57b5b4732a421af61d99d30413ff81533dd1e8f Author: Kadir <kozde...@salesforce.com> AuthorDate: Fri Feb 7 11:40:50 2020 -0800 PHOENIX-5720 Multiple scans on the same table region cause incorrect IndexTool counters --- .../phoenix/coprocessor/IndexRebuildRegionScanner.java | 12 ++++++++---- .../java/org/apache/phoenix/mapreduce/index/IndexTool.java | 2 -- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java index 3619d01..83c479a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java @@ -440,13 +440,17 @@ public class IndexRebuildRegionScanner extends BaseRegionScanner { long scanMaxTs = scan.getTimeRange().getMax(); byte[] keyPrefix = Bytes.toBytes(Long.toString(scanMaxTs)); byte[] regionName = Bytes.toBytes(region.getRegionInfo().getRegionNameAsString()); - byte[] rowKey = new byte[keyPrefix.length + regionName.length]; - // The row key for the result table is the max timestamp of the scan + the table region name + // 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); Put put = new Put(rowKey); - put.addColumn(RESULT_TABLE_COLUMN_FAMILY, IndexTool.SCAN_STOP_ROW_KEY_BYTES, - scanMaxTs, scan.getStopRow()); put.addColumn(RESULT_TABLE_COLUMN_FAMILY, SCANNED_DATA_ROW_COUNT_BYTES, scanMaxTs, Bytes.toBytes(Long.toString(verificationResult.scannedDataRowCount))); put.addColumn(RESULT_TABLE_COLUMN_FAMILY, REBUILT_INDEX_ROW_COUNT_BYTES, diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java index 6dc71e2..c71c0ff 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java @@ -173,8 +173,6 @@ public class IndexTool extends Configured implements Tool { public final static byte[] INDEX_TABLE_TS_BYTES = Bytes.toBytes(INDEX_TABLE_TS); public static String ERROR_MESSAGE = "Error"; public final static byte[] ERROR_MESSAGE_BYTES = Bytes.toBytes(ERROR_MESSAGE); - public static String SCAN_STOP_ROW_KEY = "StopRowKey"; - public final static byte[] SCAN_STOP_ROW_KEY_BYTES = Bytes.toBytes(SCAN_STOP_ROW_KEY); public static String SCANNED_DATA_ROW_COUNT = "ScannedDataRowCount"; public final static byte[] SCANNED_DATA_ROW_COUNT_BYTES = Bytes.toBytes(SCANNED_DATA_ROW_COUNT); public static String REBUILT_INDEX_ROW_COUNT = "RebuiltIndexRowCount";