Search in sources :

Example 1 with NamedQueueRecorder

use of org.apache.hadoop.hbase.namequeues.NamedQueueRecorder in project hbase by apache.

the class HBaseRpcServicesBase method getLogEntries.

@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public HBaseProtos.LogEntry getLogEntries(RpcController controller, HBaseProtos.LogRequest request) throws ServiceException {
    try {
        final String logClassName = request.getLogClassName();
        Class<?> logClass = Class.forName(logClassName).asSubclass(Message.class);
        Method method = logClass.getMethod("parseFrom", ByteString.class);
        if (logClassName.contains("SlowLogResponseRequest")) {
            SlowLogResponseRequest slowLogResponseRequest = (SlowLogResponseRequest) method.invoke(null, request.getLogMessage());
            final NamedQueueRecorder namedQueueRecorder = this.server.getNamedQueueRecorder();
            final List<SlowLogPayload> slowLogPayloads = getSlowLogPayloads(slowLogResponseRequest, namedQueueRecorder);
            SlowLogResponses slowLogResponses = SlowLogResponses.newBuilder().addAllSlowLogPayloads(slowLogPayloads).build();
            return HBaseProtos.LogEntry.newBuilder().setLogClassName(slowLogResponses.getClass().getName()).setLogMessage(slowLogResponses.toByteString()).build();
        }
    } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
        LOG.error("Error while retrieving log entries.", e);
        throw new ServiceException(e);
    }
    throw new ServiceException("Invalid request params");
}
Also used : SlowLogPayload(org.apache.hadoop.hbase.shaded.protobuf.generated.TooSlowLog.SlowLogPayload) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) NamedQueueRecorder(org.apache.hadoop.hbase.namequeues.NamedQueueRecorder) SlowLogResponseRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponseRequest) ClearSlowLogResponseRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponseRequest) ClearSlowLogResponses(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponses) SlowLogResponses(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponses) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

Example 2 with NamedQueueRecorder

use of org.apache.hadoop.hbase.namequeues.NamedQueueRecorder in project hbase by apache.

the class HBaseRpcServicesBase method clearSlowLogsResponses.

