You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2021/04/30 03:18:45 UTC
[accumulo] branch 1451-external-compactions-feature updated: Makes
listcompactions work w/ external compactions
This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch 1451-external-compactions-feature
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/1451-external-compactions-feature by this push:
new 01ab70d Makes listcompactions work w/ external compactions
01ab70d is described below
commit 01ab70d3a75bf401f3f0d33159f7bd907830aa92
Author: Keith Turner <kt...@apache.org>
AuthorDate: Thu Apr 29 22:47:26 2021 -0400
Makes listcompactions work w/ external compactions
---
.../core/client/admin/ActiveCompaction.java | 22 +
.../core/client/admin/InstanceOperations.java | 15 +-
.../core/clientImpl/ActiveCompactionImpl.java | 29 +-
.../core/clientImpl/InstanceOperationsImpl.java | 53 +-
.../util}/compaction/ExternalCompactionUtil.java | 51 +-
.../accumulo/core/compaction/thrift/Compactor.java | 1173 ++++++++++++++++++++
core/src/main/thrift/compaction-coordinator.thrift | 6 +
.../coordinator/CompactionCoordinator.java | 2 +-
.../coordinator/DeadCompactionDetector.java | 2 +-
.../coordinator/CompactionCoordinatorTest.java | 2 +-
.../org/apache/accumulo/compactor/Compactor.java | 22 +-
.../shell/commands/ActiveCompactionHelper.java | 84 +-
.../shell/commands/ListCompactionsCommand.java | 14 +-
13 files changed, 1412 insertions(+), 63 deletions(-)
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveCompaction.java b/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveCompaction.java
index 5a404e1..4506692 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveCompaction.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveCompaction.java
@@ -128,4 +128,26 @@ public abstract class ActiveCompaction {
* @return the per compaction iterators configured
*/
public abstract List<IteratorSetting> getIterators();
+
+ /**
+ * @since 2.1.0
+ */
+ public interface CompactionHost {
+ enum Type {
+ TSERVER, COMPACTOR
+ }
+
+ Type getType();
+
+ String getAddress();
+
+ int getPort();
+ }
+
+ /**
+ * Return the host where the compaction is running.
+ *
+ * @since 2.1.0
+ */
+ public abstract CompactionHost getHost();
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
index 45e7ae4..6bb40ed 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
@@ -102,7 +102,10 @@ public interface InstanceOperations {
throws AccumuloException, AccumuloSecurityException;
/**
- * List the active compaction running on a tablet server
+ * List the active compaction running on a tablet server. Using this method with
+ * {@link #getTabletServers()} will only show compactions running on tservers, leaving out any
+ * external compactions running on compactors. Use {@link #getActiveCompactions()} to get a list
+ * of all compactions running on tservers and compactors.
*
* @param tserver
* The tablet server address should be of the form {@code <ip address>:<port>}
@@ -113,6 +116,16 @@ public interface InstanceOperations {
throws AccumuloException, AccumuloSecurityException;
/**
+ * List all compactions running in Accumulo
+ *
+ * @return the list of active compactions
+ * @throws AccumuloSecurityException
+ * @throws AccumuloException
+ * @since 2.1.0
+ */
+ List<ActiveCompaction> getActiveCompactions() throws AccumuloException, AccumuloSecurityException;
+
+ /**
* Throws an exception if a tablet server can not be contacted.
*
* @param tserver
diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/ActiveCompactionImpl.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/ActiveCompactionImpl.java
index 380e91b..729034e 100644
--- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ActiveCompactionImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ActiveCompactionImpl.java
@@ -25,10 +25,12 @@ import java.util.Map;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.ActiveCompaction;
+import org.apache.accumulo.core.client.admin.ActiveCompaction.CompactionHost.Type;
import org.apache.accumulo.core.data.TabletId;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.dataImpl.TabletIdImpl;
import org.apache.accumulo.core.dataImpl.thrift.IterInfo;
+import org.apache.accumulo.core.util.HostAndPort;
/**
* @since 1.6.0
@@ -37,11 +39,16 @@ public class ActiveCompactionImpl extends ActiveCompaction {
private org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction tac;
private ClientContext context;
+ private HostAndPort hostport;
+ private Type type;
ActiveCompactionImpl(ClientContext context,
- org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction tac) {
+ org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction tac, HostAndPort hostport,
+ CompactionHost.Type type) {
this.tac = tac;
this.context = context;
+ this.hostport = hostport;
+ this.type = type;
}
@Override
@@ -109,4 +116,24 @@ public class ActiveCompactionImpl extends ActiveCompaction {
return ret;
}
+
+ @Override
+ public CompactionHost getHost() {
+ return new CompactionHost() {
+ @Override
+ public Type getType() {
+ return type;
+ }
+
+ @Override
+ public String getAddress() {
+ return hostport.getHost();
+ }
+
+ @Override
+ public int getPort() {
+ return hostport.getPort();
+ }
+ };
+ }
}
diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
index 1ec0005..85ee2f2 100644
--- a/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
@@ -30,12 +30,16 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.stream.Collectors;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.ActiveCompaction;
+import org.apache.accumulo.core.client.admin.ActiveCompaction.CompactionHost;
import org.apache.accumulo.core.client.admin.ActiveScan;
import org.apache.accumulo.core.client.admin.InstanceOperations;
import org.apache.accumulo.core.clientImpl.thrift.ConfigurationType;
@@ -47,6 +51,8 @@ import org.apache.accumulo.core.util.AddressUtil;
import org.apache.accumulo.core.util.HostAndPort;
import org.apache.accumulo.core.util.LocalityGroupUtil;
import org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
+import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
+import org.apache.accumulo.core.util.threads.ThreadPools;
import org.apache.accumulo.fate.zookeeper.ZooCache;
import org.apache.thrift.TException;
import org.apache.thrift.transport.TTransport;
@@ -191,7 +197,7 @@ public class InstanceOperationsImpl implements InstanceOperations {
List<ActiveCompaction> as = new ArrayList<>();
for (var tac : client.getActiveCompactions(TraceUtil.traceInfo(), context.rpcCreds())) {
- as.add(new ActiveCompactionImpl(context, tac));
+ as.add(new ActiveCompactionImpl(context, tac, parsedTserver, CompactionHost.Type.TSERVER));
}
return as;
} catch (ThriftSecurityException e) {
@@ -205,6 +211,51 @@ public class InstanceOperationsImpl implements InstanceOperations {
}
@Override
+ public List<ActiveCompaction> getActiveCompactions()
+ throws AccumuloException, AccumuloSecurityException {
+
+ List<HostAndPort> compactors = ExternalCompactionUtil.getCompactorAddrs(context);
+ List<String> tservers = getTabletServers();
+
+ int numThreads = Math.max(4, Math.min((tservers.size() + compactors.size()) / 10, 256));
+ var executorService =
+ ThreadPools.createFixedThreadPool(numThreads, "getactivecompactions", false);
+ try {
+ List<Future<List<ActiveCompaction>>> futures = new ArrayList<>();
+
+ for (String tserver : tservers) {
+ futures.add(executorService.submit(() -> getActiveCompactions(tserver)));
+ }
+
+ for (HostAndPort compactorAddr : compactors) {
+ futures
+ .add(
+ executorService
+ .submit(
+ () -> ExternalCompactionUtil.getActiveCompaction(compactorAddr, context)
+ .stream().map(tac -> new ActiveCompactionImpl(context, tac,
+ compactorAddr, CompactionHost.Type.COMPACTOR))
+ .collect(Collectors.toList())));
+ }
+
+ List<ActiveCompaction> ret = new ArrayList<>();
+ for (Future<List<ActiveCompaction>> future : futures) {
+ try {
+ ret.addAll(future.get());
+ } catch (InterruptedException | ExecutionException e) {
+ // CBUG attempt to detect securit exception and throw AccumuloSecurityException
+ throw new AccumuloException(e);
+ }
+ }
+
+ return ret;
+
+ } finally {
+ executorService.shutdown();
+ }
+ }
+
+ @Override
public void ping(String tserver) throws AccumuloException {
try (
TTransport transport = createTransport(AddressUtil.parseAddress(tserver, false), context)) {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/compaction/ExternalCompactionUtil.java b/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
similarity index 80%
rename from server/base/src/main/java/org/apache/accumulo/server/compaction/ExternalCompactionUtil.java
rename to core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
index 26ff813..0c5d45b 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/compaction/ExternalCompactionUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.accumulo.server.compaction;
+package org.apache.accumulo.core.util.compaction;
import java.util.ArrayList;
import java.util.Collection;
@@ -29,16 +29,19 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.clientImpl.ClientContext;
import org.apache.accumulo.core.compaction.thrift.Compactor;
import org.apache.accumulo.core.metadata.schema.ExternalCompactionId;
import org.apache.accumulo.core.rpc.ThriftUtil;
+import org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction;
import org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.HostAndPort;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.threads.ThreadPools;
import org.apache.accumulo.fate.zookeeper.ServiceLock;
-import org.apache.accumulo.server.ServerContext;
+import org.apache.accumulo.fate.zookeeper.ZooReader;
+import org.apache.accumulo.fate.zookeeper.ZooSession;
import org.apache.thrift.TException;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.KeeperException.NoNodeException;
@@ -67,11 +70,12 @@ public class ExternalCompactionUtil {
*
* @return null if Coordinator node not found, else HostAndPort
*/
- public static HostAndPort findCompactionCoordinator(ServerContext context) {
+ public static HostAndPort findCompactionCoordinator(ClientContext context) {
final String lockPath = context.getZooKeeperRoot() + Constants.ZCOORDINATOR_LOCK;
try {
- byte[] address = ServiceLock.getLockData(context.getZooReaderWriter().getZooKeeper(),
- ServiceLock.path(lockPath));
+ var zk = ZooSession.getAnonymousSession(context.getZooKeepers(),
+ context.getZooKeepersSessionTimeOut());
+ byte[] address = ServiceLock.getLockData(zk, ServiceLock.path(lockPath));
if (null == address) {
return null;
}
@@ -85,20 +89,21 @@ public class ExternalCompactionUtil {
/**
* @return list of Compactors
*/
- public static List<HostAndPort> getCompactorAddrs(ServerContext context) {
+ public static List<HostAndPort> getCompactorAddrs(ClientContext context) {
try {
final List<HostAndPort> compactAddrs = new ArrayList<>();
final String compactorQueuesPath = context.getZooKeeperRoot() + Constants.ZCOMPACTORS;
- List<String> queues = context.getZooReaderWriter().getChildren(compactorQueuesPath);
+ ZooReader zooReader =
+ new ZooReader(context.getZooKeepers(), context.getZooKeepersSessionTimeOut());
+ List<String> queues = zooReader.getChildren(compactorQueuesPath);
for (String queue : queues) {
try {
- List<String> compactors =
- context.getZooReaderWriter().getChildren(compactorQueuesPath + "/" + queue);
+ List<String> compactors = zooReader.getChildren(compactorQueuesPath + "/" + queue);
for (String compactor : compactors) {
// compactor is the address, we are checking to see if there is a child node which
// represents the compactor's lock as a check that it's alive.
- List<String> children = context.getZooReaderWriter()
- .getChildren(compactorQueuesPath + "/" + queue + "/" + compactor);
+ List<String> children =
+ zooReader.getChildren(compactorQueuesPath + "/" + queue + "/" + compactor);
if (!children.isEmpty()) {
LOG.debug("Found live compactor {} ", compactor);
compactAddrs.add(HostAndPort.fromString(compactor));
@@ -119,6 +124,22 @@ public class ExternalCompactionUtil {
}
}
+ public static List<ActiveCompaction> getActiveCompaction(HostAndPort compactor,
+ ClientContext context) {
+ Compactor.Client client = null;
+ try {
+ // CBUG should this retry?
+ client = ThriftUtil.getClient(new Compactor.Client.Factory(), compactor, context);
+ return client.getActiveCompactions(TraceUtil.traceInfo(), context.rpcCreds());
+ } catch (TException e) {
+ // CBUG maybe pass up security exception
+ LOG.debug("Failed to contact compactor {}", compactor, e);
+ } finally {
+ ThriftUtil.returnClient(client);
+ }
+ return List.of();
+ }
+
/**
* Get the compaction currently running on the Compactor
*
@@ -129,7 +150,7 @@ public class ExternalCompactionUtil {
* @return external compaction job or null if none running
*/
public static TExternalCompactionJob getRunningCompaction(HostAndPort compactorAddr,
- ServerContext context) {
+ ClientContext context) {
Compactor.Client client = null;
try {
@@ -150,7 +171,7 @@ public class ExternalCompactionUtil {
}
private static ExternalCompactionId getRunningCompactionId(HostAndPort compactorAddr,
- ServerContext context) {
+ ClientContext context) {
Compactor.Client client = null;
try {
// CBUG should this retry?
@@ -173,7 +194,7 @@ public class ExternalCompactionUtil {
* @return map of compactor and external compaction jobs
*/
public static Map<HostAndPort,TExternalCompactionJob>
- getCompactionsRunningOnCompactors(ServerContext context) {
+ getCompactionsRunningOnCompactors(ClientContext context) {
final List<Pair<HostAndPort,Future<TExternalCompactionJob>>> running = new ArrayList<>();
final ExecutorService executor =
@@ -202,7 +223,7 @@ public class ExternalCompactionUtil {
}
public static Collection<ExternalCompactionId>
- getCompactionIdsRunningOnCompactors(ServerContext context) {
+ getCompactionIdsRunningOnCompactors(ClientContext context) {
final ExecutorService executor =
ThreadPools.createFixedThreadPool(16, "CompactorRunningCompactions", false);
diff --git a/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/Compactor.java b/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/Compactor.java
index 6520e71..a9f7f8b 100644
--- a/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/Compactor.java
+++ b/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/Compactor.java
@@ -35,6 +35,8 @@ public class Compactor {
public java.lang.String getRunningCompactionId(org.apache.accumulo.core.trace.thrift.TInfo tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials) throws org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException, org.apache.thrift.TException;
+ public java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> getActiveCompactions(org.apache.accumulo.core.trace.thrift.TInfo tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials) throws org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException, org.apache.thrift.TException;
+
}
public interface AsyncIface {
@@ -45,6 +47,8 @@ public class Compactor {
public void getRunningCompactionId(org.apache.accumulo.core.trace.thrift.TInfo tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException;
+ public void getActiveCompactions(org.apache.accumulo.core.trace.thrift.TInfo tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>> resultHandler) throws org.apache.thrift.TException;
+
}
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
@@ -146,6 +150,33 @@ public class Compactor {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getRunningCompactionId failed: unknown result");
}
+ public java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> getActiveCompactions(org.apache.accumulo.core.trace.thrift.TInfo tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials) throws org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException, org.apache.thrift.TException
+ {
+ send_getActiveCompactions(tinfo, credentials);
+ return recv_getActiveCompactions();
+ }
+
+ public void send_getActiveCompactions(org.apache.accumulo.core.trace.thrift.TInfo tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials) throws org.apache.thrift.TException
+ {
+ getActiveCompactions_args args = new getActiveCompactions_args();
+ args.setTinfo(tinfo);
+ args.setCredentials(credentials);
+ sendBase("getActiveCompactions", args);
+ }
+
+ public java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> recv_getActiveCompactions() throws org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException, org.apache.thrift.TException
+ {
+ getActiveCompactions_result result = new getActiveCompactions_result();
+ receiveBase(result, "getActiveCompactions");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ if (result.sec != null) {
+ throw result.sec;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getActiveCompactions failed: unknown result");
+ }
+
}
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
@@ -272,6 +303,41 @@ public class Compactor {
}
}
+ public void getActiveCompactions(org.apache.accumulo.core.trace.thrift.TInfo tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ getActiveCompactions_call method_call = new getActiveCompactions_call(tinfo, credentials, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class getActiveCompactions_call extends org.apache.thrift.async.TAsyncMethodCall<java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>> {
+ private org.apache.accumulo.core.trace.thrift.TInfo tinfo;
+ private org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials;
+ public getActiveCompactions_call(org.apache.accumulo.core.trace.thrift.TInfo tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.T [...]
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.tinfo = tinfo;
+ this.credentials = credentials;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getActiveCompactions", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ getActiveCompactions_args args = new getActiveCompactions_args();
+ args.setTinfo(tinfo);
+ args.setCredentials(credentials);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> getResult() throws org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException, org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new java.lang.IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_getActiveCompactions();
+ }
+ }
+
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
@@ -288,6 +354,7 @@ public class Compactor {
processMap.put("cancel", new cancel());
processMap.put("getRunningCompaction", new getRunningCompaction());
processMap.put("getRunningCompactionId", new getRunningCompactionId());
+ processMap.put("getActiveCompactions", new getActiveCompactions());
return processMap;
}
@@ -378,6 +445,35 @@ public class Compactor {
}
}
+ public static class getActiveCompactions<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getActiveCompactions_args> {
+ public getActiveCompactions() {
+ super("getActiveCompactions");
+ }
+
+ public getActiveCompactions_args getEmptyArgsInstance() {
+ return new getActiveCompactions_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ @Override
+ protected boolean rethrowUnhandledExceptions() {
+ return false;
+ }
+
+ public getActiveCompactions_result getResult(I iface, getActiveCompactions_args args) throws org.apache.thrift.TException {
+ getActiveCompactions_result result = new getActiveCompactions_result();
+ try {
+ result.success = iface.getActiveCompactions(args.tinfo, args.credentials);
+ } catch (org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException sec) {
+ result.sec = sec;
+ }
+ return result;
+ }
+ }
+
}
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
@@ -394,6 +490,7 @@ public class Compactor {
processMap.put("cancel", new cancel());
processMap.put("getRunningCompaction", new getRunningCompaction());
processMap.put("getRunningCompactionId", new getRunningCompactionId());
+ processMap.put("getActiveCompactions", new getActiveCompactions());
return processMap;
}
@@ -591,6 +688,71 @@ public class Compactor {
}
}
+ public static class getActiveCompactions<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getActiveCompactions_args, java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>> {
+ public getActiveCompactions() {
+ super("getActiveCompactions");
+ }
+
+ public getActiveCompactions_args getEmptyArgsInstance() {
+ return new getActiveCompactions_args();
+ }
+
+ public org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>>() {
+ public void onComplete(java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> o) {
+ getActiveCompactions_result result = new getActiveCompactions_result();
+ result.success = o;
+ try {
+ fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+ } catch (org.apache.thrift.transport.TTransportException e) {
+ _LOGGER.error("TTransportException writing to internal frame buffer", e);
+ fb.close();
+ } catch (java.lang.Exception e) {
+ _LOGGER.error("Exception writing to internal frame buffer", e);
+ onError(e);
+ }
+ }
+ public void onError(java.lang.Exception e) {
+ byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+ org.apache.thrift.TSerializable msg;
+ getActiveCompactions_result result = new getActiveCompactions_result();
+ if (e instanceof org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) {
+ result.sec = (org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) e;
+ result.setSecIsSet(true);
+ msg = result;
+ } else if (e instanceof org.apache.thrift.transport.TTransportException) {
+ _LOGGER.error("TTransportException inside handler", e);
+ fb.close();
+ return;
+ } else if (e instanceof org.apache.thrift.TApplicationException) {
+ _LOGGER.error("TApplicationException inside handler", e);
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = (org.apache.thrift.TApplicationException)e;
+ } else {
+ _LOGGER.error("Exception inside handler", e);
+ msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+ msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+ }
+ try {
+ fcall.sendResponse(fb,msg,msgType,seqid);
+ } catch (java.lang.Exception ex) {
+ _LOGGER.error("Exception writing to internal frame buffer", ex);
+ fb.close();
+ }
+ }
+ };
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public void start(I iface, getActiveCompactions_args args, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>> resultHandler) throws org.apache.thrift.TException {
+ iface.getActiveCompactions(args.tinfo, args.credentials,resultHandler);
+ }
+ }
+
}
public static class cancel_args implements org.apache.thrift.TBase<cancel_args, cancel_args._Fields>, java.io.Serializable, Cloneable, Comparable<cancel_args> {
@@ -3466,5 +3628,1016 @@ public class Compactor {
}
}
+ public static class getActiveCompactions_args implements org.apache.thrift.TBase<getActiveCompactions_args, getActiveCompactions_args._Fields>, java.io.Serializable, Cloneable, Comparable<getActiveCompactions_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getActiveCompactions_args");
+
+ private static final org.apache.thrift.protocol.TField TINFO_FIELD_DESC = new org.apache.thrift.protocol.TField("tinfo", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField CREDENTIALS_FIELD_DESC = new org.apache.thrift.protocol.TField("credentials", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getActiveCompactions_argsStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getActiveCompactions_argsTupleSchemeFactory();
+
+ public @org.apache.thrift.annotation.Nullable org.apache.accumulo.core.trace.thrift.TInfo tinfo; // required
+ public @org.apache.thrift.annotation.Nullable org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ TINFO((short)2, "tinfo"),
+ CREDENTIALS((short)1, "credentials");
+
+ private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
+
+ static {
+ for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ @org.apache.thrift.annotation.Nullable
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 2: // TINFO
+ return TINFO;
+ case 1: // CREDENTIALS
+ return CREDENTIALS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ @org.apache.thrift.annotation.Nullable
+ public static _Fields findByName(java.lang.String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final java.lang.String _fieldName;
+
+ _Fields(short thriftId, java.lang.String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public java.lang.String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.TINFO, new org.apache.thrift.meta_data.FieldMetaData("tinfo", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.accumulo.core.trace.thrift.TInfo.class)));
+ tmpMap.put(_Fields.CREDENTIALS, new org.apache.thrift.meta_data.FieldMetaData("credentials", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.accumulo.core.securityImpl.thrift.TCredentials.class)));
+ metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getActiveCompactions_args.class, metaDataMap);
+ }
+
+ public getActiveCompactions_args() {
+ }
+
+ public getActiveCompactions_args(
+ org.apache.accumulo.core.trace.thrift.TInfo tinfo,
+ org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials)
+ {
+ this();
+ this.tinfo = tinfo;
+ this.credentials = credentials;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getActiveCompactions_args(getActiveCompactions_args other) {
+ if (other.isSetTinfo()) {
+ this.tinfo = new org.apache.accumulo.core.trace.thrift.TInfo(other.tinfo);
+ }
+ if (other.isSetCredentials()) {
+ this.credentials = new org.apache.accumulo.core.securityImpl.thrift.TCredentials(other.credentials);
+ }
+ }
+
+ public getActiveCompactions_args deepCopy() {
+ return new getActiveCompactions_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.tinfo = null;
+ this.credentials = null;
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public org.apache.accumulo.core.trace.thrift.TInfo getTinfo() {
+ return this.tinfo;
+ }
+
+ public getActiveCompactions_args setTinfo(@org.apache.thrift.annotation.Nullable org.apache.accumulo.core.trace.thrift.TInfo tinfo) {
+ this.tinfo = tinfo;
+ return this;
+ }
+
+ public void unsetTinfo() {
+ this.tinfo = null;
+ }
+
+ /** Returns true if field tinfo is set (has been assigned a value) and false otherwise */
+ public boolean isSetTinfo() {
+ return this.tinfo != null;
+ }
+
+ public void setTinfoIsSet(boolean value) {
+ if (!value) {
+ this.tinfo = null;
+ }
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public org.apache.accumulo.core.securityImpl.thrift.TCredentials getCredentials() {
+ return this.credentials;
+ }
+
+ public getActiveCompactions_args setCredentials(@org.apache.thrift.annotation.Nullable org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials) {
+ this.credentials = credentials;
+ return this;
+ }
+
+ public void unsetCredentials() {
+ this.credentials = null;
+ }
+
+ /** Returns true if field credentials is set (has been assigned a value) and false otherwise */
+ public boolean isSetCredentials() {
+ return this.credentials != null;
+ }
+
+ public void setCredentialsIsSet(boolean value) {
+ if (!value) {
+ this.credentials = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
+ switch (field) {
+ case TINFO:
+ if (value == null) {
+ unsetTinfo();
+ } else {
+ setTinfo((org.apache.accumulo.core.trace.thrift.TInfo)value);
+ }
+ break;
+
+ case CREDENTIALS:
+ if (value == null) {
+ unsetCredentials();
+ } else {
+ setCredentials((org.apache.accumulo.core.securityImpl.thrift.TCredentials)value);
+ }
+ break;
+
+ }
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public java.lang.Object getFieldValue(_Fields field) {
+ switch (field) {
+ case TINFO:
+ return getTinfo();
+
+ case CREDENTIALS:
+ return getCredentials();
+
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ switch (field) {
+ case TINFO:
+ return isSetTinfo();
+ case CREDENTIALS:
+ return isSetCredentials();
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(java.lang.Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getActiveCompactions_args)
+ return this.equals((getActiveCompactions_args)that);
+ return false;
+ }
+
+ public boolean equals(getActiveCompactions_args that) {
+ if (that == null)
+ return false;
+ if (this == that)
+ return true;
+
+ boolean this_present_tinfo = true && this.isSetTinfo();
+ boolean that_present_tinfo = true && that.isSetTinfo();
+ if (this_present_tinfo || that_present_tinfo) {
+ if (!(this_present_tinfo && that_present_tinfo))
+ return false;
+ if (!this.tinfo.equals(that.tinfo))
+ return false;
+ }
+
+ boolean this_present_credentials = true && this.isSetCredentials();
+ boolean that_present_credentials = true && that.isSetCredentials();
+ if (this_present_credentials || that_present_credentials) {
+ if (!(this_present_credentials && that_present_credentials))
+ return false;
+ if (!this.credentials.equals(that.credentials))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 1;
+
+ hashCode = hashCode * 8191 + ((isSetTinfo()) ? 131071 : 524287);
+ if (isSetTinfo())
+ hashCode = hashCode * 8191 + tinfo.hashCode();
+
+ hashCode = hashCode * 8191 + ((isSetCredentials()) ? 131071 : 524287);
+ if (isSetCredentials())
+ hashCode = hashCode * 8191 + credentials.hashCode();
+
+ return hashCode;
+ }
+
+ @Override
+ public int compareTo(getActiveCompactions_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = java.lang.Boolean.valueOf(isSetTinfo()).compareTo(other.isSetTinfo());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTinfo()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tinfo, other.tinfo);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = java.lang.Boolean.valueOf(isSetCredentials()).compareTo(other.isSetCredentials());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCredentials()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.credentials, other.credentials);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ scheme(iprot).read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ scheme(oprot).write(oprot, this);
+ }
+
+ @Override
+ public java.lang.String toString() {
+ java.lang.StringBuilder sb = new java.lang.StringBuilder("getActiveCompactions_args(");
+ boolean first = true;
+
+ sb.append("tinfo:");
+ if (this.tinfo == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.tinfo);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("credentials:");
+ if (this.credentials == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.credentials);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (tinfo != null) {
+ tinfo.validate();
+ }
+ if (credentials != null) {
+ credentials.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class getActiveCompactions_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public getActiveCompactions_argsStandardScheme getScheme() {
+ return new getActiveCompactions_argsStandardScheme();
+ }
+ }
+
+ private static class getActiveCompactions_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getActiveCompactions_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getActiveCompactions_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 2: // TINFO
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.tinfo = new org.apache.accumulo.core.trace.thrift.TInfo();
+ struct.tinfo.read(iprot);
+ struct.setTinfoIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 1: // CREDENTIALS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.credentials = new org.apache.accumulo.core.securityImpl.thrift.TCredentials();
+ struct.credentials.read(iprot);
+ struct.setCredentialsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, getActiveCompactions_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.credentials != null) {
+ oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC);
+ struct.credentials.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.tinfo != null) {
+ oprot.writeFieldBegin(TINFO_FIELD_DESC);
+ struct.tinfo.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getActiveCompactions_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public getActiveCompactions_argsTupleScheme getScheme() {
+ return new getActiveCompactions_argsTupleScheme();
+ }
+ }
+
+ private static class getActiveCompactions_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getActiveCompactions_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getActiveCompactions_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ java.util.BitSet optionals = new java.util.BitSet();
+ if (struct.isSetTinfo()) {
+ optionals.set(0);
+ }
+ if (struct.isSetCredentials()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetTinfo()) {
+ struct.tinfo.write(oprot);
+ }
+ if (struct.isSetCredentials()) {
+ struct.credentials.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getActiveCompactions_args struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ java.util.BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct.tinfo = new org.apache.accumulo.core.trace.thrift.TInfo();
+ struct.tinfo.read(iprot);
+ struct.setTinfoIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.credentials = new org.apache.accumulo.core.securityImpl.thrift.TCredentials();
+ struct.credentials.read(iprot);
+ struct.setCredentialsIsSet(true);
+ }
+ }
+ }
+
+ private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+ return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+ }
+ }
+
+ public static class getActiveCompactions_result implements org.apache.thrift.TBase<getActiveCompactions_result, getActiveCompactions_result._Fields>, java.io.Serializable, Cloneable, Comparable<getActiveCompactions_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getActiveCompactions_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
+ private static final org.apache.thrift.protocol.TField SEC_FIELD_DESC = new org.apache.thrift.protocol.TField("sec", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getActiveCompactions_resultStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getActiveCompactions_resultTupleSchemeFactory();
+
+ public @org.apache.thrift.annotation.Nullable java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> success; // required
+ public @org.apache.thrift.annotation.Nullable org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException sec; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)0, "success"),
+ SEC((short)1, "sec");
+
+ private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
+
+ static {
+ for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ @org.apache.thrift.annotation.Nullable
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 0: // SUCCESS
+ return SUCCESS;
+ case 1: // SEC
+ return SEC;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ @org.apache.thrift.annotation.Nullable
+ public static _Fields findByName(java.lang.String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final java.lang.String _fieldName;
+
+ _Fields(short thriftId, java.lang.String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public java.lang.String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction.class))));
+ tmpMap.put(_Fields.SEC, new org.apache.thrift.meta_data.FieldMetaData("sec", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException.class)));
+ metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getActiveCompactions_result.class, metaDataMap);
+ }
+
+ public getActiveCompactions_result() {
+ }
+
+ public getActiveCompactions_result(
+ java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> success,
+ org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException sec)
+ {
+ this();
+ this.success = success;
+ this.sec = sec;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getActiveCompactions_result(getActiveCompactions_result other) {
+ if (other.isSetSuccess()) {
+ java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> __this__success = new java.util.ArrayList<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>(other.success.size());
+ for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction other_element : other.success) {
+ __this__success.add(new org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction(other_element));
+ }
+ this.success = __this__success;
+ }
+ if (other.isSetSec()) {
+ this.sec = new org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException(other.sec);
+ }
+ }
+
+ public getActiveCompactions_result deepCopy() {
+ return new getActiveCompactions_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ this.sec = null;
+ }
+
+ public int getSuccessSize() {
+ return (this.success == null) ? 0 : this.success.size();
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public java.util.Iterator<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> getSuccessIterator() {
+ return (this.success == null) ? null : this.success.iterator();
+ }
+
+ public void addToSuccess(org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction elem) {
+ if (this.success == null) {
+ this.success = new java.util.ArrayList<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>();
+ }
+ this.success.add(elem);
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> getSuccess() {
+ return this.success;
+ }
+
+ public getActiveCompactions_result setSuccess(@org.apache.thrift.annotation.Nullable java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction> success) {
+ this.success = success;
+ return this;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException getSec() {
+ return this.sec;
+ }
+
+ public getActiveCompactions_result setSec(@org.apache.thrift.annotation.Nullable org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException sec) {
+ this.sec = sec;
+ return this;
+ }
+
+ public void unsetSec() {
+ this.sec = null;
+ }
+
+ /** Returns true if field sec is set (has been assigned a value) and false otherwise */
+ public boolean isSetSec() {
+ return this.sec != null;
+ }
+
+ public void setSecIsSet(boolean value) {
+ if (!value) {
+ this.sec = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((java.util.List<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>)value);
+ }
+ break;
+
+ case SEC:
+ if (value == null) {
+ unsetSec();
+ } else {
+ setSec((org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException)value);
+ }
+ break;
+
+ }
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public java.lang.Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ case SEC:
+ return getSec();
+
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ switch (field) {
+ case SUCCESS:
+ return isSetSuccess();
+ case SEC:
+ return isSetSec();
+ }
+ throw new java.lang.IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(java.lang.Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getActiveCompactions_result)
+ return this.equals((getActiveCompactions_result)that);
+ return false;
+ }
+
+ public boolean equals(getActiveCompactions_result that) {
+ if (that == null)
+ return false;
+ if (this == that)
+ return true;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ boolean this_present_sec = true && this.isSetSec();
+ boolean that_present_sec = true && that.isSetSec();
+ if (this_present_sec || that_present_sec) {
+ if (!(this_present_sec && that_present_sec))
+ return false;
+ if (!this.sec.equals(that.sec))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 1;
+
+ hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
+ if (isSetSuccess())
+ hashCode = hashCode * 8191 + success.hashCode();
+
+ hashCode = hashCode * 8191 + ((isSetSec()) ? 131071 : 524287);
+ if (isSetSec())
+ hashCode = hashCode * 8191 + sec.hashCode();
+
+ return hashCode;
+ }
+
+ @Override
+ public int compareTo(getActiveCompactions_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = java.lang.Boolean.valueOf(isSetSec()).compareTo(other.isSetSec());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSec()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sec, other.sec);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ scheme(iprot).read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ scheme(oprot).write(oprot, this);
+ }
+
+ @Override
+ public java.lang.String toString() {
+ java.lang.StringBuilder sb = new java.lang.StringBuilder("getActiveCompactions_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("sec:");
+ if (this.sec == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.sec);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class getActiveCompactions_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public getActiveCompactions_resultStandardScheme getScheme() {
+ return new getActiveCompactions_resultStandardScheme();
+ }
+ }
+
+ private static class getActiveCompactions_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getActiveCompactions_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getActiveCompactions_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
+ struct.success = new java.util.ArrayList<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>(_list0.size);
+ @org.apache.thrift.annotation.Nullable org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction _elem1;
+ for (int _i2 = 0; _i2 < _list0.size; ++_i2)
+ {
+ _elem1 = new org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction();
+ _elem1.read(iprot);
+ struct.success.add(_elem1);
+ }
+ iprot.readListEnd();
+ }
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 1: // SEC
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.sec = new org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException();
+ struct.sec.read(iprot);
+ struct.setSecIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, getActiveCompactions_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size()));
+ for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction _iter3 : struct.success)
+ {
+ _iter3.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.sec != null) {
+ oprot.writeFieldBegin(SEC_FIELD_DESC);
+ struct.sec.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getActiveCompactions_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public getActiveCompactions_resultTupleScheme getScheme() {
+ return new getActiveCompactions_resultTupleScheme();
+ }
+ }
+
+ private static class getActiveCompactions_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getActiveCompactions_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getActiveCompactions_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ java.util.BitSet optionals = new java.util.BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ if (struct.isSetSec()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetSuccess()) {
+ {
+ oprot.writeI32(struct.success.size());
+ for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction _iter4 : struct.success)
+ {
+ _iter4.write(oprot);
+ }
+ }
+ }
+ if (struct.isSetSec()) {
+ struct.sec.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getActiveCompactions_result struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+ java.util.BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.success = new java.util.ArrayList<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>(_list5.size);
+ @org.apache.thrift.annotation.Nullable org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction _elem6;
+ for (int _i7 = 0; _i7 < _list5.size; ++_i7)
+ {
+ _elem6 = new org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction();
+ _elem6.read(iprot);
+ struct.success.add(_elem6);
+ }
+ }
+ struct.setSuccessIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.sec = new org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException();
+ struct.sec.read(iprot);
+ struct.setSecIsSet(true);
+ }
+ }
+ }
+
+ private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+ return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+ }
+ }
+
private static void unusedMethod() {}
}
diff --git a/core/src/main/thrift/compaction-coordinator.thrift b/core/src/main/thrift/compaction-coordinator.thrift
index 3db0be4..c4e84e3 100644
--- a/core/src/main/thrift/compaction-coordinator.thrift
+++ b/core/src/main/thrift/compaction-coordinator.thrift
@@ -142,4 +142,10 @@ service Compactor {
1:client.ThriftSecurityException sec
)
+ list<tabletserver.ActiveCompaction> getActiveCompactions(
+ 2:trace.TInfo tinfo
+ 1:security.TCredentials credentials
+ ) throws (
+ 1:client.ThriftSecurityException sec
+ )
}
diff --git a/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java b/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java
index e391571..7033fb8 100644
--- a/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java
+++ b/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java
@@ -56,13 +56,13 @@ import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.trace.thrift.TInfo;
import org.apache.accumulo.core.util.HostAndPort;
+import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
import org.apache.accumulo.core.util.threads.ThreadPools;
import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.fate.zookeeper.ServiceLock;
import org.apache.accumulo.server.AbstractServer;
import org.apache.accumulo.server.GarbageCollectionLogger;
import org.apache.accumulo.server.ServerOpts;
-import org.apache.accumulo.server.compaction.ExternalCompactionUtil;
import org.apache.accumulo.server.compaction.RetryableThriftCall;
import org.apache.accumulo.server.compaction.RetryableThriftCall.RetriesExceededException;
import org.apache.accumulo.server.compaction.RetryableThriftFunction;
diff --git a/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/DeadCompactionDetector.java b/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/DeadCompactionDetector.java
index 61e27c6..a3e0a3f 100644
--- a/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/DeadCompactionDetector.java
+++ b/server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/DeadCompactionDetector.java
@@ -29,10 +29,10 @@ import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.metadata.schema.Ample.DataLevel;
import org.apache.accumulo.core.metadata.schema.ExternalCompactionId;
import org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType;
+import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
import org.apache.accumulo.core.util.threads.Threads;
import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.server.ServerContext;
-import org.apache.accumulo.server.compaction.ExternalCompactionUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/server/compaction-coordinator/src/test/java/org/apache/accumulo/coordinator/CompactionCoordinatorTest.java b/server/compaction-coordinator/src/test/java/org/apache/accumulo/coordinator/CompactionCoordinatorTest.java
index 2aa2b4f..0b0628e 100644
--- a/server/compaction-coordinator/src/test/java/org/apache/accumulo/coordinator/CompactionCoordinatorTest.java
+++ b/server/compaction-coordinator/src/test/java/org/apache/accumulo/coordinator/CompactionCoordinatorTest.java
@@ -49,10 +49,10 @@ import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.trace.thrift.TInfo;
import org.apache.accumulo.core.util.HostAndPort;
+import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
import org.apache.accumulo.server.AbstractServer;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.ServerOpts;
-import org.apache.accumulo.server.compaction.ExternalCompactionUtil;
import org.apache.accumulo.server.manager.LiveTServerSet;
import org.apache.accumulo.server.rpc.ServerAddress;
import org.apache.accumulo.server.security.AuditedSecurityOperation;
diff --git a/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java b/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java
index 74344b7..6ed7fa4 100644
--- a/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java
+++ b/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java
@@ -57,6 +57,7 @@ import org.apache.accumulo.core.metadata.schema.TabletMetadata;
import org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType;
import org.apache.accumulo.core.rpc.ThriftUtil;
import org.apache.accumulo.core.securityImpl.thrift.TCredentials;
+import org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction;
import org.apache.accumulo.core.tabletserver.thrift.TCompactionKind;
import org.apache.accumulo.core.tabletserver.thrift.TCompactionStats;
import org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob;
@@ -66,6 +67,7 @@ import org.apache.accumulo.core.util.Halt;
import org.apache.accumulo.core.util.HostAndPort;
import org.apache.accumulo.core.util.ServerServices;
import org.apache.accumulo.core.util.ServerServices.Service;
+import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
import org.apache.accumulo.core.util.threads.ThreadPools;
import org.apache.accumulo.core.util.threads.Threads;
import org.apache.accumulo.fate.util.UtilWaitThread;
@@ -78,7 +80,6 @@ import org.apache.accumulo.server.AbstractServer;
import org.apache.accumulo.server.GarbageCollectionLogger;
import org.apache.accumulo.server.ServerOpts;
import org.apache.accumulo.server.compaction.CompactionInfo;
-import org.apache.accumulo.server.compaction.ExternalCompactionUtil;
import org.apache.accumulo.server.compaction.RetryableThriftCall;
import org.apache.accumulo.server.compaction.RetryableThriftCall.RetriesExceededException;
import org.apache.accumulo.server.compaction.RetryableThriftFunction;
@@ -793,6 +794,25 @@ public class Compactor extends AbstractServer
}
}
+ @Override
+ public List<ActiveCompaction> getActiveCompactions(TInfo tinfo, TCredentials credentials)
+ throws ThriftSecurityException, TException {
+ if (!security.canPerformSystemActions(credentials)) {
+ throw new AccumuloSecurityException(credentials.getPrincipal(),
+ SecurityErrorCode.PERMISSION_DENIED).asThriftException();
+ }
+
+ List<CompactionInfo> compactions =
+ org.apache.accumulo.server.compaction.Compactor.getRunningCompactions();
+ List<ActiveCompaction> ret = new ArrayList<>(compactions.size());
+
+ for (CompactionInfo compactionInfo : compactions) {
+ ret.add(compactionInfo.toThrift());
+ }
+
+ return ret;
+ }
+
/**
* Called by a CompactionCoordinator to get the running compaction
*
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java
index 33be018..602afc2 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java
@@ -19,19 +19,19 @@
package org.apache.accumulo.shell.commands;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.ActiveCompaction;
import org.apache.accumulo.core.client.admin.InstanceOperations;
import org.apache.accumulo.core.util.Duration;
-import org.apache.accumulo.core.util.threads.ThreadPools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,8 +57,7 @@ class ActiveCompactionHelper {
return maxDecimal(count / 1_000_000_000.0) + "B";
}
- private static String formatActiveCompactionLine(String tserver, ActiveCompaction ac)
- throws TableNotFoundException {
+ private static String formatActiveCompactionLine(ActiveCompaction ac) {
String output = ac.getOutputFile();
int index = output.indexOf("tables");
if (index > 0) {
@@ -72,53 +71,70 @@ class ActiveCompactionHelper {
iterOpts.put(is.getName(), is.getOptions());
}
- return String.format(
- "%21s | %9s | %5s | %6s | %5s | %5s | %15s | %-40s | %5s | %35s | %9s | %s", tserver,
- Duration.format(ac.getAge(), "", "-"), ac.getType(), ac.getReason(),
- shortenCount(ac.getEntriesRead()), shortenCount(ac.getEntriesWritten()), ac.getTable(),
- ac.getTablet(), ac.getInputFiles().size(), output, iterList, iterOpts);
+ String hostType;
+ switch (ac.getHost().getType()) {
+ case TSERVER:
+ hostType = "T";
+ break;
+ case COMPACTOR:
+ hostType = "C";
+ break;
+ default:
+ hostType = ac.getHost().getType().name();
+ break;
+ }
+
+ String host = hostType + " " + ac.getHost().getAddress() + ":" + ac.getHost().getPort();
+
+ try {
+ return String.format(
+ "%21s | %9s | %5s | %6s | %5s | %5s | %15s | %-40s | %5s | %35s | %9s | %s", host,
+ Duration.format(ac.getAge(), "", "-"), ac.getType(), ac.getReason(),
+ shortenCount(ac.getEntriesRead()), shortenCount(ac.getEntriesWritten()), ac.getTable(),
+ ac.getTablet(), ac.getInputFiles().size(), output, iterList, iterOpts);
+ } catch (TableNotFoundException e) {
+ return "ERROR " + e.getMessage();
+ }
}
- private static List<String> activeCompactionsForServer(String tserver,
+ public static Stream<String> appendHeader(Stream<String> stream) {
+ Stream<String> header = Stream.of(String.format(
+ " %-21s| %-9s | %-5s | %-6s | %-5s | %-5s | %-15s | %-40s | %-5s | %-35s | %-9s | %s",
+ "SERVER", "AGE", "TYPE", "REASON", "READ", "WROTE", "TABLE", "TABLET", "INPUT", "OUTPUT",
+ "ITERATORS", "ITERATOR OPTIONS"));
+ return Stream.concat(header, stream);
+ }
+
+ public static Stream<String> activeCompactionsForServer(String tserver,
InstanceOperations instanceOps) {
List<String> compactions = new ArrayList<>();
try {
List<ActiveCompaction> acl = new ArrayList<>(instanceOps.getActiveCompactions(tserver));
acl.sort((o1, o2) -> (int) (o2.getAge() - o1.getAge()));
for (ActiveCompaction ac : acl) {
- compactions.add(formatActiveCompactionLine(tserver, ac));
+ compactions.add(formatActiveCompactionLine(ac));
}
} catch (Exception e) {
log.debug("Failed to list active compactions for server {}", tserver, e);
compactions.add(tserver + " ERROR " + e.getMessage());
}
- return compactions;
+ return compactions.stream();
}
- public static Stream<String> stream(List<String> tservers, InstanceOperations instanceOps) {
- Stream<String> header = Stream.of(String.format(
- " %-21s| %-9s | %-5s | %-6s | %-5s | %-5s | %-15s | %-40s | %-5s | %-35s | %-9s | %s",
- "TABLET SERVER", "AGE", "TYPE", "REASON", "READ", "WROTE", "TABLE", "TABLET", "INPUT",
- "OUTPUT", "ITERATORS", "ITERATOR OPTIONS"));
-
- // use at least 4 threads (if needed), but no more than 256
- int numThreads = Math.max(4, Math.min(tservers.size() / 10, 256));
- var executorService =
- ThreadPools.createFixedThreadPool(numThreads, "shell-listcompactions", false);
+ public static Stream<String> stream(InstanceOperations instanceOps) {
+ List<ActiveCompaction> activeCompactions;
try {
- Stream<String> activeCompactionLines = tservers.stream()
- // submit each tserver to executor
- .map(tserver -> CompletableFuture
- .supplyAsync(() -> activeCompactionsForServer(tserver, instanceOps), executorService))
- // collect all the futures
- .collect(Collectors.collectingAndThen(Collectors.toList(),
- // then join the futures, and stream the results from each tserver in order
- futures -> futures.stream().map(CompletableFuture::join).flatMap(List::stream)));
- return Stream.concat(header, activeCompactionLines);
- } finally {
- executorService.shutdown();
+ activeCompactions = instanceOps.getActiveCompactions();
+ } catch (AccumuloException | AccumuloSecurityException e) {
+ return Stream.of("ERROR " + e.getMessage());
}
+ Comparator<ActiveCompaction> comparator = Comparator.comparing(ac -> ac.getHost().getAddress());
+ comparator = comparator.thenComparing(ac -> ac.getHost().getPort())
+ .thenComparing((o1, o2) -> (int) (o2.getAge() - o1.getAge()));
+
+ activeCompactions.sort(comparator);
+ return activeCompactions.stream().map(ac -> formatActiveCompactionLine(ac));
}
}
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java
index 46cf852..f09edc2 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java
@@ -18,8 +18,6 @@
*/
package org.apache.accumulo.shell.commands;
-import java.util.ArrayList;
-import java.util.List;
import java.util.stream.Stream;
import org.apache.accumulo.core.client.admin.InstanceOperations;
@@ -44,30 +42,32 @@ public class ListCompactionsCommand extends Command {
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws Exception {
- List<String> tservers;
String filterText = null;
final InstanceOperations instanceOps = shellState.getAccumuloClient().instanceOperations();
final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt());
+ Stream<String> activeCompactionStream;
+
if (cl.hasOption(tserverOption.getOpt())) {
- tservers = new ArrayList<>();
- tservers.add(cl.getOptionValue(tserverOption.getOpt()));
+ activeCompactionStream = ActiveCompactionHelper
+ .activeCompactionsForServer(cl.getOptionValue(tserverOption.getOpt()), instanceOps);
} else {
- tservers = instanceOps.getTabletServers();
+ activeCompactionStream = ActiveCompactionHelper.stream(instanceOps);
}
if (cl.hasOption(filterOption.getOpt())) {
filterText = ".*" + cl.getOptionValue(filterOption.getOpt()) + ".*";
}
- Stream<String> activeCompactionStream = ActiveCompactionHelper.stream(tservers, instanceOps);
if (filterText != null) {
final String finalFilterText = filterText;
activeCompactionStream = activeCompactionStream.filter(t -> t.matches(finalFilterText));
}
+ activeCompactionStream = ActiveCompactionHelper.appendHeader(activeCompactionStream);
+
shellState.printLines(activeCompactionStream.iterator(), paginate);
return 0;