org.apache.hadoop.hbase.regionserver.HStore.getScanInfo()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.apache.hadoop.hbase.regionserver.HStore.getScanInfo()方法的一些代码示例,展示了HStore.getScanInfo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HStore.getScanInfo()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.regionserver.HStore
类名称:HStore
方法名:getScanInfo

HStore.getScanInfo介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

/**
 * Called before open store scanner for user scan.
 */
public ScanInfo preStoreScannerOpen(HStore store) throws IOException {
 if (coprocEnvironments.isEmpty()) return store.getScanInfo();
 CustomizedScanInfoBuilder builder = new CustomizedScanInfoBuilder(store.getScanInfo());
 execOperation(new RegionObserverOperationWithoutResult() {
  @Override
  public void call(RegionObserver observer) throws IOException {
   observer.preStoreScannerOpen(this, store, builder);
  }
 });
 return builder.build();
}

代码示例来源:origin: apache/hbase

/**
 * Called prior to opening store scanner for compaction.
 */
public ScanInfo preCompactScannerOpen(HStore store, ScanType scanType,
  CompactionLifeCycleTracker tracker, CompactionRequest request, User user) throws IOException {
 if (coprocEnvironments.isEmpty()) {
  return store.getScanInfo();
 }
 CustomizedScanInfoBuilder builder = new CustomizedScanInfoBuilder(store.getScanInfo());
 execOperation(new RegionObserverOperationWithoutResult(user) {
  @Override
  public void call(RegionObserver observer) throws IOException {
   observer.preCompactScannerOpen(this, store, scanType, builder, tracker, request);
  }
 });
 return builder.build();
}

代码示例来源:origin: apache/hbase

/**
 * Invoked before create StoreScanner for flush.
 */
public ScanInfo preFlushScannerOpen(HStore store, FlushLifeCycleTracker tracker)
  throws IOException {
 if (coprocEnvironments.isEmpty()) {
  return store.getScanInfo();
 }
 CustomizedScanInfoBuilder builder = new CustomizedScanInfoBuilder(store.getScanInfo());
 execOperation(new RegionObserverOperationWithoutResult() {
  @Override
  public void call(RegionObserver observer) throws IOException {
   observer.preFlushScannerOpen(this, store, builder, tracker);
  }
 });
 return builder.build();
}

代码示例来源:origin: apache/hbase

/**
 * Return a scanner for both the memstore and the HStore files. Assumes we are not in a
 * compaction.
 * @param scan Scan to apply when scanning the stores
 * @param targetCols columns to scan
 * @return a scanner over the current key values
 * @throws IOException on failure
 */
public KeyValueScanner getScanner(Scan scan, final NavigableSet<byte[]> targetCols, long readPt)
  throws IOException {
 lock.readLock().lock();
 try {
  ScanInfo scanInfo;
  if (this.getCoprocessorHost() != null) {
   scanInfo = this.getCoprocessorHost().preStoreScannerOpen(this);
  } else {
   scanInfo = getScanInfo();
  }
  return createScanner(scan, scanInfo, targetCols, readPt);
 } finally {
  lock.readLock().unlock();
 }
}

代码示例来源:origin: apache/hbase

private ScanInfo preCompactScannerOpen(CompactionRequestImpl request, ScanType scanType,
  User user) throws IOException {
 if (store.getCoprocessorHost() == null) {
  return store.getScanInfo();
 }
 return store.getCoprocessorHost().preCompactScannerOpen(store, scanType, request.getTracker(),
  request, user);
}

代码示例来源:origin: apache/hbase

/**
 * Invoked before create StoreScanner for in memory compaction.
 */
public ScanInfo preMemStoreCompactionCompactScannerOpen(HStore store) throws IOException {
 CustomizedScanInfoBuilder builder = new CustomizedScanInfoBuilder(store.getScanInfo());
 execOperation(coprocEnvironments.isEmpty() ? null : new RegionObserverOperationWithoutResult() {
  @Override
  public void call(RegionObserver observer) throws IOException {
   observer.preMemStoreCompactionCompactScannerOpen(this, store, builder);
  }
 });
 return builder.build();
}

