Java Code Examples for org.apache.hadoop.hbase.client.Scan#getCacheBlocks()

The following examples show how to use org.apache.hadoop.hbase.client.Scan#getCacheBlocks() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StoreScanner.java    From hbase with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
StoreScanner(Scan scan, ScanInfo scanInfo, NavigableSet<byte[]> columns,
    List<? extends KeyValueScanner> scanners, ScanType scanType) throws IOException {
  // 0 is passed as readpoint because the test bypasses Store
  this(null, scan, scanInfo, columns != null ? columns.size() : 0, 0L, scan.getCacheBlocks(),
      scanType);
  if (scanType == ScanType.USER_SCAN) {
    this.matcher =
        UserScanQueryMatcher.create(scan, scanInfo, columns, oldestUnexpiredTS, now, null);
  } else {
    this.matcher = CompactionScanQueryMatcher.create(scanInfo, scanType, Long.MAX_VALUE,
      HConstants.OLDEST_TIMESTAMP, oldestUnexpiredTS, now, null, null, null);
  }
  seekAllScanner(scanInfo, scanners);
}
 
Example 2
Source File: StoreScanner.java    From hbase with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
StoreScanner(Scan scan, ScanInfo scanInfo, NavigableSet<byte[]> columns,
    List<? extends KeyValueScanner> scanners) throws IOException {
  // 0 is passed as readpoint because the test bypasses Store
  this(null, scan, scanInfo, columns != null ? columns.size() : 0, 0L, scan.getCacheBlocks(),
      ScanType.USER_SCAN);
  this.matcher =
      UserScanQueryMatcher.create(scan, scanInfo, columns, oldestUnexpiredTS, now, null);
  seekAllScanner(scanInfo, scanners);
}
 
Example 3
Source File: StoreScanner.java    From hbase with Apache License 2.0 4 votes vote down vote up
/**
 * Opens a scanner across memstore, snapshot, and all StoreFiles. Assumes we
 * are not in a compaction.
 *
 * @param store who we scan
 * @param scan the spec
 * @param columns which columns we are scanning
 * @throws IOException
 */
public StoreScanner(HStore store, ScanInfo scanInfo, Scan scan, NavigableSet<byte[]> columns,
    long readPt) throws IOException {
  this(store, scan, scanInfo, columns != null ? columns.size() : 0, readPt,
      scan.getCacheBlocks(), ScanType.USER_SCAN);
  if (columns != null && scan.isRaw()) {
    throw new DoNotRetryIOException("Cannot specify any column for a raw scan");
  }
  matcher = UserScanQueryMatcher.create(scan, scanInfo, columns, oldestUnexpiredTS, now,
    store.getCoprocessorHost());

  store.addChangedReaderObserver(this);

  List<KeyValueScanner> scanners = null;
  try {
    // Pass columns to try to filter out unnecessary StoreFiles.
    scanners = selectScannersFrom(store,
      store.getScanners(cacheBlocks, scanUsePread, false, matcher, scan.getStartRow(),
        scan.includeStartRow(), scan.getStopRow(), scan.includeStopRow(), this.readPt));

    // Seek all scanners to the start of the Row (or if the exact matching row
    // key does not exist, then to the start of the next matching Row).
    // Always check bloom filter to optimize the top row seek for delete
    // family marker.
    seekScanners(scanners, matcher.getStartKey(), explicitColumnQuery && lazySeekEnabledGlobally,
      parallelSeekEnabled);

    // set storeLimit
    this.storeLimit = scan.getMaxResultsPerColumnFamily();

    // set rowOffset
    this.storeOffset = scan.getRowOffsetPerColumnFamily();
    addCurrentScanners(scanners);
    // Combine all seeked scanners with a heap
    resetKVHeap(scanners, comparator);
  } catch (IOException e) {
    clearAndClose(scanners);
    // remove us from the HStore#changedReaderObservers here or we'll have no chance to
    // and might cause memory leak
    store.deleteChangedReaderObserver(this);
    throw e;
  }
}