org.apache.hadoop.hbase.coprocessor.example.ZooKeeperScanPolicyObserver类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(90)

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

ZooKeeperScanPolicyObserver介绍

[英]This is an example showing how a RegionObserver could configured via ZooKeeper in order to control a Region compaction, flush, and scan policy. This also demonstrated the use of shared org.apache.hadoop.hbase.coprocessor.RegionObserver state. See RegionCoprocessorEnvironment#getSharedData().

This would be useful for an incremental backup tool, which would indicate the last time of a successful backup via ZK and instruct HBase that to safely delete the data which has already been backup.
[中]这是一个显示如何通过ZooKeeper配置RegionObserver以控制区域压缩、刷新和扫描策略的示例。这也展示了共享组织的使用。阿帕奇。hadoop。hbase。协处理器。RegionObserver状态。请参阅RegionProcessorEnvironment#getSharedData()。
这对于增量备份工具非常有用,该工具将通过ZK指示上次成功备份的时间,并指示HBase安全删除已备份的数据。

代码示例

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

private void resetTTL(ScanOptions options) {
 OptionalLong expireBefore = getExpireBefore();
 if (!expireBefore.isPresent()) {
  return;
 }
 options.setTTL(EnvironmentEdgeManager.currentTime() - expireBefore.getAsLong());
}

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

@Override
public void preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store,
  ScanOptions options, FlushLifeCycleTracker tracker) throws IOException {
 resetTTL(options);
}

代码示例来源:origin: co.cask.hbase/hbase

@Override
 public KeyValueScanner preStoreScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
   final Store store, final Scan scan, final NavigableSet<byte[]> targetCols,
   final KeyValueScanner s) throws IOException {
  Store.ScanInfo scanInfo = getScanInfo(store, c.getEnvironment());
  if (scanInfo == null) {
   // take default action
   return null;
  }
  return new StoreScanner(store, scanInfo, scan, targetCols);
 }
}

代码示例来源:origin: co.cask.hbase/hbase

@Override
public InternalScanner preFlushScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
  Store store, KeyValueScanner memstoreScanner, InternalScanner s) throws IOException {
 Store.ScanInfo scanInfo = getScanInfo(store, c.getEnvironment());
 if (scanInfo == null) {
  // take default action
  return null;
 }
 Scan scan = new Scan();
 scan.setMaxVersions(scanInfo.getMaxVersions());
 return new StoreScanner(store, scanInfo, scan, Collections.singletonList(memstoreScanner),
   ScanType.MINOR_COMPACT, store.getHRegion().getSmallestReadPoint(),
   HConstants.OLDEST_TIMESTAMP);
}

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

@Override
 public void preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store,
   ScanType scanType, ScanOptions options, CompactionLifeCycleTracker tracker,
   CompactionRequest request) throws IOException {
  resetTTL(options);
 }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-examples

private void resetTTL(ScanOptions options) {
 OptionalLong expireBefore = getExpireBefore();
 if (!expireBefore.isPresent()) {
  return;
 }
 options.setTTL(EnvironmentEdgeManager.currentTime() - expireBefore.getAsLong());
}

代码示例来源:origin: co.cask.hbase/hbase

@Override
public InternalScanner preCompactScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
  Store store, List<? extends KeyValueScanner> scanners, ScanType scanType, long earliestPutTs,
  InternalScanner s) throws IOException {
 Store.ScanInfo scanInfo = getScanInfo(store, c.getEnvironment());
 if (scanInfo == null) {
  // take default action
  return null;
 }
 Scan scan = new Scan();
 scan.setMaxVersions(scanInfo.getMaxVersions());
 return new StoreScanner(store, scanInfo, scan, scanners, scanType, store.getHRegion()
   .getSmallestReadPoint(), earliestPutTs);
}

代码示例来源:origin: com.aliyun.hbase/alihbase-examples

@Override
public void preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store,
  ScanOptions options, FlushLifeCycleTracker tracker) throws IOException {
 resetTTL(options);
}

代码示例来源:origin: com.aliyun.hbase/alihbase-examples

@Override
 public void preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store,
   ScanType scanType, ScanOptions options, CompactionLifeCycleTracker tracker,
   CompactionRequest request) throws IOException {
  resetTTL(options);
 }
}

相关文章