Search in sources :

Example 1 with RegionStateTransition

use of org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition in project hbase by apache.

the class MasterRpcServices method reportRegionStateTransition.

@Override
public ReportRegionStateTransitionResponse reportRegionStateTransition(RpcController c, ReportRegionStateTransitionRequest req) throws ServiceException {
    try {
        master.checkServiceStarted();
        RegionStateTransition rt = req.getTransition(0);
        RegionStates regionStates = master.getAssignmentManager().getRegionStates();
        for (RegionInfo ri : rt.getRegionInfoList()) {
            TableName tableName = ProtobufUtil.toTableName(ri.getTableName());
            if (!(TableName.META_TABLE_NAME.equals(tableName) && regionStates.getRegionState(HRegionInfo.FIRST_META_REGIONINFO) != null) && !master.getAssignmentManager().isFailoverCleanupDone()) {
                // failover cleanup. So no need this check for it
                throw new PleaseHoldException("Master is rebuilding user regions");
            }
        }
        ServerName sn = ProtobufUtil.toServerName(req.getServer());
        String error = master.getAssignmentManager().onRegionTransition(sn, rt);
        ReportRegionStateTransitionResponse.Builder rrtr = ReportRegionStateTransitionResponse.newBuilder();
        if (error != null) {
            rrtr.setErrorMessage(error);
        }
        return rrtr.build();
    } catch (IOException ioe) {
        throw new ServiceException(ioe);
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) PleaseHoldException(org.apache.hadoop.hbase.PleaseHoldException) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) ServerName(org.apache.hadoop.hbase.ServerName) RegionInfo(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionInfo) HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) RegionStateTransition(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition) ReportRegionStateTransitionResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionResponse)

Aggregations

IOException (java.io.IOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)1 PleaseHoldException (org.apache.hadoop.hbase.PleaseHoldException)1 ServerName (org.apache.hadoop.hbase.ServerName)1 TableName (org.apache.hadoop.hbase.TableName)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 RegionInfo (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionInfo)1 RegionStateTransition (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition)1 ReportRegionStateTransitionResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionResponse)1