Search in sources :

Example 66 with ServiceException

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

the class RSRpcServices method rollWALWriter.

/**
   * Roll the WAL writer of the region server.
   * @param controller the RPC controller
   * @param request the request
   * @throws ServiceException
   */
@Override
public RollWALWriterResponse rollWALWriter(final RpcController controller, final RollWALWriterRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        regionServer.getRegionServerCoprocessorHost().preRollWALWriterRequest();
        regionServer.walRoller.requestRollAll();
        regionServer.getRegionServerCoprocessorHost().postRollWALWriterRequest();
        RollWALWriterResponse.Builder builder = RollWALWriterResponse.newBuilder();
        return builder.build();
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
Also used : RollWALWriterResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.RollWALWriterResponse) 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)

Example 67 with ServiceException

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

the class RSRpcServices method splitRegion.

/**
   * Split a region on the region server.
   *
   * @param controller the RPC controller
   * @param request the request
   * @throws ServiceException
   */
@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public SplitRegionResponse splitRegion(final RpcController controller, final SplitRegionRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        Region region = getRegion(request.getRegion());
        region.startRegionOperation(Operation.SPLIT_REGION);
        if (region.getRegionInfo().getReplicaId() != HRegionInfo.DEFAULT_REPLICA_ID) {
            throw new IOException("Can't split replicas directly. " + "Replicas are auto-split when their primary is split.");
        }
        LOG.info("Splitting " + region.getRegionInfo().getRegionNameAsString());
        region.flush(true);
        byte[] splitPoint = null;
        if (request.hasSplitPoint()) {
            splitPoint = request.getSplitPoint().toByteArray();
        }
        ((HRegion) region).forceSplit(splitPoint);
        regionServer.compactSplitThread.requestSplit(region, ((HRegion) region).checkSplit(), RpcServer.getRequestUser());
        return SplitRegionResponse.newBuilder().build();
    } catch (DroppedSnapshotException ex) {
        regionServer.abort("Replay of WAL required. Forcing server shutdown", ex);
        throw new ServiceException(ex);
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
Also used : DroppedSnapshotException(org.apache.hadoop.hbase.DroppedSnapshotException) 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) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

Example 68 with ServiceException

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

the class RSRpcServices method replicateWALEntry.

/**
   * Replicate WAL entries on the region server.
   *
   * @param controller the RPC controller
   * @param request the request
   * @throws ServiceException
   */
@Override
@QosPriority(priority = HConstants.REPLICATION_QOS)
public ReplicateWALEntryResponse replicateWALEntry(final RpcController controller, final ReplicateWALEntryRequest request) throws ServiceException {
    try {
        checkOpen();
        if (regionServer.replicationSinkHandler != null) {
            requestCount.increment();
            List<WALEntry> entries = request.getEntryList();
            CellScanner cellScanner = ((HBaseRpcController) controller).cellScanner();
            regionServer.getRegionServerCoprocessorHost().preReplicateLogEntries(entries, cellScanner);
            regionServer.replicationSinkHandler.replicateLogEntries(entries, cellScanner, request.getReplicationClusterId(), request.getSourceBaseNamespaceDirPath(), request.getSourceHFileArchiveDirPath());
            regionServer.getRegionServerCoprocessorHost().postReplicateLogEntries(entries, cellScanner);
            return ReplicateWALEntryResponse.newBuilder().build();
        } else {
            throw new ServiceException("Replication services are not initialized yet");
        }
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
Also used : HBaseRpcController(org.apache.hadoop.hbase.ipc.HBaseRpcController) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) WALEntry(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WALEntry) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) CellScanner(org.apache.hadoop.hbase.CellScanner) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

Example 69 with ServiceException

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

the class RSRpcServices method execService.

@Override
public CoprocessorServiceResponse execService(final RpcController controller, final CoprocessorServiceRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        Region region = getRegion(request.getRegion());
        com.google.protobuf.Message result = execServiceOnRegion(region, request.getCall());
        CoprocessorServiceResponse.Builder builder = CoprocessorServiceResponse.newBuilder();
        builder.setRegion(RequestConverter.buildRegionSpecifier(RegionSpecifierType.REGION_NAME, region.getRegionInfo().getRegionName()));
        // TODO: COPIES!!!!!!
        builder.setValue(builder.getValueBuilder().setName(result.getClass().getName()).setValue(org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString.copyFrom(result.toByteArray())));
        return builder.build();
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
Also used : ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) CoprocessorServiceResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CoprocessorServiceResponse) Message(org.apache.hadoop.hbase.shaded.com.google.protobuf.Message) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException)

Example 70 with ServiceException

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

the class RSRpcServices method getOnlineRegion.

@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public GetOnlineRegionResponse getOnlineRegion(final RpcController controller, final GetOnlineRegionRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        Map<String, Region> onlineRegions = regionServer.onlineRegions;
        List<HRegionInfo> list = new ArrayList<>(onlineRegions.size());
        for (Region region : onlineRegions.values()) {
            list.add(region.getRegionInfo());
        }
        Collections.sort(list);
        return ResponseConverter.buildGetOnlineRegionResponse(list);
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) ArrayList(java.util.ArrayList) ByteString(org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

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