Search in sources :

Example 96 with ServiceException

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

the class MasterRpcServices method assigns.

/**
 * A 'raw' version of assign that does bulk and can skirt Master state checks if override
 * is set; i.e. assigns can be forced during Master startup or if RegionState is unclean.
 * Used by HBCK2.
 */
@Override
public MasterProtos.AssignsResponse assigns(RpcController controller, MasterProtos.AssignsRequest request) throws ServiceException {
    checkMasterProcedureExecutor();
    MasterProtos.AssignsResponse.Builder responseBuilder = MasterProtos.AssignsResponse.newBuilder();
    try {
        boolean override = request.getOverride();
        LOG.info("{} assigns, override={}", server.getClientIdAuditPrefix(), override);
        for (HBaseProtos.RegionSpecifier rs : request.getRegionList()) {
            long pid = Procedure.NO_PROC_ID;
            RegionInfo ri = getRegionInfo(rs);
            if (ri == null) {
                LOG.info("Unknown={}", rs);
            } else {
                Procedure p = this.server.getAssignmentManager().createOneAssignProcedure(ri, override);
                if (p != null) {
                    pid = this.server.getMasterProcedureExecutor().submitProcedure(p);
                }
            }
            responseBuilder.addPid(pid);
        }
        return responseBuilder.build();
    } catch (IOException ioe) {
        throw new ServiceException(ioe);
    }
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) RegionSpecifier(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier) LockProcedure(org.apache.hadoop.hbase.master.locking.LockProcedure) Procedure(org.apache.hadoop.hbase.procedure2.Procedure) ServerCrashProcedure(org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos)

Example 97 with ServiceException

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

the class MasterRpcServices method isSnapshotDone.

/**
 * Checks if the specified snapshot is done.
 * @return true if the snapshot is in file system ready to use,
 *     false if the snapshot is in the process of completing
 * @throws ServiceException wrapping UnknownSnapshotException if invalid snapshot, or
 *     a wrapped HBaseSnapshotException with progress failure reason.
 */
@Override
public IsSnapshotDoneResponse isSnapshotDone(RpcController controller, IsSnapshotDoneRequest request) throws ServiceException {
    LOG.debug("Checking to see if snapshot from request:" + ClientSnapshotDescriptionUtils.toString(request.getSnapshot()) + " is done");
    try {
        server.checkInitialized();
        IsSnapshotDoneResponse.Builder builder = IsSnapshotDoneResponse.newBuilder();
        boolean done = server.snapshotManager.isSnapshotDone(request.getSnapshot());
        builder.setDone(done);
        return builder.build();
    } catch (ForeignException e) {
        throw new ServiceException(e.getCause());
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) ForeignException(org.apache.hadoop.hbase.errorhandling.ForeignException) IsSnapshotDoneResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsSnapshotDoneResponse) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Example 98 with ServiceException

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

the class MasterRpcServices method getSecurityCapabilities.

/**
 * Returns the security capabilities in effect on the cluster
 */
@Override
public SecurityCapabilitiesResponse getSecurityCapabilities(RpcController controller, SecurityCapabilitiesRequest request) throws ServiceException {
    SecurityCapabilitiesResponse.Builder response = SecurityCapabilitiesResponse.newBuilder();
    try {
        server.checkInitialized();
        Set<SecurityCapabilitiesResponse.Capability> capabilities = new HashSet<>();
        // Authentication
        if (User.isHBaseSecurityEnabled(server.getConfiguration())) {
            capabilities.add(SecurityCapabilitiesResponse.Capability.SECURE_AUTHENTICATION);
        } else {
            capabilities.add(SecurityCapabilitiesResponse.Capability.SIMPLE_AUTHENTICATION);
        }
        // CELL_AUTHORIZATION
        if (server.cpHost != null && hasAccessControlServiceCoprocessor(server.cpHost)) {
            if (AccessChecker.isAuthorizationSupported(server.getConfiguration())) {
                capabilities.add(SecurityCapabilitiesResponse.Capability.AUTHORIZATION);
            }
            if (AccessController.isCellAuthorizationSupported(server.getConfiguration())) {
                capabilities.add(SecurityCapabilitiesResponse.Capability.CELL_AUTHORIZATION);
            }
        }
        // A coprocessor that implements VisibilityLabelsService can provide CELL_VISIBILITY.
        if (server.cpHost != null && hasVisibilityLabelsServiceCoprocessor(server.cpHost)) {
            if (VisibilityController.isCellAuthorizationSupported(server.getConfiguration())) {
                capabilities.add(SecurityCapabilitiesResponse.Capability.CELL_VISIBILITY);
            }
        }
        response.addAllCapabilities(capabilities);
    } catch (IOException e) {
        throw new ServiceException(e);
    }
    return response.build();
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) SecurityCapabilitiesResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.SecurityCapabilitiesResponse) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HashSet(java.util.HashSet)

Example 99 with ServiceException

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

the class MasterRpcServices method regionServerReport.

