Search in sources :

Example 26 with HBaseRpcController

use of org.apache.hadoop.hbase.ipc.HBaseRpcController in project hbase by apache.

the class HBaseAdmin method closeRegion.

@Override
public void closeRegion(final ServerName sn, final HRegionInfo hri) throws IOException {
    AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
    // TODO: There is no timeout on this controller. Set one!
    HBaseRpcController controller = rpcControllerFactory.newController();
    // Close the region without updating zk state.
    ProtobufUtil.closeRegion(controller, admin, sn, hri.getRegionName());
}
Also used : HBaseRpcController(org.apache.hadoop.hbase.ipc.HBaseRpcController) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService)

Example 27 with HBaseRpcController

use of org.apache.hadoop.hbase.ipc.HBaseRpcController in project hbase by apache.

the class HBaseAdmin method stopRegionServer.

@Override
public synchronized void stopRegionServer(final String hostnamePort) throws IOException {
    String hostname = Addressing.parseHostname(hostnamePort);
    int port = Addressing.parsePort(hostnamePort);
    final AdminService.BlockingInterface admin = this.connection.getAdmin(ServerName.valueOf(hostname, port, 0));
    // TODO: There is no timeout on this controller. Set one!
    HBaseRpcController controller = rpcControllerFactory.newController();
    controller.setPriority(HConstants.HIGH_QOS);
    StopServerRequest request = RequestConverter.buildStopServerRequest("Called by admin client " + this.connection.toString());
    try {
        admin.stopServer(controller, request);
    } catch (Exception e) {
        throw ProtobufUtil.handleRemoteException(e);
    }
}
Also used : HBaseRpcController(org.apache.hadoop.hbase.ipc.HBaseRpcController) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService) StopServerRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.StopServerRequest) RestoreSnapshotException(org.apache.hadoop.hbase.snapshot.RestoreSnapshotException) SnapshotCreationException(org.apache.hadoop.hbase.snapshot.SnapshotCreationException) InterruptedIOException(java.io.InterruptedIOException) ZooKeeperConnectionException(org.apache.hadoop.hbase.ZooKeeperConnectionException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) TableNotDisabledException(org.apache.hadoop.hbase.TableNotDisabledException) TableNotFoundException(org.apache.hadoop.hbase.TableNotFoundException) HBaseSnapshotException(org.apache.hadoop.hbase.snapshot.HBaseSnapshotException) TimeoutException(java.util.concurrent.TimeoutException) NotServingRegionException(org.apache.hadoop.hbase.NotServingRegionException) ReplicationException(org.apache.hadoop.hbase.replication.ReplicationException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) UnknownRegionException(org.apache.hadoop.hbase.UnknownRegionException) FailedLogCloseException(org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException) MasterNotRunningException(org.apache.hadoop.hbase.MasterNotRunningException) TimeoutIOException(org.apache.hadoop.hbase.exceptions.TimeoutIOException) NamespaceNotFoundException(org.apache.hadoop.hbase.NamespaceNotFoundException) TableExistsException(org.apache.hadoop.hbase.TableExistsException) KeeperException(org.apache.zookeeper.KeeperException) UnknownSnapshotException(org.apache.hadoop.hbase.snapshot.UnknownSnapshotException) RemoteException(org.apache.hadoop.ipc.RemoteException) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)

Example 28 with HBaseRpcController

use of org.apache.hadoop.hbase.ipc.HBaseRpcController in project hbase by apache.

the class HBaseAdmin method getCompactionStateForRegion.

@Override
public CompactionState getCompactionStateForRegion(final byte[] regionName) throws IOException {
    final Pair<HRegionInfo, ServerName> regionServerPair = getRegion(regionName);
    if (regionServerPair == null) {
        throw new IllegalArgumentException("Invalid region: " + Bytes.toStringBinary(regionName));
    }
    if (regionServerPair.getSecond() == null) {
        throw new NoServerForRegionException(Bytes.toStringBinary(regionName));
    }
    ServerName sn = regionServerPair.getSecond();
    final AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
    // TODO: There is no timeout on this controller. Set one!
    HBaseRpcController controller = rpcControllerFactory.newController();
    GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(regionServerPair.getFirst().getRegionName(), true);
    GetRegionInfoResponse response;
    try {
        response = admin.getRegionInfo(controller, request);
    } catch (ServiceException e) {
        throw ProtobufUtil.handleRemoteException(e);
    }
    if (response.getCompactionState() != null) {
        return ProtobufUtil.createCompactionState(response.getCompactionState());
    }
    return null;
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) HBaseRpcController(org.apache.hadoop.hbase.ipc.HBaseRpcController) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService) GetRegionInfoRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoRequest) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) GetRegionInfoResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoResponse) ServerName(org.apache.hadoop.hbase.ServerName)

Example 29 with HBaseRpcController

use of org.apache.hadoop.hbase.ipc.HBaseRpcController in project hbase by apache.

the class HBaseAdmin method getRegionLoad.

@Override
public Map<byte[], RegionLoad> getRegionLoad(final ServerName sn, final TableName tableName) throws IOException {
    AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
    HBaseRpcController controller = rpcControllerFactory.newController();
    List<RegionLoad> regionLoads = ProtobufUtil.getRegionLoad(controller, admin, tableName);
    Map<byte[], RegionLoad> resultMap = new TreeMap<>(Bytes.BYTES_COMPARATOR);
    for (RegionLoad regionLoad : regionLoads) {
        resultMap.put(regionLoad.getName(), regionLoad);
    }
    return resultMap;
}
Also used : HBaseRpcController(org.apache.hadoop.hbase.ipc.HBaseRpcController) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService) RegionLoad(org.apache.hadoop.hbase.RegionLoad) TreeMap(java.util.TreeMap)

Example 30 with HBaseRpcController

use of org.apache.hadoop.hbase.ipc.HBaseRpcController 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)

Aggregations

HBaseRpcController (org.apache.hadoop.hbase.ipc.HBaseRpcController)32 IOException (java.io.IOException)19 AdminService (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService)16 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)12 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)10 InterruptedIOException (java.io.InterruptedIOException)9 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)6 NotServingRegionException (org.apache.hadoop.hbase.NotServingRegionException)6 ArrayList (java.util.ArrayList)5 CellScanner (org.apache.hadoop.hbase.CellScanner)5 ServerName (org.apache.hadoop.hbase.ServerName)5 Result (org.apache.hadoop.hbase.client.Result)4 RpcCallContext (org.apache.hadoop.hbase.ipc.RpcCallContext)4 OperationQuota (org.apache.hadoop.hbase.quotas.OperationQuota)4 RegionActionResult (org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.RegionActionResult)4 RemoteException (org.apache.hadoop.ipc.RemoteException)4 Callable (java.util.concurrent.Callable)3 CellScannable (org.apache.hadoop.hbase.CellScannable)3 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2