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();
}
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);
}
Aggregations