Search in sources :

Example 31 with ServiceException

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);
    }
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Example 32 with ServiceException

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();
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) ListTablesInRSGroupResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RSGroupAdminProtos.ListTablesInRSGroupResponse) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Example 33 with ServiceException

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();
}
Also used : MajorCompactionTimestampResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MajorCompactionTimestampResponse) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Example 34 with ServiceException

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);
    }
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) AbortProcedureResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.AbortProcedureResponse) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Example 35 with ServiceException

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);
    }
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) RegionSpecifierType(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType) AssignRegionResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.AssignRegionResponse) UnknownRegionException(org.apache.hadoop.hbase.UnknownRegionException) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Aggregations

ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)130 IOException (java.io.IOException)112 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)100 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)39 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)28 UncheckedIOException (java.io.UncheckedIOException)27 TableName (org.apache.hadoop.hbase.TableName)22 QosPriority (org.apache.hadoop.hbase.ipc.QosPriority)22 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)19 UnknownRegionException (org.apache.hadoop.hbase.UnknownRegionException)16 UnknownProtocolException (org.apache.hadoop.hbase.exceptions.UnknownProtocolException)16 Test (org.junit.Test)16 InvocationTargetException (java.lang.reflect.InvocationTargetException)15 ArrayList (java.util.ArrayList)15 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)15 ForeignException (org.apache.hadoop.hbase.errorhandling.ForeignException)15 ServerNotRunningYetException (org.apache.hadoop.hbase.ipc.ServerNotRunningYetException)15 KeeperException (org.apache.zookeeper.KeeperException)14 Table (org.apache.hadoop.hbase.client.Table)13 User (org.apache.hadoop.hbase.security.User)13