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

x33g5p2x  于2022-01-30 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(190)

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

Store.requestCompaction介绍

暂无

代码示例

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

public CompactionRequest requestCompaction() throws IOException {
 return requestCompaction(NO_PRIORITY, null);
}

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

/**
 * This is a helper function that compact all the stores synchronously
 * It is used by utilities and testing
 *
 * @throws IOException e
 */
public void compactStores() throws IOException {
 for (Store s : getStores()) {
  CompactionContext compaction = s.requestCompaction();
  if (compaction != null) {
   compact(compaction, s, NoLimitCompactionThroughputController.INSTANCE, null);
  }
 }
}

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

/**
 * This is a helper function that compact all the stores synchronously
 * It is used by utilities and testing
 *
 * @throws IOException e
 */
public void compactStores() throws IOException {
 for(Store s : getStores().values()) {
  CompactionRequest cr = s.requestCompaction();
  if(cr != null) {
   try {
    compact(cr);
   } finally {
    s.finishRequest(cr);
   }
  }
 }
}

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

/**
 * This is a helper function that compact the given store
 * It is used by utilities and testing
 *
 * @throws IOException e
 */
@VisibleForTesting
void compactStore(byte[] family, CompactionThroughputController throughputController)
  throws IOException {
 Store s = getStore(family);
 CompactionContext compaction = s.requestCompaction();
 if (compaction != null) {
  compact(compaction, s, throughputController, null);
 }
}

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

@Override
public synchronized CompactionRequest requestCompaction(final HRegion r, final Store s,
  final String why, int priority, CompactionRequest request) throws IOException {
 if (this.server.isStopped()) {
  return null;
 }
 CompactionRequest cr = s.requestCompaction(priority, request);
 if (cr != null) {
  cr.setServer(server);
  if (priority != Store.NO_PRIORITY) {
   cr.setPriority(priority);
  }
  ThreadPoolExecutor pool = s.throttleCompaction(cr.getSize())
    ? largeCompactions : smallCompactions;
  pool.execute(cr);
  if (LOG.isDebugEnabled()) {
   String type = (pool == smallCompactions) ? "Small " : "Large ";
   LOG.debug(type + "Compaction requested: " + cr
     + (why != null && !why.isEmpty() ? "; Because: " + why : "")
     + "; " + this);
  }
 } else {
  if(LOG.isDebugEnabled()) {
   LOG.debug("Not compacting " + r.getRegionNameAsString() + 
     " because compaction request was cancelled");
  }
 }
 return cr;
}

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

/**
 * Execute the actual compaction job.
 * If the compact once flag is not specified, execute the compaction until
 * no more compactions are needed. Uses the Configuration settings provided.
 */
private void compactStoreFiles(final HRegion region, final Path familyDir,
  final boolean compactOnce) throws IOException {
 LOG.info("Compact table=" + region.getTableDesc().getNameAsString() +
  " region=" + region.getRegionNameAsString() +
  " family=" + familyDir.getName());
 Store store = getStore(region, familyDir);
 do {
  CompactionRequest cr = store.requestCompaction();
  StoreFile storeFile = store.compact(cr);
  if (storeFile != null) {
   if (keepCompactedFiles && deleteCompacted) {
    fs.delete(storeFile.getPath(), false);
   }
  }
 } while (store.needsCompaction() && !compactOnce);
}

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

@Override
public void compact(final boolean majorCompaction) throws IOException {
 if (majorCompaction) {
  triggerMajorCompaction();
 }
 for (Store s : getStores()) {
  CompactionContext compaction = s.requestCompaction();
  if (compaction != null) {
   CompactionThroughputController controller = null;
   if (rsServices != null) {
    controller = CompactionThroughputControllerFactory.create(rsServices, conf);
   }
   if (controller == null) {
    controller = NoLimitCompactionThroughputController.INSTANCE;
   }
   compact(compaction, s, controller, null);
  }
 }
}

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

private CompactionContext selectCompaction(final Region r, final Store s,
  int priority, CompactionRequest request, User user) throws IOException {
 CompactionContext compaction = s.requestCompaction(priority, request, user);
 if (compaction == null) {
  if(LOG.isDebugEnabled() && r.getRegionInfo() != null) {
   LOG.debug("Not compacting " + r.getRegionInfo().getRegionNameAsString() +
     " because compaction request was cancelled");
  }
  return null;
 }
 assert compaction.hasSelection();
 if (priority != Store.NO_PRIORITY) {
  compaction.getRequest().setPriority(priority);
 }
 return compaction;
}

相关文章