Search in sources :

Example 1 with CompactRegionRequest

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

the class RequestConverter method buildCompactRegionRequest.

/**
  * Create a  CompactRegionRequest for a given region name
  *
  * @param regionName the name of the region to get info
  * @param major indicator if it is a major compaction
  * @return a CompactRegionRequest
  */
public static CompactRegionRequest buildCompactRegionRequest(final byte[] regionName, final boolean major, final byte[] family) {
    CompactRegionRequest.Builder builder = CompactRegionRequest.newBuilder();
    RegionSpecifier region = buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName);
    builder.setRegion(region);
    builder.setMajor(major);
    if (family != null) {
        builder.setFamily(UnsafeByteOperations.unsafeWrap(family));
    }
    return builder.build();
}
Also used : CompactRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CompactRegionRequest) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)

Example 2 with CompactRegionRequest

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

the class HBaseAdmin method compact.

private void compact(final ServerName sn, final HRegionInfo hri, final boolean major, final byte[] family) throws IOException {
    final AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
    Callable<Void> callable = new Callable<Void>() {

        @Override
        public Void call() throws Exception {
            // TODO: There is no timeout on this controller. Set one!
            HBaseRpcController controller = rpcControllerFactory.newController();
            CompactRegionRequest request = RequestConverter.buildCompactRegionRequest(hri.getRegionName(), major, family);
            admin.compactRegion(controller, request);
            return null;
        }
    };
    ProtobufUtil.call(callable);
}
Also used : HBaseRpcController(org.apache.hadoop.hbase.ipc.HBaseRpcController) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService) CompactRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CompactRegionRequest) Callable(java.util.concurrent.Callable)

Aggregations

CompactRegionRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CompactRegionRequest)2 Callable (java.util.concurrent.Callable)1 HBaseRpcController (org.apache.hadoop.hbase.ipc.HBaseRpcController)1 AdminService (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService)1 RegionSpecifier (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)1