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