Search in sources :

Example 1 with ClearCompactionQueuesResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearCompactionQueuesResponse in project hbase by apache.

the class RSRpcServices method clearCompactionQueues.

@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public ClearCompactionQueuesResponse clearCompactionQueues(RpcController controller, ClearCompactionQueuesRequest request) throws ServiceException {
    LOG.debug("Client=" + RpcServer.getRequestUserName().orElse(null) + "/" + RpcServer.getRemoteAddress().orElse(null) + " clear compactions queue");
    ClearCompactionQueuesResponse.Builder respBuilder = ClearCompactionQueuesResponse.newBuilder();
    requestCount.increment();
    if (clearCompactionQueues.compareAndSet(false, true)) {
        final CompactSplit compactSplitThread = server.getCompactSplitThread();
        try {
            checkOpen();
            server.getRegionServerCoprocessorHost().preClearCompactionQueues();
            for (String queueName : request.getQueueNameList()) {
                LOG.debug("clear " + queueName + " compaction queue");
                switch(queueName) {
                    case "long":
                        compactSplitThread.clearLongCompactionsQueue();
                        break;
                    case "short":
                        compactSplitThread.clearShortCompactionsQueue();
                        break;
                    default:
                        LOG.warn("Unknown queue name " + queueName);
                        throw new IOException("Unknown queue name " + queueName);
                }
            }
            server.getRegionServerCoprocessorHost().postClearCompactionQueues();
        } catch (IOException ie) {
            throw new ServiceException(ie);
        } finally {
            clearCompactionQueues.set(false);
        }
    } else {
        LOG.warn("Clear compactions queue is executing by other admin.");
    }
    return respBuilder.build();
}
Also used : ServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) HBaseIOException(org.apache.hadoop.hbase.HBaseIOException) UncheckedIOException(java.io.UncheckedIOException) ClearCompactionQueuesResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearCompactionQueuesResponse) QosPriority(org.apache.hadoop.hbase.ipc.QosPriority)

Aggregations

IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)1 QosPriority (org.apache.hadoop.hbase.ipc.QosPriority)1 ClearCompactionQueuesResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ClearCompactionQueuesResponse)1 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)1 ServiceException (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException)1