Search in sources :

Example 1 with OpenRegionRequest

use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.OpenRegionRequest 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 2 with OpenRegionRequest

use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.OpenRegionRequest 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)

Aggregations

IOException (java.io.IOException)2 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)2 AdminService (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService)2 OpenRegionRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.OpenRegionRequest)2 OpenRegionResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.OpenRegionResponse)2