代码示例来源:origin: apache/hbase

scanInfo = cpHost.preMemStoreCompactionCompactScannerOpen(store);
} else {
 scanInfo = store.getScanInfo();

代码示例来源:origin: apache/hbase

HStore store = mock(HStore.class);
when(store.getColumnFamilyDescriptor()).thenReturn(col);
when(store.getScanInfo()).thenReturn(si);
when(store.areWritesEnabled()).thenReturn(true);
when(store.getFileSystem()).thenReturn(mock(FileSystem.class));

代码示例来源:origin: apache/hbase

private int countDeleteMarkers(HRegion region) throws IOException {
 Scan s = new Scan();
 s.setRaw(true);
 // use max versions from the store(s)
 s.setMaxVersions(region.getStores().iterator().next().getScanInfo().getMaxVersions());
 InternalScanner scan = region.getScanner(s);
 List<Cell> kvs = new ArrayList<>();
 int res = 0;
 boolean hasMore;
 do {
  hasMore = scan.next(kvs);
  for (Cell kv : kvs) {
   if(CellUtil.isDelete(kv)) res++;
  }
  kvs.clear();
 } while (hasMore);
 scan.close();
 return res;
}

代码示例来源:origin: apache/hbase

when(store.getStorefiles()).thenReturn(storefiles);
when(store.getColumnFamilyDescriptor()).thenReturn(col);
when(store.getScanInfo()).thenReturn(si);
when(store.areWritesEnabled()).thenReturn(true);
when(store.getFileSystem()).thenReturn(mock(FileSystem.class));

代码示例来源:origin: apache/hbase

/**
 * Creates the scanner for flushing snapshot. Also calls coprocessors.
 * @param snapshotScanners
 * @param smallestReadPoint
 * @return The scanner; null if coprocessor is canceling the flush.
 */
protected final InternalScanner createScanner(List<KeyValueScanner> snapshotScanners,
  long smallestReadPoint, FlushLifeCycleTracker tracker) throws IOException {
 ScanInfo scanInfo;
 if (store.getCoprocessorHost() != null) {
  scanInfo = store.getCoprocessorHost().preFlushScannerOpen(store, tracker);
 } else {
  scanInfo = store.getScanInfo();
 }
 InternalScanner scanner = new StoreScanner(store, scanInfo, snapshotScanners,
   ScanType.COMPACT_RETAIN_DELETES, smallestReadPoint, HConstants.OLDEST_TIMESTAMP);
 assert scanner != null;
 if (store.getCoprocessorHost() != null) {
  try {
   return store.getCoprocessorHost().preFlush(store, scanner, tracker);
  } catch (IOException ioe) {
   scanner.close();
   throw ioe;
  }
 }
 return scanner;
}

代码示例来源:origin: apache/hbase

ScanInfo old = store.getScanInfo();
ScanInfo si = old.customize(old.getMaxVersions(), old.getTtl(), keepDeletedCells);
store.setScanInfo(si);

代码示例来源:origin: apache/hbase

ScanInfo old = store.getScanInfo();
ScanInfo si = old.customize(old.getMaxVersions(), ttl, old.getKeepDeletedCells());
store.setScanInfo(si);

代码示例来源:origin: apache/hbase

@Test
 public void testCompactionEmptyHFile() throws IOException {
  // Set TTL
  ScanInfo oldScanInfo = store.getScanInfo();
  ScanInfo newScanInfo = oldScanInfo.customize(oldScanInfo.getMaxVersions(), 600,
    oldScanInfo.getKeepDeletedCells());
  store.setScanInfo(newScanInfo);
  // Do not compact empty store file
  List<HStoreFile> candidates = sfCreate(0);
  for (HStoreFile file : candidates) {
   if (file instanceof MockHStoreFile) {
    MockHStoreFile mockFile = (MockHStoreFile) file;
    mockFile.setTimeRangeTracker(TimeRangeTracker.create(TimeRangeTracker.Type.SYNC, -1, -1));
    mockFile.setEntries(0);
   }
  }
  // Test Default compactions
  CompactionRequestImpl result = ((RatioBasedCompactionPolicy) store.storeEngine
    .getCompactionPolicy()).selectCompaction(candidates,
    new ArrayList<>(), false, false, false);
  Assert.assertTrue(result.getFiles().isEmpty());
  store.setScanInfo(oldScanInfo);
 }
}

