Search in sources :

Example 1 with WarmupRegionResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WarmupRegionResponse in project hbase by apache.

the class RSRpcServices method warmupRegion.

/**
 * Warmup a region on this server.
 * This method should only be called by Master. It synchronously opens the region and
 * closes the region bringing the most important pages in cache.
 */
@Override
public WarmupRegionResponse warmupRegion(final RpcController controller, final WarmupRegionRequest request) throws ServiceException {
    final RegionInfo region = ProtobufUtil.toRegionInfo(request.getRegionInfo());
    WarmupRegionResponse response = WarmupRegionResponse.getDefaultInstance();
    try {
        checkOpen();
        String encodedName = region.getEncodedName();
        byte[] encodedNameBytes = region.getEncodedNameAsBytes();
        final HRegion onlineRegion = server.getRegion(encodedName);
        if (onlineRegion != null) {
            LOG.info("{} is online; skipping warmup", region);
            return response;
        }
        TableDescriptor htd = server.getTableDescriptors().get(region.getTable());
        if (server.getRegionsInTransitionInRS().containsKey(encodedNameBytes)) {
            LOG.info("{} is in transition; skipping warmup", region);
            return response;
        }
        LOG.info("Warmup {}", region.getRegionNameAsString());
        HRegion.warmupHRegion(region, htd, server.getWAL(region), server.getConfiguration(), server, null);
    } catch (IOException ie) {
        LOG.error("Failed warmup of {}", region.getRegionNameAsString(), ie);
        throw new ServiceException(ie);
    }
    return response;
}
Also used : WarmupRegionResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WarmupRegionResponse) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) UncheckedIOException(java.io.UncheckedIOException) TableDescriptor(org.apache.hadoop.hbase.client.TableDescriptor)

Aggregations

IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)1 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)1 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)1 WarmupRegionResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WarmupRegionResponse)1 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1