Search in sources :

Example 1 with FlushRegionRequest

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

the class HBaseAdmin method flushRegion.

@Override
public void flushRegion(final byte[] regionName) throws IOException {
    Pair<HRegionInfo, ServerName> regionServerPair = getRegion(regionName);
    if (regionServerPair == null) {
        throw new IllegalArgumentException("Unknown regionname: " + Bytes.toStringBinary(regionName));
    }
    if (regionServerPair.getSecond() == null) {
        throw new NoServerForRegionException(Bytes.toStringBinary(regionName));
    }
    final HRegionInfo hRegionInfo = regionServerPair.getFirst();
    ServerName serverName = regionServerPair.getSecond();
    final AdminService.BlockingInterface admin = this.connection.getAdmin(serverName);
    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();
            FlushRegionRequest request = RequestConverter.buildFlushRegionRequest(hRegionInfo.getRegionName());
            admin.flushRegion(controller, request);
            return null;
        }
    };
    ProtobufUtil.call(callable);
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) HBaseRpcController(org.apache.hadoop.hbase.ipc.HBaseRpcController) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService) ServerName(org.apache.hadoop.hbase.ServerName) Callable(java.util.concurrent.Callable) FlushRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.FlushRegionRequest)

Example 2 with FlushRegionRequest

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

the class RequestConverter method buildFlushRegionRequest.

/**
 * Create a protocol buffer FlushRegionRequest for a given region name
 * @param regionName the name of the region to get info
 * @param columnFamily column family within a region
 * @return a protocol buffer FlushRegionRequest
 */
public static FlushRegionRequest buildFlushRegionRequest(final byte[] regionName, byte[] columnFamily, boolean writeFlushWALMarker) {
    FlushRegionRequest.Builder builder = FlushRegionRequest.newBuilder();
    RegionSpecifier region = buildRegionSpecifier(RegionSpecifierType.REGION_NAME, regionName);
    builder.setRegion(region);
    builder.setWriteFlushWalMarker(writeFlushWALMarker);
    if (columnFamily != null) {
        builder.setFamily(UnsafeByteOperations.unsafeWrap(columnFamily));
    }
    return builder.build();
}
Also used : FlushRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.FlushRegionRequest) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)

Example 3 with FlushRegionRequest

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

the class TestWALFiltering method flushAllRegions.

private void flushAllRegions(int rsId) throws ServiceException, org.apache.hbase.thirdparty.com.google.protobuf.ServiceException, IOException {
    HRegionServer hrs = getRegionServer(rsId);
    for (byte[] regionName : getRegionsByServer(rsId)) {
        FlushRegionRequest request = RequestConverter.buildFlushRegionRequest(regionName);
        hrs.getRSRpcServices().flushRegion(null, request);
    }
}
Also used : FlushRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.FlushRegionRequest) HRegionServer(org.apache.hadoop.hbase.regionserver.HRegionServer)

Aggregations

FlushRegionRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.FlushRegionRequest)3 Callable (java.util.concurrent.Callable)1 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)1 ServerName (org.apache.hadoop.hbase.ServerName)1 HBaseRpcController (org.apache.hadoop.hbase.ipc.HBaseRpcController)1 HRegionServer (org.apache.hadoop.hbase.regionserver.HRegionServer)1 AdminService (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService)1 RegionSpecifier (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier)1