代码示例来源:origin: apache/hbase

.newBuilder(family).setMinVersions(minVersions).setTimeToLive(ttl).build());
long storeTtl = this.store.getScanInfo().getTtl();
long sleepTime = storeTtl / storeFileNum;
long timeStamp;

代码示例来源:origin: apache/hbase

ScanInfo old = store.getScanInfo();
ScanInfo si = old.customize(old.getMaxVersions(), ttl, old.getKeepDeletedCells());
store.setScanInfo(si);

代码示例来源:origin: harbby/presto-connectors

@Override
public KeyValueScanner getScanner(Scan scan,
  final NavigableSet<byte []> targetCols, long readPt) throws IOException {
 lock.readLock().lock();
 try {
  KeyValueScanner scanner = null;
  if (this.getCoprocessorHost() != null) {
   scanner = this.getCoprocessorHost().preStoreScannerOpen(this, scan, targetCols);
  }
  if (scanner == null) {
   scanner = scan.isReversed() ? new ReversedStoreScanner(this,
     getScanInfo(), scan, targetCols, readPt) : new StoreScanner(this,
     getScanInfo(), scan, targetCols, readPt);
  }
  return scanner;
 } finally {
  lock.readLock().unlock();
 }
}

代码示例来源:origin: org.apache.hbase/hbase-server

HStore store = mock(HStore.class);
when(store.getColumnFamilyDescriptor()).thenReturn(col);
when(store.getScanInfo()).thenReturn(si);
when(store.areWritesEnabled()).thenReturn(true);
when(store.getFileSystem()).thenReturn(mock(FileSystem.class));

代码示例来源:origin: org.apache.hbase/hbase-server

private int countDeleteMarkers(HRegion region) throws IOException {
 Scan s = new Scan();
 s.setRaw(true);
 // use max versions from the store(s)
 s.setMaxVersions(region.getStores().iterator().next().getScanInfo().getMaxVersions());
 InternalScanner scan = region.getScanner(s);
 List<Cell> kvs = new ArrayList<>();
 int res = 0;
 boolean hasMore;
 do {
  hasMore = scan.next(kvs);
  for (Cell kv : kvs) {
   if(CellUtil.isDelete(kv)) res++;
  }
  kvs.clear();
 } while (hasMore);
 scan.close();
 return res;
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test
 public void testCompactionEmptyHFile() throws IOException {
  // Set TTL
  ScanInfo oldScanInfo = store.getScanInfo();
  ScanInfo newScanInfo = oldScanInfo.customize(oldScanInfo.getMaxVersions(), 600,
    oldScanInfo.getKeepDeletedCells());
  store.setScanInfo(newScanInfo);
  // Do not compact empty store file
  List<HStoreFile> candidates = sfCreate(0);
  for (HStoreFile file : candidates) {
   if (file instanceof MockHStoreFile) {
    MockHStoreFile mockFile = (MockHStoreFile) file;
    mockFile.setTimeRangeTracker(TimeRangeTracker.create(TimeRangeTracker.Type.SYNC, -1, -1));
    mockFile.setEntries(0);
   }
  }
  // Test Default compactions
  CompactionRequestImpl result = ((RatioBasedCompactionPolicy) store.storeEngine
    .getCompactionPolicy()).selectCompaction(candidates,
    new ArrayList<>(), false, false, false);
  Assert.assertTrue(result.getFiles().isEmpty());
  store.setScanInfo(oldScanInfo);
 }
}

相关文章

HStore类方法