use of org.apache.hbase.thirdparty.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method setBalancerRunning.
@Override
public SetBalancerRunningResponse setBalancerRunning(RpcController c, SetBalancerRunningRequest req) throws ServiceException {
try {
server.checkInitialized();
boolean prevValue = (req.getSynchronous()) ? synchronousBalanceSwitch(req.getOn()) : server.balanceSwitch(req.getOn());
return SetBalancerRunningResponse.newBuilder().setPrevBalanceValue(prevValue).build();
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
use of org.apache.hbase.thirdparty.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method listTablesInRSGroup.
@Override
public ListTablesInRSGroupResponse listTablesInRSGroup(RpcController controller, ListTablesInRSGroupRequest request) throws ServiceException {
ListTablesInRSGroupResponse.Builder builder = ListTablesInRSGroupResponse.newBuilder();
String groupName = request.getGroupName();
LOG.info(server.getClientIdAuditPrefix() + " list tables in rsgroup " + groupName);
try {
if (server.getMasterCoprocessorHost() != null) {
server.getMasterCoprocessorHost().preListTablesInRSGroup(groupName);
}
RSGroupUtil.listTablesInRSGroup(server, groupName).stream().map(ProtobufUtil::toProtoTableName).forEach(builder::addTableName);
if (server.getMasterCoprocessorHost() != null) {
server.getMasterCoprocessorHost().postListTablesInRSGroup(groupName);
}
} catch (IOException e) {
throw new ServiceException(e);
}
return builder.build();
}
use of org.apache.hbase.thirdparty.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method getLastMajorCompactionTimestampForRegion.
@Override
public MajorCompactionTimestampResponse getLastMajorCompactionTimestampForRegion(RpcController controller, MajorCompactionTimestampForRegionRequest request) throws ServiceException {
MajorCompactionTimestampResponse.Builder response = MajorCompactionTimestampResponse.newBuilder();
try {
server.checkInitialized();
response.setCompactionTimestamp(server.getLastMajorCompactionTimestampForRegion(request.getRegion().getValue().toByteArray()));
} catch (IOException e) {
throw new ServiceException(e);
}
return response.build();
}
use of org.apache.hbase.thirdparty.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method abortProcedure.
@Override
public AbortProcedureResponse abortProcedure(RpcController rpcController, AbortProcedureRequest request) throws ServiceException {
try {
AbortProcedureResponse.Builder response = AbortProcedureResponse.newBuilder();
boolean abortResult = server.abortProcedure(request.getProcId(), request.getMayInterruptIfRunning());
response.setIsProcedureAborted(abortResult);
return response.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
use of org.apache.hbase.thirdparty.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method assignRegion.
@Override
public AssignRegionResponse assignRegion(RpcController controller, AssignRegionRequest req) throws ServiceException {
try {
server.checkInitialized();
final RegionSpecifierType type = req.getRegion().getType();
if (type != RegionSpecifierType.REGION_NAME) {
LOG.warn("assignRegion specifier type: expected: " + RegionSpecifierType.REGION_NAME + " actual: " + type);
}
final byte[] regionName = req.getRegion().getValue().toByteArray();
final RegionInfo regionInfo = server.getAssignmentManager().getRegionInfo(regionName);
if (regionInfo == null) {
throw new UnknownRegionException(Bytes.toStringBinary(regionName));
}
final AssignRegionResponse arr = AssignRegionResponse.newBuilder().build();
if (server.cpHost != null) {
server.cpHost.preAssign(regionInfo);
}
LOG.info(server.getClientIdAuditPrefix() + " assign " + regionInfo.getRegionNameAsString());
server.getAssignmentManager().assign(regionInfo);
if (server.cpHost != null) {
server.cpHost.postAssign(regionInfo);
}
return arr;
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
Aggregations