You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by en...@apache.org on 2016/06/08 22:17:20 UTC
[3/4] phoenix git commit: PHOENIX-2892 Scan for pre-warming the block
cache for 2ndary index should be removed
PHOENIX-2892 Scan for pre-warming the block cache for 2ndary index should be removed
Conflicts:
phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b1e11181
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b1e11181
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b1e11181
Branch: refs/heads/4.x-HBase-1.0
Commit: b1e111812b1c23da9f44d46ce32197c3b8559e0d
Parents: b538c1a
Author: Enis Soztutar <en...@apache.org>
Authored: Wed Jun 8 13:24:09 2016 -0700
Committer: Enis Soztutar <en...@apache.org>
Committed: Wed Jun 8 14:50:17 2016 -0700
----------------------------------------------------------------------
.../phoenix/index/PhoenixIndexBuilder.java | 66 +-------------------
1 file changed, 1 insertion(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/b1e11181/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
index aa3ea51..affa778 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
@@ -18,30 +18,13 @@
package org.apache.phoenix.index;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
-import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
-import org.apache.hadoop.hbase.regionserver.RegionScanner;
-import org.apache.phoenix.compile.ScanRanges;
-import org.apache.phoenix.filter.SkipScanFilter;
import org.apache.phoenix.hbase.index.covered.IndexMetaData;
import org.apache.phoenix.hbase.index.covered.NonTxIndexBuilder;
-import org.apache.phoenix.hbase.index.util.IndexManagementUtil;
import org.apache.phoenix.hbase.index.write.IndexWriter;
-import org.apache.phoenix.query.KeyRange;
-import org.apache.phoenix.schema.types.PVarbinary;
-
-import com.google.common.collect.Lists;
/**
* Index builder for covered-columns index that ties into phoenix for faster use.
@@ -69,52 +52,5 @@ public class PhoenixIndexBuilder extends NonTxIndexBuilder {
@Override
public void batchStarted(MiniBatchOperationInProgress<Mutation> miniBatchOp, IndexMetaData context) throws IOException {
- // The entire purpose of this method impl is to get the existing rows for the
- // table rows being indexed into the block cache, as the index maintenance code
- // does a point scan per row.
- List<IndexMaintainer> indexMaintainers = ((PhoenixIndexMetaData)context).getIndexMaintainers();
- List<KeyRange> keys = Lists.newArrayListWithExpectedSize(miniBatchOp.size());
- Map<ImmutableBytesWritable, IndexMaintainer> maintainers =
- new HashMap<ImmutableBytesWritable, IndexMaintainer>();
- ImmutableBytesWritable indexTableName = new ImmutableBytesWritable();
- for (int i = 0; i < miniBatchOp.size(); i++) {
- Mutation m = miniBatchOp.getOperation(i);
- keys.add(PVarbinary.INSTANCE.getKeyRange(m.getRow()));
-
- for(IndexMaintainer indexMaintainer: indexMaintainers) {
- if (indexMaintainer.isImmutableRows()) continue;
- indexTableName.set(indexMaintainer.getIndexTableName());
- if (maintainers.get(indexTableName) != null) continue;
- maintainers.put(indexTableName, indexMaintainer);
- }
-
- }
- if (maintainers.isEmpty()) return;
- Scan scan = IndexManagementUtil.newLocalStateScan(new ArrayList<IndexMaintainer>(maintainers.values()));
- ScanRanges scanRanges = ScanRanges.createPointLookup(keys);
- scanRanges.initializeScan(scan);
- scan.setFilter(new SkipScanFilter(scanRanges.getSkipScanFilter(),true));
- HRegion region = env.getRegion();
- RegionScanner scanner = region.getScanner(scan);
- // Run through the scanner using internal nextRaw method
- region.startRegionOperation();
- try {
- synchronized (scanner) {
- boolean hasMore;
- do {
- List<Cell> results = Lists.newArrayList();
- // Results are potentially returned even when the return value of s.next is
- // false since this is an indication of whether or not there are more values
- // after the ones returned
- hasMore = scanner.nextRaw(results);
- } while (hasMore);
- }
- } finally {
- try {
- scanner.close();
- } finally {
- region.closeRegionOperation();
- }
- }
}
-}
\ No newline at end of file
+}