Java 类org.apache.hadoop.hbase.protobuf.generated.AdminProtos.FlushRegionRequest 实例源码

项目:DominoHBase    文件:HRegionServer.java   
/**
 * Flush a region on the region server.
 *
 * @param controller the RPC controller
 * @param request the request
 * @throws ServiceException
 */
@Override
@QosPriority(priority=HConstants.HIGH_QOS)
public FlushRegionResponse flushRegion(final RpcController controller,
    final FlushRegionRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    HRegion region = getRegion(request.getRegion());
    LOG.info("Flushing " + region.getRegionNameAsString());
    boolean shouldFlush = true;
    if (request.hasIfOlderThanTs()) {
      shouldFlush = region.getLastFlushTime() < request.getIfOlderThanTs();
    }
    FlushRegionResponse.Builder builder = FlushRegionResponse.newBuilder();
    if (shouldFlush) {
      builder.setFlushed(region.flushcache());
    }
    builder.setLastFlushTime(region.getLastFlushTime());
    return builder.build();
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
项目:ditb    文件:TestWALFiltering.java   
private void flushAllRegions(int rsId)
throws ServiceException, IOException {
  HRegionServer hrs = getRegionServer(rsId);
  for (byte[] regionName : getRegionsByServer(rsId)) {
    FlushRegionRequest request =
      RequestConverter.buildFlushRegionRequest(regionName);
    hrs.getRSRpcServices().flushRegion(null, request);
  }
}
项目:ditb    文件:RequestConverter.java   
/**
 * Create a protocol buffer FlushRegionRequest for a given region name
 *
 * @param regionName the name of the region to get info
 * @return a protocol buffer FlushRegionRequest
 */
public static FlushRegionRequest
    buildFlushRegionRequest(final byte[] regionName, boolean writeFlushWALMarker) {
  FlushRegionRequest.Builder builder = FlushRegionRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  builder.setWriteFlushWalMarker(writeFlushWALMarker);
  return builder.build();
}
项目:ditb    文件:HBaseAdmin.java   
private void flush(final ServerName sn, final HRegionInfo hri)
throws IOException {
  PayloadCarryingRpcController controller = rpcControllerFactory.newController();
  AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
  FlushRegionRequest request =
    RequestConverter.buildFlushRegionRequest(hri.getRegionName());
  try {
    admin.flushRegion(controller, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
项目:ditb    文件:FlushRegionCallable.java   
private FlushRegionResponse flushRegion() throws IOException {
  // check whether we should still do the flush to this region. If the regions are changed due
  // to splits or merges, etc return success
  if (!Bytes.equals(location.getRegionInfo().getRegionName(), regionName)) {
    if (!reload) {
      throw new IOException("Cached location seems to be different than requested region.");
    }
    LOG.info("Skipping flush region, because the located region "
        + Bytes.toStringBinary(location.getRegionInfo().getRegionName()) + " is different than "
        + " requested region " + Bytes.toStringBinary(regionName));
    return FlushRegionResponse.newBuilder()
        .setLastFlushTime(EnvironmentEdgeManager.currentTime())
        .setFlushed(false)
        .setWroteFlushWalMarker(false)
        .build();
  }

  FlushRegionRequest request =
      RequestConverter.buildFlushRegionRequest(regionName, writeFlushWalMarker);

  try {
    PayloadCarryingRpcController controller = rpcControllerFactory.newController();
    controller.setPriority(tableName);
    return stub.flushRegion(controller, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
项目:pbase    文件:TestWALFiltering.java   
private void flushAllRegions(int rsId)
throws ServiceException, IOException {
  HRegionServer hrs = getRegionServer(rsId);
  for (byte[] regionName : getRegionsByServer(rsId)) {
    FlushRegionRequest request =
      RequestConverter.buildFlushRegionRequest(regionName);
    hrs.getRSRpcServices().flushRegion(null, request);
  }
}
项目:pbase    文件:RequestConverter.java   
/**
 * Create a protocol buffer FlushRegionRequest for a given region name
 *
 * @param regionName the name of the region to get info
 * @return a protocol buffer FlushRegionRequest
 */
public static FlushRegionRequest
    buildFlushRegionRequest(final byte[] regionName) {
  FlushRegionRequest.Builder builder = FlushRegionRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  return builder.build();
}
项目:pbase    文件:HBaseAdmin.java   
private void flush(final ServerName sn, final HRegionInfo hri)
throws IOException {
  AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
  FlushRegionRequest request =
    RequestConverter.buildFlushRegionRequest(hri.getRegionName());
  try {
    admin.flushRegion(null, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
项目:HIndex    文件:HRegionServer.java   
/**
 * Flush a region on the region server.
 *
 * @param controller the RPC controller
 * @param request the request
 * @throws ServiceException
 */
@Override
@QosPriority(priority=HConstants.HIGH_QOS)
public FlushRegionResponse flushRegion(final RpcController controller,
    final FlushRegionRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    HRegion region = getRegion(request.getRegion());
    LOG.info("Flushing " + region.getRegionNameAsString());
    boolean shouldFlush = true;
    if (request.hasIfOlderThanTs()) {
      shouldFlush = region.getLastFlushTime() < request.getIfOlderThanTs();
    }
    FlushRegionResponse.Builder builder = FlushRegionResponse.newBuilder();
    if (shouldFlush) {
      boolean result = region.flushcache().isCompactionNeeded();
      if (result) {
        this.compactSplitThread.requestSystemCompaction(region,
            "Compaction through user triggered flush");
      }
      builder.setFlushed(result);
    }
    builder.setLastFlushTime(region.getLastFlushTime());
    return builder.build();
  } catch (DroppedSnapshotException ex) {
    // Cache flush can fail in a few places. If it fails in a critical
    // section, we get a DroppedSnapshotException and a replay of hlog
    // is required. Currently the only way to do this is a restart of
    // the server.
    abort("Replay of HLog required. Forcing server shutdown", ex);
    throw new ServiceException(ex);
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
项目:HIndex    文件:TestHLogFiltering.java   
private void flushAllRegions(int rsId)
throws ServiceException, IOException {
  HRegionServer hrs = getRegionServer(rsId);
  for (byte[] regionName : getRegionsByServer(rsId)) {
    FlushRegionRequest request =
      RequestConverter.buildFlushRegionRequest(regionName);
    hrs.flushRegion(null, request);
  }
}
项目:HIndex    文件:RequestConverter.java   
/**
 * Create a protocol buffer FlushRegionRequest for a given region name
 *
 * @param regionName the name of the region to get info
 * @return a protocol buffer FlushRegionRequest
 */
public static FlushRegionRequest
    buildFlushRegionRequest(final byte[] regionName) {
  FlushRegionRequest.Builder builder = FlushRegionRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  return builder.build();
}
项目:HIndex    文件:HBaseAdmin.java   
private void flush(final ServerName sn, final HRegionInfo hri)
throws IOException {
  AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
  FlushRegionRequest request =
    RequestConverter.buildFlushRegionRequest(hri.getRegionName());
  try {
    admin.flushRegion(null, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
项目:PyroDB    文件:RSRpcServices.java   
/**
 * Flush a region on the region server.
 *
 * @param controller the RPC controller
 * @param request the request
 * @throws ServiceException
 */
@Override
@QosPriority(priority=HConstants.HIGH_QOS)
public FlushRegionResponse flushRegion(final RpcController controller,
    final FlushRegionRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    HRegion region = getRegion(request.getRegion());
    LOG.info("Flushing " + region.getRegionNameAsString());
    boolean shouldFlush = true;
    if (request.hasIfOlderThanTs()) {
      shouldFlush = region.getLastFlushTime() < request.getIfOlderThanTs();
    }
    FlushRegionResponse.Builder builder = FlushRegionResponse.newBuilder();
    if (shouldFlush) {
      boolean result = region.flushcache().isCompactionNeeded();
      if (result) {
        regionServer.compactSplitThread.requestSystemCompaction(region,
          "Compaction through user triggered flush");
      }
      builder.setFlushed(result);
    }
    builder.setLastFlushTime(region.getLastFlushTime());
    return builder.build();
  } catch (DroppedSnapshotException ex) {
    // Cache flush can fail in a few places. If it fails in a critical
    // section, we get a DroppedSnapshotException and a replay of hlog
    // is required. Currently the only way to do this is a restart of
    // the server.
    regionServer.abort("Replay of HLog required. Forcing server shutdown", ex);
    throw new ServiceException(ex);
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
项目:PyroDB    文件:TestHLogFiltering.java   
private void flushAllRegions(int rsId)
throws ServiceException, IOException {
  HRegionServer hrs = getRegionServer(rsId);
  for (byte[] regionName : getRegionsByServer(rsId)) {
    FlushRegionRequest request =
      RequestConverter.buildFlushRegionRequest(regionName);
    hrs.getRSRpcServices().flushRegion(null, request);
  }
}
项目:PyroDB    文件:RequestConverter.java   
/**
 * Create a protocol buffer FlushRegionRequest for a given region name
 *
 * @param regionName the name of the region to get info
 * @return a protocol buffer FlushRegionRequest
 */
public static FlushRegionRequest
    buildFlushRegionRequest(final byte[] regionName) {
  FlushRegionRequest.Builder builder = FlushRegionRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  return builder.build();
}
项目:PyroDB    文件:HBaseAdmin.java   
private void flush(final ServerName sn, final HRegionInfo hri)
throws IOException {
  AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
  FlushRegionRequest request =
    RequestConverter.buildFlushRegionRequest(hri.getRegionName());
  try {
    admin.flushRegion(null, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
项目:c5    文件:HRegionServer.java   
/**
 * Flush a region on the region server.
 *
 * @param controller the RPC controller
 * @param request the request
 * @throws ServiceException
 */
@Override
@QosPriority(priority=HConstants.HIGH_QOS)
public FlushRegionResponse flushRegion(final RpcController controller,
    final FlushRegionRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    HRegion region = getRegion(request.getRegion());
    LOG.info("Flushing " + region.getRegionNameAsString());
    boolean shouldFlush = true;
    if (request.hasIfOlderThanTs()) {
      shouldFlush = region.getLastFlushTime() < request.getIfOlderThanTs();
    }
    FlushRegionResponse.Builder builder = FlushRegionResponse.newBuilder();
    if (shouldFlush) {
      boolean result = region.flushcache();
      if (result) {
        this.compactSplitThread.requestSystemCompaction(region,
            "Compaction through user triggered flush");
      }
      builder.setFlushed(result);
    }
    builder.setLastFlushTime(region.getLastFlushTime());
    return builder.build();
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
项目:c5    文件:TestHLogFiltering.java   
private void flushAllRegions(int rsId)
throws ServiceException, IOException {
  HRegionServer hrs = getRegionServer(rsId);
  for (byte[] regionName : getRegionsByServer(rsId)) {
    FlushRegionRequest request =
      RequestConverter.buildFlushRegionRequest(regionName);
    hrs.flushRegion(null, request);
  }
}
项目:c5    文件:RequestConverter.java   
/**
 * Create a protocol buffer FlushRegionRequest for a given region name
 *
 * @param regionName the name of the region to get info
 * @return a protocol buffer FlushRegionRequest
 */
public static FlushRegionRequest
    buildFlushRegionRequest(final byte[] regionName) {
  FlushRegionRequest.Builder builder = FlushRegionRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  return builder.build();
}
项目:c5    文件:HBaseAdmin.java   
private void flush(final ServerName sn, final HRegionInfo hri)
throws IOException {
  AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
  FlushRegionRequest request =
    RequestConverter.buildFlushRegionRequest(hri.getRegionName());
  try {
    admin.flushRegion(null, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
项目:DominoHBase    文件:RequestConverter.java   
/**
 * Create a protocol buffer FlushRegionRequest for a given region name
 *
 * @param regionName the name of the region to get info
 * @return a protocol buffer FlushRegionRequest
 */
public static FlushRegionRequest
    buildFlushRegionRequest(final byte[] regionName) {
  FlushRegionRequest.Builder builder = FlushRegionRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  return builder.build();
}
项目:DominoHBase    文件:HBaseAdmin.java   
private void flush(final ServerName sn, final HRegionInfo hri)
throws IOException {
  AdminProtocol admin =
    this.connection.getAdmin(sn.getHostname(), sn.getPort());
  FlushRegionRequest request =
    RequestConverter.buildFlushRegionRequest(hri.getRegionName());
  try {
    admin.flushRegion(null, request);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
项目:DominoHBase    文件:TestHLogFiltering.java   
private void flushAllRegions(int rsId)
throws ServiceException, IOException {
  HRegionServer hrs = getRegionServer(rsId);
  for (byte[] regionName : getRegionsByServer(rsId)) {
    FlushRegionRequest request =
      RequestConverter.buildFlushRegionRequest(regionName);
    hrs.flushRegion(null, request);
  }
}
项目:ditb    文件:RSRpcServices.java   
/**
 * Flush a region on the region server.
 *
 * @param controller the RPC controller
 * @param request the request
 * @throws ServiceException
 */
@Override
@QosPriority(priority=HConstants.ADMIN_QOS)
public FlushRegionResponse flushRegion(final RpcController controller,
    final FlushRegionRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    Region region = getRegion(request.getRegion());
    LOG.info("Flushing " + region.getRegionInfo().getRegionNameAsString());
    boolean shouldFlush = true;
    if (request.hasIfOlderThanTs()) {
      shouldFlush = region.getEarliestFlushTimeForAllStores() < request.getIfOlderThanTs();
    }
    FlushRegionResponse.Builder builder = FlushRegionResponse.newBuilder();
    if (shouldFlush) {
      boolean writeFlushWalMarker =  request.hasWriteFlushWalMarker() ?
          request.getWriteFlushWalMarker() : false;
      long startTime = EnvironmentEdgeManager.currentTime();
      // Go behind the curtain so we can manage writing of the flush WAL marker
      HRegion.FlushResultImpl flushResult = (HRegion.FlushResultImpl)
          ((HRegion)region).flushcache(true, writeFlushWalMarker);
      if (flushResult.isFlushSucceeded()) {
        long endTime = EnvironmentEdgeManager.currentTime();
        regionServer.metricsRegionServer.updateFlushTime(endTime - startTime);
      }
      boolean compactionNeeded = flushResult.isCompactionNeeded();
      if (compactionNeeded) {
        regionServer.compactSplitThread.requestSystemCompaction(region,
          "Compaction through user triggered flush");
      }
      builder.setFlushed(flushResult.isFlushSucceeded());
      builder.setWroteFlushWalMarker(flushResult.wroteFlushWalMarker);
    }
    builder.setLastFlushTime(region.getEarliestFlushTimeForAllStores());
    return builder.build();
  } catch (DroppedSnapshotException ex) {
    // Cache flush can fail in a few places. If it fails in a critical
    // section, we get a DroppedSnapshotException and a replay of wal
    // is required. Currently the only way to do this is a restart of
    // the server.
    regionServer.abort("Replay of WAL required. Forcing server shutdown", ex);
    throw new ServiceException(ex);
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
项目:ditb    文件:MockRegionServer.java   
@Override
public FlushRegionResponse flushRegion(RpcController controller,
    FlushRegionRequest request) throws ServiceException {
  // TODO Auto-generated method stub
  return null;
}
项目:pbase    文件:RSRpcServices.java   
/**
 * Flush a region on the region server.
 *
 * @param controller the RPC controller
 * @param request    the request
 * @throws ServiceException
 */
@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public FlushRegionResponse flushRegion(final RpcController controller,
                                       final FlushRegionRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        HRegion region = getRegion(request.getRegion());
        LOG.info("Flushing " + region.getRegionNameAsString());
        boolean shouldFlush = true;
        if (request.hasIfOlderThanTs()) {
            shouldFlush = region.getLastFlushTime() < request.getIfOlderThanTs();
        }
        FlushRegionResponse.Builder builder = FlushRegionResponse.newBuilder();
        if (shouldFlush) {
            long startTime = EnvironmentEdgeManager.currentTime();
            HRegion.FlushResult flushResult = region.flushcache();
            if (flushResult.isFlushSucceeded()) {
                long endTime = EnvironmentEdgeManager.currentTime();
                regionServer.metricsRegionServer.updateFlushTime(endTime - startTime);
            }
            boolean result = flushResult.isCompactionNeeded();
            if (result) {
                regionServer.compactSplitThread.requestSystemCompaction(region,
                        "Compaction through user triggered flush");
            }
            builder.setFlushed(result);
        }
        builder.setLastFlushTime(region.getLastFlushTime());
        return builder.build();
    } catch (DroppedSnapshotException ex) {
        // Cache flush can fail in a few places. If it fails in a critical
        // section, we get a DroppedSnapshotException and a replay of wal
        // is required. Currently the only way to do this is a restart of
        // the server.
        regionServer.abort("Replay of WAL required. Forcing server shutdown", ex);
        throw new ServiceException(ex);
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
项目:pbase    文件:MockRegionServer.java   
@Override
public FlushRegionResponse flushRegion(RpcController controller,
    FlushRegionRequest request) throws ServiceException {
  // TODO Auto-generated method stub
  return null;
}
项目:HIndex    文件:MockRegionServer.java   
@Override
public FlushRegionResponse flushRegion(RpcController controller,
    FlushRegionRequest request) throws ServiceException {
  // TODO Auto-generated method stub
  return null;
}
项目:PyroDB    文件:MockRegionServer.java   
@Override
public FlushRegionResponse flushRegion(RpcController controller,
    FlushRegionRequest request) throws ServiceException {
  // TODO Auto-generated method stub
  return null;
}
项目:c5    文件:MockRegionServer.java   
@Override
public FlushRegionResponse flushRegion(RpcController controller,
    FlushRegionRequest request) throws ServiceException {
  // TODO Auto-generated method stub
  return null;
}
项目:DominoHBase    文件:MockRegionServer.java   
@Override
public FlushRegionResponse flushRegion(RpcController controller,
    FlushRegionRequest request) throws ServiceException {
  // TODO Auto-generated method stub
  return null;
}
项目:ditb    文件:RequestConverter.java   
/**
 * Create a protocol buffer FlushRegionRequest for a given region name
 *
 * @param regionName the name of the region to get info
 * @return a protocol buffer FlushRegionRequest
 */
public static FlushRegionRequest
    buildFlushRegionRequest(final byte[] regionName) {
  return buildFlushRegionRequest(regionName, false);
}