use of org.apache.hbase.thirdparty.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method removeServers.
@Override
public RemoveServersResponse removeServers(RpcController controller, RemoveServersRequest request) throws ServiceException {
RemoveServersResponse.Builder builder = RemoveServersResponse.newBuilder();
Set<Address> servers = Sets.newHashSet();
for (HBaseProtos.ServerName el : request.getServersList()) {
servers.add(Address.fromParts(el.getHostName(), el.getPort()));
}
LOG.info(server.getClientIdAuditPrefix() + " remove decommissioned servers from rsgroup: " + servers);
try {
if (server.getMasterCoprocessorHost() != null) {
server.getMasterCoprocessorHost().preRemoveServers(servers);
}
server.getRSGroupInfoManager().removeServers(servers);
if (server.getMasterCoprocessorHost() != null) {
server.getMasterCoprocessorHost().postRemoveServers(servers);
}
} 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 listDecommissionedRegionServers.
@Override
public ListDecommissionedRegionServersResponse listDecommissionedRegionServers(RpcController controller, ListDecommissionedRegionServersRequest request) throws ServiceException {
ListDecommissionedRegionServersResponse.Builder response = ListDecommissionedRegionServersResponse.newBuilder();
try {
server.checkInitialized();
if (server.cpHost != null) {
server.cpHost.preListDecommissionedRegionServers();
}
List<ServerName> servers = server.listDecommissionedRegionServers();
response.addAllServerName((servers.stream().map(server -> ProtobufUtil.toServerName(server))).collect(Collectors.toList()));
if (server.cpHost != null) {
server.cpHost.postListDecommissionedRegionServers();
}
} catch (IOException io) {
throw new ServiceException(io);
}
return response.build();
}
use of org.apache.hbase.thirdparty.com.google.protobuf.ServiceException in project hbase by apache.
the class MasterRpcServices method unassigns.
/**
* A 'raw' version of unassign that does bulk and can skirt Master state checks if override
* is set; i.e. unassigns can be forced during Master startup or if RegionState is unclean.
* Used by HBCK2.
*/
@Override
public MasterProtos.UnassignsResponse unassigns(RpcController controller, MasterProtos.UnassignsRequest request) throws ServiceException {
checkMasterProcedureExecutor();
MasterProtos.UnassignsResponse.Builder responseBuilder = MasterProtos.UnassignsResponse.newBuilder();
try {
boolean override = request.getOverride();
LOG.info("{} unassigns, override={}", server.getClientIdAuditPrefix(), override);
for (HBaseProtos.RegionSpecifier rs : request.getRegionList()) {
long pid = Procedure.NO_PROC_ID;
RegionInfo ri = getRegionInfo(rs);
if (ri == null) {
LOG.info("Unknown={}", rs);
} else {
Procedure p = this.server.getAssignmentManager().createOneUnassignProcedure(ri, override);
if (p != null) {
pid = this.server.getMasterProcedureExecutor().submitProcedure(p);
}
}
responseBuilder.addPid(pid);
}
return responseBuilder.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 getTableState.
@Override
public GetTableStateResponse getTableState(RpcController controller, GetTableStateRequest request) throws ServiceException {
try {
server.checkServiceStarted();
TableName tableName = ProtobufUtil.toTableName(request.getTableName());
TableState ts = server.getTableStateManager().getTableState(tableName);
GetTableStateResponse.Builder builder = GetTableStateResponse.newBuilder();
builder.setTableState(ts.convert());
return builder.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 balanceRSGroup.
@Override
public BalanceRSGroupResponse balanceRSGroup(RpcController controller, BalanceRSGroupRequest request) throws ServiceException {
BalanceRequest balanceRequest = ProtobufUtil.toBalanceRequest(request);
BalanceRSGroupResponse.Builder builder = BalanceRSGroupResponse.newBuilder().setBalanceRan(false);
LOG.info(server.getClientIdAuditPrefix() + " balance rsgroup, group=" + request.getRSGroupName());
try {
if (server.getMasterCoprocessorHost() != null) {
server.getMasterCoprocessorHost().preBalanceRSGroup(request.getRSGroupName(), balanceRequest);
}
BalanceResponse response = server.getRSGroupInfoManager().balanceRSGroup(request.getRSGroupName(), balanceRequest);
ProtobufUtil.populateBalanceRSGroupResponse(builder, response);
if (server.getMasterCoprocessorHost() != null) {
server.getMasterCoprocessorHost().postBalanceRSGroup(request.getRSGroupName(), balanceRequest, response);
}
} catch (IOException e) {
throw new ServiceException(e);
}
return builder.build();
}
Aggregations