Repository: phoenix Updated Branches: refs/heads/4.14-HBase-0.98 193839828 -> cd7e12102
Revert "PHOENIX-4839 IndexHalfStoreFileReaderGenerator throws NullPointerException (Aman Poonia)" This reverts commit 9e7ea88a40a966fc4ce3d19a02ed63116150f870. Patch not applicable to HBase-0.98 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fce9bcfb Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fce9bcfb Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fce9bcfb Branch: refs/heads/4.14-HBase-0.98 Commit: fce9bcfb99d91c36f4c8c315cf5d9fe30e402341 Parents: 1938398 Author: Vincent Poon <vincentp...@apache.org> Authored: Tue Oct 23 11:08:04 2018 -0700 Committer: Vincent Poon <vincentp...@apache.org> Committed: Tue Oct 23 18:38:28 2018 -0700 ---------------------------------------------------------------------- .../regionserver/IndexHalfStoreFileReader.java | 48 ++++---------------- .../IndexHalfStoreFileReaderGenerator.java | 12 +++-- 2 files changed, 17 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/fce9bcfb/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java index 273a1b0..8bd0d72 100644 --- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java +++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReader.java @@ -17,8 +17,6 @@ */ package org.apache.hadoop.hbase.regionserver; -import static org.apache.phoenix.coprocessor.BaseScannerRegionObserver.SCAN_START_ROW_SUFFIX; - import java.io.IOException; import java.util.Map; @@ -28,12 +26,10 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.KeyValue; -import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.io.Reference; import org.apache.hadoop.hbase.io.hfile.CacheConfig; -import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.index.IndexMaintainer; /** @@ -60,9 +56,8 @@ public class IndexHalfStoreFileReader extends StoreFile.Reader { private final Map<ImmutableBytesWritable, IndexMaintainer> indexMaintainers; private final byte[][] viewConstants; private final int offset; - private final HRegionInfo childRegionInfo; + private final HRegionInfo regionInfo; private final byte[] regionStartKeyInHFile; - private final HRegionInfo currentRegion; /** * @param fs @@ -74,19 +69,17 @@ public class IndexHalfStoreFileReader extends StoreFile.Reader { * @param conf * @param indexMaintainers * @param viewConstants - * @param childRegionInfo + * @param regionInfo * @param regionStartKeyInHFile * @param splitKey - * @param currentRegion * @throws IOException */ public IndexHalfStoreFileReader(final FileSystem fs, final Path p, final CacheConfig cacheConf, final FSDataInputStreamWrapper in, long size, final Reference r, final Configuration conf, final Map<ImmutableBytesWritable, IndexMaintainer> indexMaintainers, - final byte[][] viewConstants, final HRegionInfo childRegionInfo, - byte[] regionStartKeyInHFile, byte[] splitKey, HRegionInfo currentRegion) - throws IOException { + final byte[][] viewConstants, final HRegionInfo regionInfo, + byte[] regionStartKeyInHFile, byte[] splitKey) throws IOException { super(fs, p, in, size, cacheConf, conf); this.splitkey = splitKey == null ? r.getSplitKey() : splitKey; // Is it top or bottom half? @@ -94,10 +87,9 @@ public class IndexHalfStoreFileReader extends StoreFile.Reader { this.splitRow = CellUtil.cloneRow(KeyValue.createKeyValueFromKey(splitkey)); this.indexMaintainers = indexMaintainers; this.viewConstants = viewConstants; - this.childRegionInfo = childRegionInfo; + this.regionInfo = regionInfo; this.regionStartKeyInHFile = regionStartKeyInHFile; this.offset = regionStartKeyInHFile.length; - this.currentRegion = currentRegion; } public int getOffset() { @@ -113,7 +105,7 @@ public class IndexHalfStoreFileReader extends StoreFile.Reader { } public HRegionInfo getRegionInfo() { - return childRegionInfo; + return regionInfo; } public byte[] getRegionStartKeyInHFile() { @@ -133,30 +125,8 @@ public class IndexHalfStoreFileReader extends StoreFile.Reader { } @Override - public StoreFileScanner getStoreFileScanner(boolean cacheBlocks, boolean pread, - boolean isCompaction, long readPt) { - return new LocalIndexStoreFileScanner(this, getScanner(cacheBlocks, pread, isCompaction), - true, getHFileReader().hasMVCCInfo(), readPt); - } - - @Override - public boolean passesKeyRangeFilter(Scan scan) { - if (scan.getAttribute(SCAN_START_ROW_SUFFIX) == null) { - // Scan from compaction. - return true; - } - byte[] startKey = currentRegion.getStartKey(); - byte[] endKey = currentRegion.getEndKey(); - // If the region start key is not the prefix of the scan start row then we can return empty - // scanners. This is possible during merge where one of the child region scan should not return any - // results as we go through merged region. - int prefixLength = - scan.getStartRow().length - scan.getAttribute(SCAN_START_ROW_SUFFIX).length; - if (Bytes.compareTo(scan.getStartRow(), 0, prefixLength, - (startKey.length == 0 ? new byte[endKey.length] : startKey), 0, - (startKey.length == 0 ? endKey.length : startKey.length)) != 0) { - return false; - } - return true; + public StoreFileScanner getStoreFileScanner(boolean cacheBlocks, boolean pread, boolean isCompaction, long readPt) { + return new LocalIndexStoreFileScanner(this, getScanner(cacheBlocks, pread, isCompaction), true, + getHFileReader().hasMVCCInfo(), readPt); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/fce9bcfb/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java index 4d08a98..18d7228 100644 --- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java +++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java @@ -162,11 +162,11 @@ public class IndexHalfStoreFileReaderGenerator extends BaseRegionObserver { indexMaintainer); } } - if (indexMaintainers.isEmpty()) return reader; + if(indexMaintainers.isEmpty()) return reader; byte[][] viewConstants = getViewConstants(dataTable); - return new IndexHalfStoreFileReader(fs, p, cacheConf, in, size, r, - ctx.getEnvironment().getConfiguration(), indexMaintainers, viewConstants, - childRegion, regionStartKeyInHFile, splitKey, region.getRegionInfo()); + return new IndexHalfStoreFileReader(fs, p, cacheConf, in, size, r, ctx + .getEnvironment().getConfiguration(), indexMaintainers, viewConstants, + childRegion, regionStartKeyInHFile, splitKey); } catch (ClassNotFoundException e) { throw new IOException(e); } catch (SQLException e) { @@ -247,6 +247,10 @@ public class IndexHalfStoreFileReaderGenerator extends BaseRegionObserver { /** * @param env * @param store Local Index store + * @param scan + * @param scanType + * @param earliestPutTs + * @param request * @return StoreScanner for new Local Index data for a passed store and Null if repair is not possible * @throws IOException */