@Override
public RegionServerReportResponse regionServerReport(RpcController controller, RegionServerReportRequest request) throws ServiceException {
    try {
        server.checkServiceStarted();
        int versionNumber = 0;
        String version = "0.0.0";
        VersionInfo versionInfo = VersionInfoUtil.getCurrentClientVersionInfo();
        if (versionInfo != null) {
            version = versionInfo.getVersion();
            versionNumber = VersionInfoUtil.getVersionNumber(versionInfo);
        }
        ClusterStatusProtos.ServerLoad sl = request.getLoad();
        ServerName serverName = ProtobufUtil.toServerName(request.getServer());
        ServerMetrics oldLoad = server.getServerManager().getLoad(serverName);
        ServerMetrics newLoad = ServerMetricsBuilder.toServerMetrics(serverName, versionNumber, version, sl);
        server.getServerManager().regionServerReport(serverName, newLoad);
        server.getAssignmentManager().reportOnlineRegions(serverName, newLoad.getRegionMetrics().keySet());
        if (sl != null && server.metricsMaster != null) {
            // Up our metrics.
            server.metricsMaster.incrementRequests(sl.getTotalNumberOfRequests() - (oldLoad != null ? oldLoad.getRequestCount() : 0));
            server.metricsMaster.incrementReadRequests(sl.getReadRequestsCount() - (oldLoad != null ? oldLoad.getReadRequestsCount() : 0));
            server.metricsMaster.incrementWriteRequests(sl.getWriteRequestsCount() - (oldLoad != null ? oldLoad.getWriteRequestsCount() : 0));
        }
    } catch (IOException ioe) {
        throw new ServiceException(ioe);
    }
    return RegionServerReportResponse.newBuilder().build();
}
Also used : VersionInfo(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo) ClusterStatusProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) ServerName(org.apache.hadoop.hbase.ServerName) ServerMetrics(org.apache.hadoop.hbase.ServerMetrics) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Example 100 with ServiceException

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

the class MasterRpcServices method getQuotaStates.

@Override
public GetQuotaStatesResponse getQuotaStates(RpcController controller, GetQuotaStatesRequest request) throws ServiceException {
    try {
        server.checkInitialized();
        QuotaObserverChore quotaChore = this.server.getQuotaObserverChore();
        GetQuotaStatesResponse.Builder builder = GetQuotaStatesResponse.newBuilder();
        if (quotaChore != null) {
            // The "current" view of all tables with quotas
            Map<TableName, SpaceQuotaSnapshot> tableSnapshots = quotaChore.getTableQuotaSnapshots();
            for (Entry<TableName, SpaceQuotaSnapshot> entry : tableSnapshots.entrySet()) {
                builder.addTableSnapshots(TableQuotaSnapshot.newBuilder().setTableName(ProtobufUtil.toProtoTableName(entry.getKey())).setSnapshot(SpaceQuotaSnapshot.toProtoSnapshot(entry.getValue())).build());
            }
            // The "current" view of all namespaces with quotas
            Map<String, SpaceQuotaSnapshot> nsSnapshots = quotaChore.getNamespaceQuotaSnapshots();
            for (Entry<String, SpaceQuotaSnapshot> entry : nsSnapshots.entrySet()) {
                builder.addNsSnapshots(NamespaceQuotaSnapshot.newBuilder().setNamespace(entry.getKey()).setSnapshot(SpaceQuotaSnapshot.toProtoSnapshot(entry.getValue())).build());
            }
            return builder.build();
        }
        return builder.build();
    } catch (Exception e) {
        throw new ServiceException(e);
    }
}
Also used : SpaceQuotaSnapshot(org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot) TableName(org.apache.hadoop.hbase.TableName) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) QuotaObserverChore(org.apache.hadoop.hbase.quotas.QuotaObserverChore) GetQuotaStatesResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.GetQuotaStatesResponse) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ReplicationException(org.apache.hadoop.hbase.replication.ReplicationException) ServerNotRunningYetException(org.apache.hadoop.hbase.ipc.ServerNotRunningYetException) UnknownProtocolException(org.apache.hadoop.hbase.exceptions.UnknownProtocolException) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) ForeignException(org.apache.hadoop.hbase.errorhandling.ForeignException) IOException(java.io.IOException) RemoteProcedureException(org.apache.hadoop.hbase.procedure2.RemoteProcedureException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) UnknownRegionException(org.apache.hadoop.hbase.UnknownRegionException) KeeperException(org.apache.zookeeper.KeeperException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)130 IOException (java.io.IOException)112 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)100 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)39 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)28 UncheckedIOException (java.io.UncheckedIOException)27 TableName (org.apache.hadoop.hbase.TableName)22 QosPriority (org.apache.hadoop.hbase.ipc.QosPriority)22 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)19 UnknownRegionException (org.apache.hadoop.hbase.UnknownRegionException)16 UnknownProtocolException (org.apache.hadoop.hbase.exceptions.UnknownProtocolException)16 Test (org.junit.Test)16 InvocationTargetException (java.lang.reflect.InvocationTargetException)15 ArrayList (java.util.ArrayList)15 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)15 ForeignException (org.apache.hadoop.hbase.errorhandling.ForeignException)15 ServerNotRunningYetException (org.apache.hadoop.hbase.ipc.ServerNotRunningYetException)15 KeeperException (org.apache.zookeeper.KeeperException)14 Table (org.apache.hadoop.hbase.client.Table)13 User (org.apache.hadoop.hbase.security.User)13