@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public ClearSlowLogResponses clearSlowLogsResponses(final RpcController controller, final ClearSlowLogResponseRequest request) throws ServiceException {
    try {
        requirePermission("clearSlowLogsResponses", Permission.Action.ADMIN);
    } catch (IOException e) {
        throw new ServiceException(e);
    }
    final NamedQueueRecorder namedQueueRecorder = this.server.getNamedQueueRecorder();
    boolean slowLogsCleaned = Optional.ofNullable(namedQueueRecorder).map(queueRecorder -> queueRecorder.clearNamedQueue(NamedQueuePayload.NamedQueueEvent.SLOW_LOG)).orElse(false);
    ClearSlowLogResponses clearSlowLogResponses = ClearSlowLogResponses.newBuilder().setIsCleaned(slowLogsCleaned).build();
    return clearSlowLogResponses;
}
Also used : NamedQueueRecorder(org.apache.hadoop.hbase.namequeues.NamedQueueRecorder) GetMastersRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMastersRequest) SlowLogPayload(org.apache.hadoop.hbase.shaded.protobuf.generated.TooSlowLog.SlowLogPayload) RequestHeader(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.RequestHeader) LoggerFactory(org.slf4j.LoggerFactory) RpcSchedulerFactory(org.apache.hadoop.hbase.regionserver.RpcSchedulerFactory) Message(org.apache.hbase.thirdparty.com.google.protobuf.Message) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) NamedQueueGetResponse(org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse) NamedQueueRecorder(org.apache.hadoop.hbase.namequeues.NamedQueueRecorder) Configuration(org.apache.hadoop.conf.Configuration) PriorityFunction(org.apache.hadoop.hbase.ipc.PriorityFunction) Method(java.lang.reflect.Method) Address(org.apache.hadoop.hbase.net.Address) NoopAccessChecker(org.apache.hadoop.hbase.security.access.NoopAccessChecker) ProtobufUtil(org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil) RpcLogDetails(org.apache.hadoop.hbase.namequeues.RpcLogDetails) ZKPermissionWatcher(org.apache.hadoop.hbase.security.access.ZKPermissionWatcher) GetBootstrapNodesRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetBootstrapNodesRequest) ZKWatcher(org.apache.hadoop.hbase.zookeeper.ZKWatcher) SlowLogResponseRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponseRequest) GetMetaRegionLocationsRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMetaRegionLocationsRequest) InetSocketAddress(java.net.InetSocketAddress) GetMetaRegionLocationsResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMetaRegionLocationsResponse) InvocationTargetException(java.lang.reflect.InvocationTargetException) List(java.util.List) ConfigurationObserver(org.apache.hadoop.hbase.conf.ConfigurationObserver) RpcServerInterface(org.apache.hadoop.hbase.ipc.RpcServerInterface) UpdateConfigurationResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.UpdateConfigurationResponse) Optional(java.util.Optional) ClearSlowLogResponseRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponseRequest) GetActiveMasterResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetActiveMasterResponse) HBaseRPCErrorHandler(org.apache.hadoop.hbase.ipc.HBaseRPCErrorHandler) Permission(org.apache.hadoop.hbase.security.access.Permission) DNS(org.apache.hadoop.hbase.util.DNS) ByteBuffAllocator(org.apache.hadoop.hbase.io.ByteBuffAllocator) ReservoirSample(org.apache.hadoop.hbase.util.ReservoirSample) NamedQueueGetRequest(org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest) ConnectionUtils(org.apache.hadoop.hbase.client.ConnectionUtils) RpcController(org.apache.hbase.thirdparty.com.google.protobuf.RpcController) GetMastersResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMastersResponse) BindException(java.net.BindException) User(org.apache.hadoop.hbase.security.User) ClearSlowLogResponses(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponses) UpdateConfigurationRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.UpdateConfigurationRequest) GetBootstrapNodesResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetBootstrapNodesResponse) GetClusterIdResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetClusterIdResponse) NamedQueuePayload(org.apache.hadoop.hbase.namequeues.NamedQueuePayload) GetMastersResponseEntry(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMastersResponseEntry) RpcServer(org.apache.hadoop.hbase.ipc.RpcServer) SlowLogResponses(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponses) Logger(org.slf4j.Logger) HBaseProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos) KeeperException(org.apache.zookeeper.KeeperException) GetClusterIdRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetClusterIdRequest) AdminService(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService) GetActiveMasterRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetActiveMasterRequest) IOException(java.io.IOException) ClientMetaService(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService) RpcServerFactory(org.apache.hadoop.hbase.ipc.RpcServerFactory) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority) OOMEChecker(org.apache.hadoop.hbase.util.OOMEChecker) InterfaceAudience(org.apache.yetus.audience.InterfaceAudience) BlockingServiceAndInterface(org.apache.hadoop.hbase.ipc.RpcServer.BlockingServiceAndInterface) AccessChecker(org.apache.hadoop.hbase.security.access.AccessChecker) RpcScheduler(org.apache.hadoop.hbase.ipc.RpcScheduler) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) Collections(java.util.Collections) ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) IOException(java.io.IOException) ClearSlowLogResponses(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponses) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

Example 3 with NamedQueueRecorder

use of org.apache.hadoop.hbase.namequeues.NamedQueueRecorder in project hbase by apache.

the class MasterRpcServices method getBalancerDecisions.

