Search in sources :

Example 26 with ServiceException

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.

the class AbstractRpcClient method callBlockingMethod.

/**
   * Make a blocking call. Throws exceptions if there are network problems or if the remote code
   * threw an exception.
   * @param ticket Be careful which ticket you pass. A new user will mean a new Connection.
   *          {@link UserProvider#getCurrent()} makes a new instance of User each time so will be a
   *          new Connection each time.
   * @return A pair with the Message response and the Cell data (if any).
   */
private Message callBlockingMethod(Descriptors.MethodDescriptor md, HBaseRpcController hrc, Message param, Message returnType, final User ticket, final InetSocketAddress isa) throws ServiceException {
    BlockingRpcCallback<Message> done = new BlockingRpcCallback<>();
    callMethod(md, hrc, param, returnType, ticket, isa, done);
    Message val;
    try {
        val = done.get();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
    if (hrc.failed()) {
        throw new ServiceException(hrc.getFailed());
    } else {
        return val;
    }
}
Also used : Message(org.apache.hadoop.hbase.shaded.com.google.protobuf.Message) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) IOException(java.io.IOException)

Example 27 with ServiceException

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.

the class ServerManager method sendFavoredNodes.

public void sendFavoredNodes(final ServerName server, Map<HRegionInfo, List<ServerName>> favoredNodes) throws IOException {
    AdminService.BlockingInterface admin = getRsAdmin(server);
    if (admin == null) {
        LOG.warn("Attempting to send favored nodes update rpc to server " + server.toString() + " failed because no RPC connection found to this server");
    } else {
        List<Pair<HRegionInfo, List<ServerName>>> regionUpdateInfos = new ArrayList<>();
        for (Entry<HRegionInfo, List<ServerName>> entry : favoredNodes.entrySet()) {
            regionUpdateInfos.add(new Pair<>(entry.getKey(), entry.getValue()));
        }
        UpdateFavoredNodesRequest request = RequestConverter.buildUpdateFavoredNodesRequest(regionUpdateInfos);
        try {
            admin.updateFavoredNodes(null, request);
        } catch (ServiceException se) {
            throw ProtobufUtil.getRemoteException(se);
        }
    }
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) UpdateFavoredNodesRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.UpdateFavoredNodesRequest) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) ServerName(org.apache.hadoop.hbase.ServerName) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) Pair(org.apache.hadoop.hbase.util.Pair)

Example 28 with ServiceException

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.

the class ServerManager method sendRegionOpen.

// RPC methods to region servers
/**
   * Sends an OPEN RPC to the specified server to open the specified region.
   * <p>
   * Open should not fail but can if server just crashed.
   * <p>
   * @param server server to open a region
   * @param region region to open
   * @param favoredNodes
   */
public RegionOpeningState sendRegionOpen(final ServerName server, HRegionInfo region, List<ServerName> favoredNodes) throws IOException {
    AdminService.BlockingInterface admin = getRsAdmin(server);
    if (admin == null) {
        throw new IOException("Attempting to send OPEN RPC to server " + server.toString() + " failed because no RPC connection found to this server");
    }
    OpenRegionRequest request = RequestConverter.buildOpenRegionRequest(server, region, favoredNodes, (RecoveryMode.LOG_REPLAY == this.master.getMasterWalManager().getLogRecoveryMode()));
    try {
        OpenRegionResponse response = admin.openRegion(null, request);
        return ResponseConverter.getRegionOpeningState(response);
    } catch (ServiceException se) {
        checkForRSznode(server, se);
        throw ProtobufUtil.getRemoteException(se);
    }
}
Also used : OpenRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.OpenRegionRequest) OpenRegionResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.OpenRegionResponse) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) IOException(java.io.IOException)

Example 29 with ServiceException

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.

the class ServerManager method sendRegionOpen.

/**
   * Sends an OPEN RPC to the specified server to open the specified region.
   * <p>
   * Open should not fail but can if server just crashed.
   * <p>
   * @param server server to open a region
   * @param regionOpenInfos info of a list of regions to open
   * @return a list of region opening states
   */
public List<RegionOpeningState> sendRegionOpen(ServerName server, List<Pair<HRegionInfo, List<ServerName>>> regionOpenInfos) throws IOException {
    AdminService.BlockingInterface admin = getRsAdmin(server);
    if (admin == null) {
        throw new IOException("Attempting to send OPEN RPC to server " + server.toString() + " failed because no RPC connection found to this server");
    }
    OpenRegionRequest request = RequestConverter.buildOpenRegionRequest(server, regionOpenInfos, (RecoveryMode.LOG_REPLAY == this.master.getMasterWalManager().getLogRecoveryMode()));
    try {
        OpenRegionResponse response = admin.openRegion(null, request);
        return ResponseConverter.getRegionOpeningStateList(response);
    } catch (ServiceException se) {
        checkForRSznode(server, se);
        throw ProtobufUtil.getRemoteException(se);
    }
}
Also used : OpenRegionRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.OpenRegionRequest) OpenRegionResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.OpenRegionResponse) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) IOException(java.io.IOException)

Example 30 with ServiceException

use of org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException in project hbase by apache.

the class RSRpcServices method cleanupBulkLoad.

@Override
public CleanupBulkLoadResponse cleanupBulkLoad(RpcController controller, CleanupBulkLoadRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        Region region = getRegion(request.getRegion());
        regionServer.secureBulkLoadManager.cleanupBulkLoad(region, request);
        CleanupBulkLoadResponse response = CleanupBulkLoadResponse.newBuilder().build();
        return response;
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
Also used : ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) CleanupBulkLoadResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CleanupBulkLoadResponse)

Aggregations

ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)95 IOException (java.io.IOException)76 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)65 InterruptedIOException (java.io.InterruptedIOException)28 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)24 ServerName (org.apache.hadoop.hbase.ServerName)16 QosPriority (org.apache.hadoop.hbase.ipc.QosPriority)15 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)14 ArrayList (java.util.ArrayList)12 HBaseRpcController (org.apache.hadoop.hbase.ipc.HBaseRpcController)12 TableName (org.apache.hadoop.hbase.TableName)10 ByteString (org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString)10 Test (org.junit.Test)9 CellScanner (org.apache.hadoop.hbase.CellScanner)5 UnknownRegionException (org.apache.hadoop.hbase.UnknownRegionException)4 ClusterConnection (org.apache.hadoop.hbase.client.ClusterConnection)4 Result (org.apache.hadoop.hbase.client.Result)4 ForeignException (org.apache.hadoop.hbase.errorhandling.ForeignException)4 RpcCallContext (org.apache.hadoop.hbase.ipc.RpcCallContext)4 OperationQuota (org.apache.hadoop.hbase.quotas.OperationQuota)4