private MasterProtos.BalancerDecisionsResponse getBalancerDecisions(MasterProtos.BalancerDecisionsRequest request) {
    final NamedQueueRecorder namedQueueRecorder = this.server.getNamedQueueRecorder();
    if (namedQueueRecorder == null) {
        return MasterProtos.BalancerDecisionsResponse.newBuilder().addAllBalancerDecision(Collections.emptyList()).build();
    }
    final NamedQueueGetRequest namedQueueGetRequest = new NamedQueueGetRequest();
    namedQueueGetRequest.setNamedQueueEvent(BalancerDecisionDetails.BALANCER_DECISION_EVENT);
    namedQueueGetRequest.setBalancerDecisionsRequest(request);
    NamedQueueGetResponse namedQueueGetResponse = namedQueueRecorder.getNamedQueueRecords(namedQueueGetRequest);
    List<RecentLogs.BalancerDecision> balancerDecisions = namedQueueGetResponse != null ? namedQueueGetResponse.getBalancerDecisions() : Collections.emptyList();
    return MasterProtos.BalancerDecisionsResponse.newBuilder().addAllBalancerDecision(balancerDecisions).build();
}
Also used : NamedQueueRecorder(org.apache.hadoop.hbase.namequeues.NamedQueueRecorder) NamedQueueGetResponse(org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse) NamedQueueGetRequest(org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest)

Example 4 with NamedQueueRecorder

use of org.apache.hadoop.hbase.namequeues.NamedQueueRecorder in project hbase by apache.

the class MasterRpcServices method getBalancerRejections.

private MasterProtos.BalancerRejectionsResponse getBalancerRejections(MasterProtos.BalancerRejectionsRequest request) {
    final NamedQueueRecorder namedQueueRecorder = this.server.getNamedQueueRecorder();
    if (namedQueueRecorder == null) {
        return MasterProtos.BalancerRejectionsResponse.newBuilder().addAllBalancerRejection(Collections.emptyList()).build();
    }
    final NamedQueueGetRequest namedQueueGetRequest = new NamedQueueGetRequest();
    namedQueueGetRequest.setNamedQueueEvent(BalancerRejectionDetails.BALANCER_REJECTION_EVENT);
    namedQueueGetRequest.setBalancerRejectionsRequest(request);
    NamedQueueGetResponse namedQueueGetResponse = namedQueueRecorder.getNamedQueueRecords(namedQueueGetRequest);
    List<RecentLogs.BalancerRejection> balancerRejections = namedQueueGetResponse != null ? namedQueueGetResponse.getBalancerRejections() : Collections.emptyList();
    return MasterProtos.BalancerRejectionsResponse.newBuilder().addAllBalancerRejection(balancerRejections).build();
}
Also used : NamedQueueRecorder(org.apache.hadoop.hbase.namequeues.NamedQueueRecorder) NamedQueueGetResponse(org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse) NamedQueueGetRequest(org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest)

Aggregations

NamedQueueRecorder (org.apache.hadoop.hbase.namequeues.NamedQueueRecorder)4 NamedQueueGetRequest (org.apache.hadoop.hbase.namequeues.request.NamedQueueGetRequest)3 NamedQueueGetResponse (org.apache.hadoop.hbase.namequeues.response.NamedQueueGetResponse)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 QosPriority (org.apache.hadoop.hbase.ipc.QosPriority)2 ClearSlowLogResponseRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponseRequest)2 ClearSlowLogResponses (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearSlowLogResponses)2 SlowLogResponseRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponseRequest)2 SlowLogResponses (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.SlowLogResponses)2 IOException (java.io.IOException)1 BindException (java.net.BindException)1 InetSocketAddress (java.net.InetSocketAddress)1 Collections (java.util.Collections)1 List (java.util.List)1 Optional (java.util.Optional)1 Configuration (org.apache.hadoop.conf.Configuration)1 ConnectionUtils (org.apache.hadoop.hbase.client.ConnectionUtils)1 ConfigurationObserver (org.apache.hadoop.hbase.conf.ConfigurationObserver)1 ByteBuffAllocator (org.apache.hadoop.hbase.io.ByteBuffAllocator)1