This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 85539ebf67 Moved map containing long running compactions to Monitor
(#6223)
85539ebf67 is described below
commit 85539ebf67eaa0aa7c6a359b55eefd1a5bbe07e5
Author: Dave Marion <[email protected]>
AuthorDate: Mon Mar 23 08:27:34 2026 -0400
Moved map containing long running compactions to Monitor (#6223)
Moved map of long running compactions from the
coordinator to the monitor server.
Co-authored-by: Dom G. <[email protected]>
---
.../org/apache/accumulo/core/conf/Property.java | 5 +
.../org/apache/accumulo/core/rpc/RpcFuture.java | 69 +
.../util/compaction/ExternalCompactionUtil.java | 93 +-
.../util/compaction/RunningCompactionInfo.java | 73 +-
.../thrift/CompactionCoordinatorService.java | 1335 --------------------
.../core/compaction/thrift/CompactorService.java | 36 +-
core/src/main/thrift/compaction-coordinator.thrift | 12 -
.../coordinator/CompactionCoordinator.java | 178 +--
.../compaction/CompactionCoordinatorTest.java | 15 -
.../java/org/apache/accumulo/monitor/Monitor.java | 2 -
.../apache/accumulo/monitor/next/Endpoints.java | 65 +-
.../accumulo/monitor/next/InformationFetcher.java | 52 +-
.../accumulo/monitor/next/SystemInformation.java | 98 +-
.../next/ec/CompactionInputFileDetails.java | 24 -
.../monitor/next/ec/RunningCompactionDetails.java | 50 -
.../responses}/RunningCompactionsSummary.java | 2 +-
.../org/apache/accumulo/monitor/resources/js/ec.js | 2 +-
.../test/compaction/ExternalCompaction_3_IT.java | 41 -
.../test/functional/FateConcurrencyIT.java | 14 +-
.../org/apache/accumulo/test/util/SlowOps.java | 19 +-
20 files changed, 382 insertions(+), 1803 deletions(-)
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 279566ac72..1bbd0f0817 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -952,6 +952,11 @@ public enum Property {
would cause all `/rest/` endpoints to be hosted at
`/accumulo/rest/*`.
""",
"2.1.4"),
+
MONITOR_LONG_RUNNING_COMPACTION_LIMIT("monitor.compactions.long.running.limit",
"50",
+ PropertyType.COUNT,
+ "The number of long running compactions to display per resource group.
The Monitor server will"
+ + " keep twice this number in memory as it builds the next list
while serving up the current list.",
+ "4.0.0"),
// per table properties
TABLE_PREFIX("table.", null, PropertyType.PREFIX, """
Properties in this category affect tablet server treatment of tablets, \
diff --git a/core/src/main/java/org/apache/accumulo/core/rpc/RpcFuture.java
b/core/src/main/java/org/apache/accumulo/core/rpc/RpcFuture.java
new file mode 100644
index 0000000000..d865db6665
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/rpc/RpcFuture.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.rpc;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.accumulo.core.client.admin.servers.ServerId;
+
+public class RpcFuture<T> implements Future<T> {
+
+ private final Future<T> future;
+ private final ServerId server;
+
+ public RpcFuture(Future<T> future, ServerId address) {
+ super();
+ this.future = future;
+ this.server = address;
+ }
+
+ public ServerId getServer() {
+ return server;
+ }
+
+ @Override
+ public boolean cancel(boolean mayInterruptIfRunning) {
+ return future.cancel(mayInterruptIfRunning);
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return future.isCancelled();
+ }
+
+ @Override
+ public boolean isDone() {
+ return future.isDone();
+ }
+
+ @Override
+ public T get() throws InterruptedException, ExecutionException {
+ return future.get();
+ }
+
+ @Override
+ public T get(long timeout, TimeUnit unit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ return future.get(timeout, unit);
+ }
+
+}
diff --git
a/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
b/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
index e3aa25003e..9d766f7cfd 100644
---
a/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
+++
b/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
@@ -33,7 +33,9 @@ import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
+import java.util.function.Consumer;
+import org.apache.accumulo.core.client.admin.servers.ServerId;
import org.apache.accumulo.core.clientImpl.ClientContext;
import org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException;
import org.apache.accumulo.core.compaction.thrift.CompactionCoordinatorService;
@@ -46,6 +48,7 @@ import
org.apache.accumulo.core.lock.ServiceLockPaths.AddressSelector;
import org.apache.accumulo.core.lock.ServiceLockPaths.ResourceGroupPredicate;
import org.apache.accumulo.core.lock.ServiceLockPaths.ServiceLockPath;
import org.apache.accumulo.core.metadata.schema.ExternalCompactionId;
+import org.apache.accumulo.core.rpc.RpcFuture;
import org.apache.accumulo.core.rpc.ThriftUtil;
import org.apache.accumulo.core.rpc.clients.ThriftClientTypes;
import org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction;
@@ -155,7 +158,7 @@ public class ExternalCompactionUtil {
* @return external compaction job or null if none running
*/
public static TExternalCompaction getRunningCompaction(HostAndPort
compactorAddr,
- ClientContext context) {
+ ClientContext context) throws TException {
CompactorService.Client client = null;
try {
@@ -169,6 +172,7 @@ public class ExternalCompactionUtil {
}
} catch (TException e) {
LOG.debug("Failed to contact compactor {}", compactorAddr, e);
+ throw e;
} finally {
ThriftUtil.returnClient(client, context);
}
@@ -193,38 +197,79 @@ public class ExternalCompactionUtil {
}
/**
- * This method returns information from the Compactor about the job that is
currently running. The
- * RunningCompactions are not fully populated. This method is used from the
CompactionCoordinator
- * on a restart to re-populate the set of running compactions on the
compactors.
+ * This method returns information from the Compactors about the job that is
currently running.
+ * This method will use a thread pool with 16 threads to query the
Compactors.
*
* @param context server context
- * @return list of compactor and external compaction jobs
+ * @param consumer object that will accept TExternalCompaction objects
*/
- public static List<TExternalCompaction>
getCompactionsRunningOnCompactors(ClientContext context) {
- final List<Future<TExternalCompaction>> rcFutures = new ArrayList<>();
+ public static void getCompactionsRunningOnCompactors(ClientContext context,
+ Consumer<TExternalCompaction> consumer) throws InterruptedException {
final ExecutorService executor = ThreadPools.getServerThreadPools()
.getPoolBuilder(COMPACTOR_RUNNING_COMPACTIONS_POOL).numCoreThreads(16).build();
+ try {
+ getCompactionsRunningOnCompactors(context, executor, consumer);
+ } finally {
+ executor.shutdownNow();
+ }
+ }
- context.getServerPaths().getCompactor(ResourceGroupPredicate.ANY,
AddressSelector.all(), true)
- .forEach(slp -> {
- final HostAndPort hp = HostAndPort.fromString(slp.getServer());
- rcFutures.add(executor.submit(() -> getRunningCompaction(hp,
context)));
- });
- executor.shutdown();
+ /**
+ * This method returns information from the Compactors about the job that is
currently running.
+ *
+ * @param context server context
+ * @param executor thread pool executor to use for querying Compactors
+ * @param consumer object that will accept TExternalCompaction objects
+ * @return list of compactor addresses where RPC failed
+ */
+ public static List<ServerId> getCompactionsRunningOnCompactors(ClientContext
context,
+ ExecutorService executor, Consumer<TExternalCompaction> consumer)
+ throws InterruptedException {
- final List<TExternalCompaction> results = new ArrayList<>();
- rcFutures.forEach(rcf -> {
- try {
- TExternalCompaction job = rcf.get();
- if (job == null || job.getJob() == null ||
job.getJob().getExternalCompactionId() == null) {
- return;
+ final List<RpcFuture<TExternalCompaction>> rcFutures = new ArrayList<>();
+ final List<ServerId> failures = new ArrayList<>();
+
+ try {
+ Set<ServerId> compactors =
context.instanceOperations().getServers(ServerId.Type.COMPACTOR);
+ compactors.forEach(s -> {
+ final HostAndPort address = HostAndPort.fromParts(s.getHost(),
s.getPort());
+ Future<TExternalCompaction> future =
+ executor.submit(() -> getRunningCompaction(address, context));
+ rcFutures.add(new RpcFuture<TExternalCompaction>(future, s));
+ });
+
+ while (!rcFutures.isEmpty()) {
+ var futureIter = rcFutures.iterator();
+ while (futureIter.hasNext()) {
+ var future = futureIter.next();
+ if (future.isDone()) {
+ try {
+ TExternalCompaction tec = future.get();
+ if (tec != null && tec.getJob() != null
+ && tec.getJob().getExternalCompactionId() != null) {
+ consumer.accept(tec);
+ }
+ } catch (ExecutionException e) {
+ LOG.error("Error getting compaction from compactor: " +
future.getServer(), e);
+ failures.add(future.getServer());
+ } finally {
+ futureIter.remove();
+ }
+ }
}
- results.add(job);
- } catch (InterruptedException | ExecutionException e) {
- throw new IllegalStateException(e);
+ Thread.sleep(100);
}
- });
- return results;
+ return failures;
+ } catch (InterruptedException e) {
+ // If this thread is interrupted, cancel all remaining tasks
+ var futureIter = rcFutures.iterator();
+ while (futureIter.hasNext()) {
+ var future = futureIter.next();
+ future.cancel(true);
+ }
+ rcFutures.clear();
+ throw e;
+ }
}
public static Collection<ExternalCompactionId>
diff --git
a/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompactionInfo.java
b/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompactionInfo.java
index baebd7a531..2d9575c96e 100644
---
a/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompactionInfo.java
+++
b/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompactionInfo.java
@@ -22,15 +22,24 @@ import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import java.util.Comparator;
+import java.util.List;
import java.util.TreeMap;
import org.apache.accumulo.core.compaction.thrift.TCompactionStatusUpdate;
import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.tabletserver.thrift.InputFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RunningCompactionInfo {
+
+ // Variable names become JSON keys
+ public static record CompactionInputFileDetails(String metadataFileEntry,
long size, long entries,
+ long timestamp) {
+ }
+
private static final Logger log =
LoggerFactory.getLogger(RunningCompactionInfo.class);
// DO NOT CHANGE Variable names - they map to JSON keys in the Monitor
@@ -44,6 +53,8 @@ public class RunningCompactionInfo {
public final long duration;
public final String status;
public final long lastUpdate;
+ public final List<CompactionInputFileDetails> inputFiles;
+ public final String outputFile;
/**
* Info parsed about the external running compaction. Calculate the
progress, which is defined as
@@ -76,40 +87,52 @@ public class RunningCompactionInfo {
last = lastEntry.getValue();
updateMillis = lastEntry.getKey();
duration = NANOSECONDS.toMillis(last.getCompactionAgeNanos());
+ long durationMinutes = MILLISECONDS.toMinutes(duration);
+ if (durationMinutes > 15) {
+ log.trace("Compaction {} has been running for {} minutes", ecid,
durationMinutes);
+ }
+
+ lastUpdate = nowMillis - updateMillis;
+ long sinceLastUpdateSeconds = MILLISECONDS.toSeconds(lastUpdate);
+ log.trace("Time since Last update {} - {} = {} seconds", nowMillis,
updateMillis,
+ sinceLastUpdateSeconds);
+
+ var total = last.getEntriesToBeCompacted();
+ if (total > 0) {
+ percent = (last.getEntriesRead() / (float) total) * 100;
+ }
+ progress = percent;
+
+ if (updates.isEmpty()) {
+ status = "na";
+ } else {
+ status = last.state.name();
+ }
+ log.trace("Parsed running compaction {} for {} with progress = {}%",
status, ecid, progress);
+ if (sinceLastUpdateSeconds > 30) {
+ log.trace("Compaction hasn't progressed from {} in {} seconds.",
progress,
+ sinceLastUpdateSeconds);
+ }
} else {
log.trace("No updates found for {}", ecid);
lastUpdate = 1;
progress = percent;
status = "na";
duration = 0;
- return;
}
- long durationMinutes = MILLISECONDS.toMinutes(duration);
- if (durationMinutes > 15) {
- log.trace("Compaction {} has been running for {} minutes", ecid,
durationMinutes);
- }
-
- lastUpdate = nowMillis - updateMillis;
- long sinceLastUpdateSeconds = MILLISECONDS.toSeconds(lastUpdate);
- log.trace("Time since Last update {} - {} = {} seconds", nowMillis,
updateMillis,
- sinceLastUpdateSeconds);
+ this.inputFiles = convertInputFiles(job.files);
+ this.outputFile = job.outputFile;
- var total = last.getEntriesToBeCompacted();
- if (total > 0) {
- percent = (last.getEntriesRead() / (float) total) * 100;
- }
- progress = percent;
+ }
- if (updates.isEmpty()) {
- status = "na";
- } else {
- status = last.state.name();
- }
- log.trace("Parsed running compaction {} for {} with progress = {}%",
status, ecid, progress);
- if (sinceLastUpdateSeconds > 30) {
- log.trace("Compaction hasn't progressed from {} in {} seconds.",
progress,
- sinceLastUpdateSeconds);
- }
+ /**
+ * @return a list of {@link CompactionInputFileDetails} sorted largest to
smallest
+ */
+ private List<CompactionInputFileDetails> convertInputFiles(List<InputFile>
files) {
+ return files.stream()
+ .map(file -> new CompactionInputFileDetails(file.metadataFileEntry,
file.size, file.entries,
+ file.timestamp))
+
.sorted(Comparator.comparingLong(CompactionInputFileDetails::size).reversed()).toList();
}
@Override
diff --git
a/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/CompactionCoordinatorService.java
b/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/CompactionCoordinatorService.java
index c9d2708c86..734d7f9027 100644
---
a/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/CompactionCoordinatorService.java
+++
b/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/CompactionCoordinatorService.java
@@ -39,8 +39,6 @@ public class CompactionCoordinatorService {
public TExternalCompactionMap
getRunningCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo tinfo,
org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials) throws
org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException,
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException,
org.apache.thrift.TException;
- public java.util.Map<java.lang.String,TExternalCompactionList>
getLongRunningCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo
tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials)
throws org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException,
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException,
org.apache.thrift.TException;
-
public TExternalCompactionMap
getCompletedCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo tinfo,
org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials) throws
org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException,
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException,
org.apache.thrift.TException;
public void cancel(org.apache.accumulo.core.clientImpl.thrift.TInfo tinfo,
org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials,
java.lang.String externalCompactionId) throws
org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException,
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException,
org.apache.thrift.TException;
@@ -61,8 +59,6 @@ public class CompactionCoordinatorService {
public void
getRunningCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo tinfo,
org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials,
org.apache.thrift.async.AsyncMethodCallback<TExternalCompactionMap>
resultHandler) throws org.apache.thrift.TException;
- public void
getLongRunningCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo
tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials,
org.apache.thrift.async.AsyncMethodCallback<java.util.Map<java.lang.String,TExternalCompactionList>>
resultHandler) throws org.apache.thrift.TException;
-
public void
getCompletedCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo tinfo,
org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials,
org.apache.thrift.async.AsyncMethodCallback<TExternalCompactionMap>
resultHandler) throws org.apache.thrift.TException;
public void cancel(org.apache.accumulo.core.clientImpl.thrift.TInfo tinfo,
org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials,
java.lang.String externalCompactionId,
org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws
org.apache.thrift.TException;
@@ -252,37 +248,6 @@ public class CompactionCoordinatorService {
throw new
org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT,
"getRunningCompactions failed: unknown result");
}
- @Override
- public java.util.Map<java.lang.String,TExternalCompactionList>
getLongRunningCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo
tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials)
throws org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException,
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException,
org.apache.thrift.TException
- {
- send_getLongRunningCompactions(tinfo, credentials);
- return recv_getLongRunningCompactions();
- }
-
- public void
send_getLongRunningCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo
tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials)
throws org.apache.thrift.TException
- {
- getLongRunningCompactions_args args = new
getLongRunningCompactions_args();
- args.setTinfo(tinfo);
- args.setCredentials(credentials);
- sendBase("getLongRunningCompactions", args);
- }
-
- public java.util.Map<java.lang.String,TExternalCompactionList>
recv_getLongRunningCompactions() throws
org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException,
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException,
org.apache.thrift.TException
- {
- getLongRunningCompactions_result result = new
getLongRunningCompactions_result();
- receiveBase(result, "getLongRunningCompactions");
- if (result.isSetSuccess()) {
- return result.success;
- }
- if (result.sec != null) {
- throw result.sec;
- }
- if (result.tnase != null) {
- throw result.tnase;
- }
- throw new
org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT,
"getLongRunningCompactions failed: unknown result");
- }
-
@Override
public TExternalCompactionMap
getCompletedCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo tinfo,
org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials) throws
org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException,
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException,
org.apache.thrift.TException
{
@@ -609,44 +574,6 @@ public class CompactionCoordinatorService {
}
}
- @Override
- public void
getLongRunningCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo
tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials,
org.apache.thrift.async.AsyncMethodCallback<java.util.Map<java.lang.String,TExternalCompactionList>>
resultHandler) throws org.apache.thrift.TException {
- checkReady();
- getLongRunningCompactions_call method_call = new
getLongRunningCompactions_call(tinfo, credentials, resultHandler, this,
___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class getLongRunningCompactions_call extends
org.apache.thrift.async.TAsyncMethodCall<java.util.Map<java.lang.String,TExternalCompactionList>>
{
- private org.apache.accumulo.core.clientImpl.thrift.TInfo tinfo;
- private org.apache.accumulo.core.securityImpl.thrift.TCredentials
credentials;
- public
getLongRunningCompactions_call(org.apache.accumulo.core.clientImpl.thrift.TInfo
tinfo, org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials,
org.apache.thrift.async.AsyncMethodCallback<java.util.Map<java.lang.String,TExternalCompactionList>>
resultHandler, org.apache.thrift.async.TAsyncClient client,
org.apache.thrift.protocol.TProtocolFactory protocolFactory,
org.apache.thrift.transport.TNonblockingTransport transport) throws
org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.tinfo = tinfo;
- this.credentials = credentials;
- }
-
- @Override
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws
org.apache.thrift.TException {
- prot.writeMessageBegin(new
org.apache.thrift.protocol.TMessage("getLongRunningCompactions",
org.apache.thrift.protocol.TMessageType.CALL, 0));
- getLongRunningCompactions_args args = new
getLongRunningCompactions_args();
- args.setTinfo(tinfo);
- args.setCredentials(credentials);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- @Override
- public java.util.Map<java.lang.String,TExternalCompactionList>
getResult() throws
org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException,
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException,
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_getLongRunningCompactions();
- }
- }
-
@Override
public void
getCompletedCompactions(org.apache.accumulo.core.clientImpl.thrift.TInfo tinfo,
org.apache.accumulo.core.securityImpl.thrift.TCredentials credentials,
org.apache.thrift.async.AsyncMethodCallback<TExternalCompactionMap>
resultHandler) throws org.apache.thrift.TException {
checkReady();
@@ -786,7 +713,6 @@ public class CompactionCoordinatorService {
processMap.put("updateCompactionStatus", new updateCompactionStatus());
processMap.put("compactionFailed", new compactionFailed());
processMap.put("getRunningCompactions", new getRunningCompactions());
- processMap.put("getLongRunningCompactions", new
getLongRunningCompactions());
processMap.put("getCompletedCompactions", new getCompletedCompactions());
processMap.put("cancel", new cancel());
processMap.put("recordCompletion", new recordCompletion());
@@ -963,40 +889,6 @@ public class CompactionCoordinatorService {
}
}
- public static class getLongRunningCompactions<I extends Iface> extends
org.apache.thrift.ProcessFunction<I, getLongRunningCompactions_args> {
- public getLongRunningCompactions() {
- super("getLongRunningCompactions");
- }
-
- @Override
- public getLongRunningCompactions_args getEmptyArgsInstance() {
- return new getLongRunningCompactions_args();
- }
-
- @Override
- protected boolean isOneway() {
- return false;
- }
-
- @Override
- protected boolean rethrowUnhandledExceptions() {
- return false;
- }
-
- @Override
- public getLongRunningCompactions_result getResult(I iface,
getLongRunningCompactions_args args) throws org.apache.thrift.TException {
- getLongRunningCompactions_result result = new
getLongRunningCompactions_result();
- try {
- result.success = iface.getLongRunningCompactions(args.tinfo,
args.credentials);
- } catch
(org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException sec) {
- result.sec = sec;
- } catch
(org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException
tnase) {
- result.tnase = tnase;
- }
- return result;
- }
- }
-
public static class getCompletedCompactions<I extends Iface> extends
org.apache.thrift.ProcessFunction<I, getCompletedCompactions_args> {
public getCompletedCompactions() {
super("getCompletedCompactions");
@@ -1110,7 +1002,6 @@ public class CompactionCoordinatorService {
processMap.put("updateCompactionStatus", new updateCompactionStatus());
processMap.put("compactionFailed", new compactionFailed());
processMap.put("getRunningCompactions", new getRunningCompactions());
- processMap.put("getLongRunningCompactions", new
getLongRunningCompactions());
processMap.put("getCompletedCompactions", new getCompletedCompactions());
processMap.put("cancel", new cancel());
processMap.put("recordCompletion", new recordCompletion());
@@ -1489,81 +1380,6 @@ public class CompactionCoordinatorService {
}
}
- public static class getLongRunningCompactions<I extends AsyncIface>
extends org.apache.thrift.AsyncProcessFunction<I,
getLongRunningCompactions_args,
java.util.Map<java.lang.String,TExternalCompactionList>> {
- public getLongRunningCompactions() {
- super("getLongRunningCompactions");
- }
-
- @Override
- public getLongRunningCompactions_args getEmptyArgsInstance() {
- return new getLongRunningCompactions_args();
- }
-
- @Override
- public
org.apache.thrift.async.AsyncMethodCallback<java.util.Map<java.lang.String,TExternalCompactionList>>
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.Map<java.lang.String,TExternalCompactionList>>()
{
- @Override
- public void
onComplete(java.util.Map<java.lang.String,TExternalCompactionList> o) {
- getLongRunningCompactions_result result = new
getLongRunningCompactions_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);
- }
- }
- @Override
- public void onError(java.lang.Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TSerializable msg;
- getLongRunningCompactions_result result = new
getLongRunningCompactions_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.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException) {
- result.tnase =
(org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException) e;
- result.setTnaseIsSet(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();
- }
- }
- };
- }
-
- @Override
- protected boolean isOneway() {
- return false;
- }
-
- @Override
- public void start(I iface, getLongRunningCompactions_args args,
org.apache.thrift.async.AsyncMethodCallback<java.util.Map<java.lang.String,TExternalCompactionList>>
resultHandler) throws org.apache.thrift.TException {
- iface.getLongRunningCompactions(args.tinfo,
args.credentials,resultHandler);
- }
- }
-
public static class getCompletedCompactions<I extends AsyncIface> extends
org.apache.thrift.AsyncProcessFunction<I, getCompletedCompactions_args,
TExternalCompactionMap> {
public getCompletedCompactions() {
super("getCompletedCompactions");
@@ -8276,1157 +8092,6 @@ public class CompactionCoordinatorService {
}
}
- @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
- public static class getLongRunningCompactions_args implements
org.apache.thrift.TBase<getLongRunningCompactions_args,
getLongRunningCompactions_args._Fields>, java.io.Serializable, Cloneable,
Comparable<getLongRunningCompactions_args> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new
org.apache.thrift.protocol.TStruct("getLongRunningCompactions_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)1);
- 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)2);
-
- private static final org.apache.thrift.scheme.SchemeFactory
STANDARD_SCHEME_FACTORY = new
getLongRunningCompactions_argsStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory
TUPLE_SCHEME_FACTORY = new getLongRunningCompactions_argsTupleSchemeFactory();
-
- public @org.apache.thrift.annotation.Nullable
org.apache.accumulo.core.clientImpl.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)1, "tinfo"),
- CREDENTIALS((short)2, "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 1: // TINFO
- return TINFO;
- case 2: // 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;
- }
-
- @Override
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- @Override
- 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.clientImpl.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(getLongRunningCompactions_args.class,
metaDataMap);
- }
-
- public getLongRunningCompactions_args() {
- }
-
- public getLongRunningCompactions_args(
- org.apache.accumulo.core.clientImpl.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 getLongRunningCompactions_args(getLongRunningCompactions_args
other) {
- if (other.isSetTinfo()) {
- this.tinfo = new
org.apache.accumulo.core.clientImpl.thrift.TInfo(other.tinfo);
- }
- if (other.isSetCredentials()) {
- this.credentials = new
org.apache.accumulo.core.securityImpl.thrift.TCredentials(other.credentials);
- }
- }
-
- @Override
- public getLongRunningCompactions_args deepCopy() {
- return new getLongRunningCompactions_args(this);
- }
-
- @Override
- public void clear() {
- this.tinfo = null;
- this.credentials = null;
- }
-
- @org.apache.thrift.annotation.Nullable
- public org.apache.accumulo.core.clientImpl.thrift.TInfo getTinfo() {
- return this.tinfo;
- }
-
- public getLongRunningCompactions_args
setTinfo(@org.apache.thrift.annotation.Nullable
org.apache.accumulo.core.clientImpl.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 getLongRunningCompactions_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;
- }
- }
-
- @Override
- 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.clientImpl.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
- @Override
- 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 */
- @Override
- 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 instanceof getLongRunningCompactions_args)
- return this.equals((getLongRunningCompactions_args)that);
- return false;
- }
-
- public boolean equals(getLongRunningCompactions_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(getLongRunningCompactions_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = java.lang.Boolean.compare(isSetTinfo(),
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.compare(isSetCredentials(),
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
- @Override
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws
org.apache.thrift.TException {
- scheme(iprot).read(iprot, this);
- }
-
- @Override
- 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("getLongRunningCompactions_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 getLongRunningCompactions_argsStandardSchemeFactory
implements org.apache.thrift.scheme.SchemeFactory {
- @Override
- public getLongRunningCompactions_argsStandardScheme getScheme() {
- return new getLongRunningCompactions_argsStandardScheme();
- }
- }
-
- private static class getLongRunningCompactions_argsStandardScheme extends
org.apache.thrift.scheme.StandardScheme<getLongRunningCompactions_args> {
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol iprot,
getLongRunningCompactions_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 1: // TINFO
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT)
{
- struct.tinfo = new
org.apache.accumulo.core.clientImpl.thrift.TInfo();
- struct.tinfo.read(iprot);
- struct.setTinfoIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
- }
- break;
- case 2: // 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();
- }
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol oprot,
getLongRunningCompactions_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.tinfo != null) {
- oprot.writeFieldBegin(TINFO_FIELD_DESC);
- struct.tinfo.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.credentials != null) {
- oprot.writeFieldBegin(CREDENTIALS_FIELD_DESC);
- struct.credentials.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class getLongRunningCompactions_argsTupleSchemeFactory
implements org.apache.thrift.scheme.SchemeFactory {
- @Override
- public getLongRunningCompactions_argsTupleScheme getScheme() {
- return new getLongRunningCompactions_argsTupleScheme();
- }
- }
-
- private static class getLongRunningCompactions_argsTupleScheme extends
org.apache.thrift.scheme.TupleScheme<getLongRunningCompactions_args> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot,
getLongRunningCompactions_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,
getLongRunningCompactions_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.clientImpl.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();
- }
- }
-
- @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
- public static class getLongRunningCompactions_result implements
org.apache.thrift.TBase<getLongRunningCompactions_result,
getLongRunningCompactions_result._Fields>, java.io.Serializable, Cloneable,
Comparable<getLongRunningCompactions_result> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new
org.apache.thrift.protocol.TStruct("getLongRunningCompactions_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC
= new org.apache.thrift.protocol.TField("success",
org.apache.thrift.protocol.TType.MAP, (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.protocol.TField TNASE_FIELD_DESC =
new org.apache.thrift.protocol.TField("tnase",
org.apache.thrift.protocol.TType.STRUCT, (short)2);
-
- private static final org.apache.thrift.scheme.SchemeFactory
STANDARD_SCHEME_FACTORY = new
getLongRunningCompactions_resultStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory
TUPLE_SCHEME_FACTORY = new getLongRunningCompactions_resultTupleSchemeFactory();
-
- public @org.apache.thrift.annotation.Nullable
java.util.Map<java.lang.String,TExternalCompactionList> success; // required
- public @org.apache.thrift.annotation.Nullable
org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException sec; //
required
- public @org.apache.thrift.annotation.Nullable
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException
tnase; // 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"),
- TNASE((short)2, "tnase");
-
- 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;
- case 2: // TNASE
- return TNASE;
- 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;
- }
-
- @Override
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- @Override
- 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.MapMetaData(org.apache.thrift.protocol.TType.MAP,
- new
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
- new
org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
TExternalCompactionList.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)));
- tmpMap.put(_Fields.TNASE, new
org.apache.thrift.meta_data.FieldMetaData("tnase",
org.apache.thrift.TFieldRequirementType.DEFAULT,
- new
org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException.class)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
-
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getLongRunningCompactions_result.class,
metaDataMap);
- }
-
- public getLongRunningCompactions_result() {
- }
-
- public getLongRunningCompactions_result(
- java.util.Map<java.lang.String,TExternalCompactionList> success,
- org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException sec,
-
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException
tnase)
- {
- this();
- this.success = success;
- this.sec = sec;
- this.tnase = tnase;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public getLongRunningCompactions_result(getLongRunningCompactions_result
other) {
- if (other.isSetSuccess()) {
- java.util.Map<java.lang.String,TExternalCompactionList>
__this__success = new
java.util.HashMap<java.lang.String,TExternalCompactionList>(other.success.size());
- for (java.util.Map.Entry<java.lang.String, TExternalCompactionList>
other_element : other.success.entrySet()) {
-
- java.lang.String other_element_key = other_element.getKey();
- TExternalCompactionList other_element_value =
other_element.getValue();
-
- java.lang.String __this__success_copy_key = other_element_key;
-
- TExternalCompactionList __this__success_copy_value = new
TExternalCompactionList(other_element_value);
-
- __this__success.put(__this__success_copy_key,
__this__success_copy_value);
- }
- this.success = __this__success;
- }
- if (other.isSetSec()) {
- this.sec = new
org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException(other.sec);
- }
- if (other.isSetTnase()) {
- this.tnase = new
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException(other.tnase);
- }
- }
-
- @Override
- public getLongRunningCompactions_result deepCopy() {
- return new getLongRunningCompactions_result(this);
- }
-
- @Override
- public void clear() {
- this.success = null;
- this.sec = null;
- this.tnase = null;
- }
-
- public int getSuccessSize() {
- return (this.success == null) ? 0 : this.success.size();
- }
-
- public void putToSuccess(java.lang.String key, TExternalCompactionList
val) {
- if (this.success == null) {
- this.success = new
java.util.HashMap<java.lang.String,TExternalCompactionList>();
- }
- this.success.put(key, val);
- }
-
- @org.apache.thrift.annotation.Nullable
- public java.util.Map<java.lang.String,TExternalCompactionList>
getSuccess() {
- return this.success;
- }
-
- public getLongRunningCompactions_result
setSuccess(@org.apache.thrift.annotation.Nullable
java.util.Map<java.lang.String,TExternalCompactionList> 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 getLongRunningCompactions_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;
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException
getTnase() {
- return this.tnase;
- }
-
- public getLongRunningCompactions_result
setTnase(@org.apache.thrift.annotation.Nullable
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException
tnase) {
- this.tnase = tnase;
- return this;
- }
-
- public void unsetTnase() {
- this.tnase = null;
- }
-
- /** Returns true if field tnase is set (has been assigned a value) and
false otherwise */
- public boolean isSetTnase() {
- return this.tnase != null;
- }
-
- public void setTnaseIsSet(boolean value) {
- if (!value) {
- this.tnase = null;
- }
- }
-
- @Override
- 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.Map<java.lang.String,TExternalCompactionList>)value);
- }
- break;
-
- case SEC:
- if (value == null) {
- unsetSec();
- } else {
-
setSec((org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException)value);
- }
- break;
-
- case TNASE:
- if (value == null) {
- unsetTnase();
- } else {
-
setTnase((org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException)value);
- }
- break;
-
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- @Override
- public java.lang.Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return getSuccess();
-
- case SEC:
- return getSec();
-
- case TNASE:
- return getTnase();
-
- }
- throw new java.lang.IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been
assigned a value) and false otherwise */
- @Override
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new java.lang.IllegalArgumentException();
- }
-
- switch (field) {
- case SUCCESS:
- return isSetSuccess();
- case SEC:
- return isSetSec();
- case TNASE:
- return isSetTnase();
- }
- throw new java.lang.IllegalStateException();
- }
-
- @Override
- public boolean equals(java.lang.Object that) {
- if (that instanceof getLongRunningCompactions_result)
- return this.equals((getLongRunningCompactions_result)that);
- return false;
- }
-
- public boolean equals(getLongRunningCompactions_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;
- }
-
- boolean this_present_tnase = true && this.isSetTnase();
- boolean that_present_tnase = true && that.isSetTnase();
- if (this_present_tnase || that_present_tnase) {
- if (!(this_present_tnase && that_present_tnase))
- return false;
- if (!this.tnase.equals(that.tnase))
- 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();
-
- hashCode = hashCode * 8191 + ((isSetTnase()) ? 131071 : 524287);
- if (isSetTnase())
- hashCode = hashCode * 8191 + tnase.hashCode();
-
- return hashCode;
- }
-
- @Override
- public int compareTo(getLongRunningCompactions_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = java.lang.Boolean.compare(isSetSuccess(),
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.compare(isSetSec(), other.isSetSec());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSec()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sec,
other.sec);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = java.lang.Boolean.compare(isSetTnase(),
other.isSetTnase());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetTnase()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tnase,
other.tnase);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- @org.apache.thrift.annotation.Nullable
- @Override
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- @Override
- 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("getLongRunningCompactions_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;
- if (!first) sb.append(", ");
- sb.append("tnase:");
- if (this.tnase == null) {
- sb.append("null");
- } else {
- sb.append(this.tnase);
- }
- 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 getLongRunningCompactions_resultStandardSchemeFactory
implements org.apache.thrift.scheme.SchemeFactory {
- @Override
- public getLongRunningCompactions_resultStandardScheme getScheme() {
- return new getLongRunningCompactions_resultStandardScheme();
- }
- }
-
- private static class getLongRunningCompactions_resultStandardScheme
extends
org.apache.thrift.scheme.StandardScheme<getLongRunningCompactions_result> {
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol iprot,
getLongRunningCompactions_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.MAP) {
- {
- org.apache.thrift.protocol.TMap _map28 =
iprot.readMapBegin();
- struct.success = new
java.util.HashMap<java.lang.String,TExternalCompactionList>(2*_map28.size);
- @org.apache.thrift.annotation.Nullable java.lang.String
_key29;
- @org.apache.thrift.annotation.Nullable
TExternalCompactionList _val30;
- for (int _i31 = 0; _i31 < _map28.size; ++_i31)
- {
- _key29 = iprot.readString();
- _val30 = new TExternalCompactionList();
- _val30.read(iprot);
- struct.success.put(_key29, _val30);
- }
- iprot.readMapEnd();
- }
- 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;
- case 2: // TNASE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT)
{
- struct.tnase = new
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException();
- struct.tnase.read(iprot);
- struct.setTnaseIsSet(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();
- }
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol oprot,
getLongRunningCompactions_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- {
- oprot.writeMapBegin(new
org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING,
org.apache.thrift.protocol.TType.STRUCT, struct.success.size()));
- for (java.util.Map.Entry<java.lang.String,
TExternalCompactionList> _iter32 : struct.success.entrySet())
- {
- oprot.writeString(_iter32.getKey());
- _iter32.getValue().write(oprot);
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.sec != null) {
- oprot.writeFieldBegin(SEC_FIELD_DESC);
- struct.sec.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.tnase != null) {
- oprot.writeFieldBegin(TNASE_FIELD_DESC);
- struct.tnase.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class getLongRunningCompactions_resultTupleSchemeFactory
implements org.apache.thrift.scheme.SchemeFactory {
- @Override
- public getLongRunningCompactions_resultTupleScheme getScheme() {
- return new getLongRunningCompactions_resultTupleScheme();
- }
- }
-
- private static class getLongRunningCompactions_resultTupleScheme extends
org.apache.thrift.scheme.TupleScheme<getLongRunningCompactions_result> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot,
getLongRunningCompactions_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);
- }
- if (struct.isSetTnase()) {
- optionals.set(2);
- }
- oprot.writeBitSet(optionals, 3);
- if (struct.isSetSuccess()) {
- {
- oprot.writeI32(struct.success.size());
- for (java.util.Map.Entry<java.lang.String,
TExternalCompactionList> _iter33 : struct.success.entrySet())
- {
- oprot.writeString(_iter33.getKey());
- _iter33.getValue().write(oprot);
- }
- }
- }
- if (struct.isSetSec()) {
- struct.sec.write(oprot);
- }
- if (struct.isSetTnase()) {
- struct.tnase.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot,
getLongRunningCompactions_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(3);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TMap _map34 =
iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING,
org.apache.thrift.protocol.TType.STRUCT);
- struct.success = new
java.util.HashMap<java.lang.String,TExternalCompactionList>(2*_map34.size);
- @org.apache.thrift.annotation.Nullable java.lang.String _key35;
- @org.apache.thrift.annotation.Nullable TExternalCompactionList
_val36;
- for (int _i37 = 0; _i37 < _map34.size; ++_i37)
- {
- _key35 = iprot.readString();
- _val36 = new TExternalCompactionList();
- _val36.read(iprot);
- struct.success.put(_key35, _val36);
- }
- }
- struct.setSuccessIsSet(true);
- }
- if (incoming.get(1)) {
- struct.sec = new
org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException();
- struct.sec.read(iprot);
- struct.setSecIsSet(true);
- }
- if (incoming.get(2)) {
- struct.tnase = new
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException();
- struct.tnase.read(iprot);
- struct.setTnaseIsSet(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();
- }
- }
-
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public static class getCompletedCompactions_args implements
org.apache.thrift.TBase<getCompletedCompactions_args,
getCompletedCompactions_args._Fields>, java.io.Serializable, Cloneable,
Comparable<getCompletedCompactions_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new
org.apache.thrift.protocol.TStruct("getCompletedCompactions_args");
diff --git
a/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/CompactorService.java
b/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/CompactorService.java
index c1a34dc42c..d9d867d8d2 100644
---
a/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/CompactorService.java
+++
b/core/src/main/thrift-gen-java/org/apache/accumulo/core/compaction/thrift/CompactorService.java
@@ -3668,14 +3668,14 @@ public class CompactorService {
case 0: // SUCCESS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
- org.apache.thrift.protocol.TList _list38 =
iprot.readListBegin();
- struct.success = new
java.util.ArrayList<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>(_list38.size);
- @org.apache.thrift.annotation.Nullable
org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction _elem39;
- for (int _i40 = 0; _i40 < _list38.size; ++_i40)
+ org.apache.thrift.protocol.TList _list28 =
iprot.readListBegin();
+ struct.success = new
java.util.ArrayList<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>(_list28.size);
+ @org.apache.thrift.annotation.Nullable
org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction _elem29;
+ for (int _i30 = 0; _i30 < _list28.size; ++_i30)
{
- _elem39 = new
org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction();
- _elem39.read(iprot);
- struct.success.add(_elem39);
+ _elem29 = new
org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction();
+ _elem29.read(iprot);
+ struct.success.add(_elem29);
}
iprot.readListEnd();
}
@@ -3713,9 +3713,9 @@ public class CompactorService {
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
_iter41 : struct.success)
+ for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction
_iter31 : struct.success)
{
- _iter41.write(oprot);
+ _iter31.write(oprot);
}
oprot.writeListEnd();
}
@@ -3755,9 +3755,9 @@ public class CompactorService {
if (struct.isSetSuccess()) {
{
oprot.writeI32(struct.success.size());
- for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction
_iter42 : struct.success)
+ for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction
_iter32 : struct.success)
{
- _iter42.write(oprot);
+ _iter32.write(oprot);
}
}
}
@@ -3772,14 +3772,14 @@ public class CompactorService {
java.util.BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
{
- org.apache.thrift.protocol.TList _list43 =
iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
- struct.success = new
java.util.ArrayList<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>(_list43.size);
- @org.apache.thrift.annotation.Nullable
org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction _elem44;
- for (int _i45 = 0; _i45 < _list43.size; ++_i45)
+ org.apache.thrift.protocol.TList _list33 =
iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
+ struct.success = new
java.util.ArrayList<org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction>(_list33.size);
+ @org.apache.thrift.annotation.Nullable
org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction _elem34;
+ for (int _i35 = 0; _i35 < _list33.size; ++_i35)
{
- _elem44 = new
org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction();
- _elem44.read(iprot);
- struct.success.add(_elem44);
+ _elem34 = new
org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction();
+ _elem34.read(iprot);
+ struct.success.add(_elem34);
}
}
struct.setSuccessIsSet(true);
diff --git a/core/src/main/thrift/compaction-coordinator.thrift
b/core/src/main/thrift/compaction-coordinator.thrift
index 4b506ebf51..d583978d20 100644
--- a/core/src/main/thrift/compaction-coordinator.thrift
+++ b/core/src/main/thrift/compaction-coordinator.thrift
@@ -143,18 +143,6 @@ service CompactionCoordinatorService {
2:client.ThriftNotActiveServiceException tnase
)
- /*
- * Called by the Monitor to get longest running compactions, returns
- * a map of group name to size-limited list of the oldest compactions,
oldest first.
- */
- map<string,TExternalCompactionList> getLongRunningCompactions(
- 1:client.TInfo tinfo
- 2:security.TCredentials credentials
- )throws(
- 1:client.ThriftSecurityException sec
- 2:client.ThriftNotActiveServiceException tnase
- )
-
/*
* Called by the Monitor to get progress information
*/
diff --git
a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java
b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java
index 6c31302fc0..aee9679cc0 100644
---
a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java
+++
b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java
@@ -27,6 +27,7 @@ import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType
import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.OPID;
import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.PREV_ROW;
import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.SELECTED;
+import static
org.apache.accumulo.core.util.threads.ThreadPoolNames.COMPACTOR_RUNNING_COMPACTIONS_POOL;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -35,32 +36,26 @@ import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -79,7 +74,6 @@ import
org.apache.accumulo.core.compaction.thrift.CompactionCoordinatorService;
import org.apache.accumulo.core.compaction.thrift.TCompactionState;
import org.apache.accumulo.core.compaction.thrift.TCompactionStatusUpdate;
import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
-import org.apache.accumulo.core.compaction.thrift.TExternalCompactionList;
import org.apache.accumulo.core.compaction.thrift.TExternalCompactionMap;
import org.apache.accumulo.core.compaction.thrift.TNextCompactionJob;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
@@ -166,54 +160,6 @@ import io.micrometer.core.instrument.MeterRegistry;
public class CompactionCoordinator
implements CompactionCoordinatorService.Iface, Runnable, MetricsProducer {
- // Object that serves as a TopN view of the RunningCompactions, ordered by
- // RunningCompaction start time. The first entry in this Set should be the
- // oldest RunningCompaction.
- public static class TimeOrderedRunningCompactionSet {
-
- private static final int UPPER_LIMIT = 50;
-
- Comparator<TExternalCompaction> oldestFirstComparator =
- Comparator.comparingLong(TExternalCompaction::getStartTime)
- .thenComparing(rc -> rc.getJob().getExternalCompactionId());
- private final ConcurrentSkipListSet<TExternalCompaction> compactions =
- new ConcurrentSkipListSet<>(oldestFirstComparator);
-
- // Tracking size here as ConcurrentSkipListSet.size() is not constant time
- private final AtomicInteger size = new AtomicInteger(0);
-
- public int size() {
- return size.get();
- }
-
- public boolean add(TExternalCompaction e) {
- boolean added = compactions.add(e);
- if (added) {
- if (size.incrementAndGet() > UPPER_LIMIT) {
- this.remove(compactions.last());
- }
- }
- return added;
- }
-
- public boolean remove(Object o) {
- boolean removed = compactions.remove(o);
- if (removed) {
- size.decrementAndGet();
- }
- return removed;
- }
-
- public Iterator<TExternalCompaction> iterator() {
- return compactions.iterator();
- }
-
- public Stream<TExternalCompaction> stream() {
- return compactions.stream();
- }
-
- }
-
static class FailureCounts {
long failures;
long successes;
@@ -261,9 +207,6 @@ public class CompactionCoordinator
protected final Map<ExternalCompactionId,TExternalCompaction> RUNNING_CACHE =
new ConcurrentHashMap<>();
- protected final Map<String,TimeOrderedRunningCompactionSet>
LONG_RUNNING_COMPACTIONS_BY_RG =
- new ConcurrentHashMap<>();
-
/* Map of group name to last time compactor called to get a compaction job */
private final Map<ResourceGroupId,Long> TIME_COMPACTOR_LAST_CHECKED = new
ConcurrentHashMap<>();
@@ -406,21 +349,23 @@ public class CompactionCoordinator
// the external compaction came from to re-populate the RUNNING collection.
LOG.info("Checking for running external compactions");
// On re-start contact the running Compactors to try and seed the list of
running compactions
- List<TExternalCompaction> running = getCompactionsRunningOnCompactors();
- if (running.isEmpty()) {
- LOG.info("No running external compactions found");
- } else {
- LOG.info("Found {} running external compactions", running.size());
- running.forEach(tec -> {
- TCompactionStatusUpdate update = new TCompactionStatusUpdate();
- update.setState(TCompactionState.IN_PROGRESS);
- update.setMessage(RESTART_UPDATE_MSG);
- tec.putToUpdates(coordinatorStartTime, update);
-
RUNNING_CACHE.put(ExternalCompactionId.of(tec.getJob().getExternalCompactionId()),
tec);
- LONG_RUNNING_COMPACTIONS_BY_RG
- .computeIfAbsent(tec.getGroupName(), k -> new
TimeOrderedRunningCompactionSet())
- .add(tec);
- });
+ try {
+ List<TExternalCompaction> running = getCompactionsRunningOnCompactors();
+ if (running.isEmpty()) {
+ LOG.info("No running external compactions found");
+ } else {
+ LOG.info("Found {} running external compactions", running.size());
+ running.forEach(tec -> {
+ TCompactionStatusUpdate update = new TCompactionStatusUpdate();
+ update.setState(TCompactionState.IN_PROGRESS);
+ update.setMessage(RESTART_UPDATE_MSG);
+ tec.putToUpdates(coordinatorStartTime, update);
+
RUNNING_CACHE.put(ExternalCompactionId.of(tec.getJob().getExternalCompactionId()),
tec);
+ });
+ }
+ } catch (InterruptedException e) {
+ throw new IllegalStateException(
+ "Thread interrupted while retrieving running compactions from
compactors", e);
}
startDeadCompactionDetector();
@@ -1052,31 +997,10 @@ public class CompactionCoordinator
final TExternalCompaction tec =
RUNNING_CACHE.get(ExternalCompactionId.of(externalCompactionId));
if (null != tec) {
- tec.putToUpdates(timestamp, update);
- switch (update.state) {
- case STARTED:
- // Start time is used by the comparator, so set it first
- // before adding to the LONG_RUNNING_COMPACTIONS_BY_RG object.
- tec.setStartTime(timestamp);
- LONG_RUNNING_COMPACTIONS_BY_RG
- .computeIfAbsent(tec.getGroupName(), k -> new
TimeOrderedRunningCompactionSet())
- .add(tec);
- break;
- case CANCELLED:
- case FAILED:
- case SUCCEEDED:
- var compactionSet =
LONG_RUNNING_COMPACTIONS_BY_RG.get(tec.getGroupName());
- if (compactionSet != null) {
- compactionSet.remove(tec);
- }
- break;
- case ASSIGNED:
- case IN_PROGRESS:
- default:
- // do nothing
- break;
-
+ if (update.getState() == TCompactionState.STARTED) {
+ tec.setStartTime(timestamp);
}
+ tec.putToUpdates(timestamp, update);
}
}
@@ -1092,10 +1016,6 @@ public class CompactionCoordinator
var tec = RUNNING_CACHE.remove(ecid);
if (tec != null) {
completed.put(ecid, tec);
- var compactionSet =
LONG_RUNNING_COMPACTIONS_BY_RG.get(tec.getGroupName());
- if (compactionSet != null) {
- compactionSet.remove(tec);
- }
}
}
@@ -1132,39 +1052,6 @@ public class CompactionCoordinator
return result;
}
- /**
- * Return top 50 longest running compactions for each resource group
- *
- * @param tinfo trace info
- * @param credentials tcredentials object
- * @return map of group name to list of up to 50 compactions in sorted
order, oldest compaction
- * first.
- * @throws ThriftSecurityException permission error
- */
- @Override
- public Map<String,TExternalCompactionList> getLongRunningCompactions(TInfo
tinfo,
- TCredentials credentials) throws ThriftSecurityException {
- // do not expect users to call this directly, expect other tservers to
call this method
- if (!security.canPerformSystemActions(credentials)) {
- throw new AccumuloSecurityException(credentials.getPrincipal(),
- SecurityErrorCode.PERMISSION_DENIED).asThriftException();
- }
-
- final Map<String,TExternalCompactionList> result = new HashMap<>();
-
- for (Entry<String,TimeOrderedRunningCompactionSet> e :
LONG_RUNNING_COMPACTIONS_BY_RG
- .entrySet()) {
- final TExternalCompactionList compactions = new
TExternalCompactionList();
- Iterator<TExternalCompaction> iter = e.getValue().iterator();
- while (iter.hasNext()) {
- TExternalCompaction tec = iter.next();
- compactions.addToCompactions(tec);
- }
- result.put(e.getKey(), compactions);
- }
- return result;
- }
-
/**
* Return information about recently completed compactions
*
@@ -1213,8 +1100,21 @@ public class CompactionCoordinator
}
/* Method exists to be overridden in test to hide static method */
- protected List<TExternalCompaction> getCompactionsRunningOnCompactors() {
- return ExternalCompactionUtil.getCompactionsRunningOnCompactors(this.ctx);
+ protected List<TExternalCompaction> getCompactionsRunningOnCompactors()
+ throws InterruptedException {
+ int numCompactors =
this.ctx.instanceOperations().getServers(ServerId.Type.COMPACTOR).size();
+ final ExecutorService executor =
+
ThreadPools.getServerThreadPools().getPoolBuilder(COMPACTOR_RUNNING_COMPACTIONS_POOL)
+ .numCoreThreads(numCompactors / 10).build();
+ try {
+ List<TExternalCompaction> running = new ArrayList<>();
+ @SuppressWarnings("unused")
+ List<ServerId> failures =
ExternalCompactionUtil.getCompactionsRunningOnCompactors(this.ctx,
+ executor, (t) -> running.add(t));
+ return running;
+ } finally {
+ executor.shutdownNow();
+ }
}
/* Method exists to be overridden in test to hide static method */
@@ -1325,11 +1225,7 @@ public class CompactionCoordinator
// grab a snapshot of the ids in the set before reading the metadata
table. This is done to
// avoid removing things that are added while reading the metadata.
- final Set<ExternalCompactionId> idsSnapshot =
Set.copyOf(Sets.union(RUNNING_CACHE.keySet(),
- LONG_RUNNING_COMPACTIONS_BY_RG.values().stream()
- .flatMap(TimeOrderedRunningCompactionSet::stream)
- .map(rc ->
rc.getJob().getExternalCompactionId()).map(ExternalCompactionId::of)
- .collect(Collectors.toSet())));
+ final Set<ExternalCompactionId> idsSnapshot =
Set.copyOf(RUNNING_CACHE.keySet());
// grab the ids that are listed as running in the metadata table. It
important that this is done
// after getting the snapshot.
diff --git
a/server/manager/src/test/java/org/apache/accumulo/manager/compaction/CompactionCoordinatorTest.java
b/server/manager/src/test/java/org/apache/accumulo/manager/compaction/CompactionCoordinatorTest.java
index 29181c1241..a11e345a99 100644
---
a/server/manager/src/test/java/org/apache/accumulo/manager/compaction/CompactionCoordinatorTest.java
+++
b/server/manager/src/test/java/org/apache/accumulo/manager/compaction/CompactionCoordinatorTest.java
@@ -27,7 +27,6 @@ import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Collections;
@@ -168,10 +167,6 @@ public class CompactionCoordinatorTest {
return RUNNING_CACHE;
}
- public Map<String,TimeOrderedRunningCompactionSet> getLongRunningByGroup()
{
- return LONG_RUNNING_COMPACTIONS_BY_RG;
- }
-
public void resetInternals() {
getRunning().clear();
metadataCompactionIds = null;
@@ -269,13 +264,11 @@ public class CompactionCoordinatorTest {
var coordinator = new TestCoordinator(manager, new ArrayList<>());
assertEquals(0, coordinator.getJobQueues().getQueuedJobCount());
assertEquals(0, coordinator.getRunning().size());
- assertEquals(0, coordinator.getLongRunningByGroup().size());
coordinator.run();
coordinator.shutdown();
assertEquals(0, coordinator.getJobQueues().getQueuedJobCount());
assertEquals(0, coordinator.getRunning().size());
- assertEquals(0, coordinator.getLongRunningByGroup().size());
}
@Test
@@ -301,12 +294,10 @@ public class CompactionCoordinatorTest {
coordinator.resetInternals();
assertEquals(0, coordinator.getJobQueues().getQueuedJobCount());
assertEquals(0, coordinator.getRunning().size());
- assertEquals(0, coordinator.getLongRunningByGroup().size());
coordinator.run();
coordinator.shutdown();
assertEquals(0, coordinator.getJobQueues().getQueuedJobCount());
assertEquals(1, coordinator.getRunning().size());
- assertEquals(1, coordinator.getLongRunningByGroup().size());
Map<ExternalCompactionId,TExternalCompaction> running =
coordinator.getRunning();
Entry<ExternalCompactionId,TExternalCompaction> ecomp =
running.entrySet().iterator().next();
@@ -315,12 +306,6 @@ public class CompactionCoordinatorTest {
assertEquals(GROUP_ID, ResourceGroupId.of(tec.getGroupName()));
assertEquals(tserverAddr.toString(), tec.getCompactor());
-
assertTrue(coordinator.getLongRunningByGroup().containsKey(GROUP_ID.toString()));
-
assertTrue(coordinator.getLongRunningByGroup().get(GROUP_ID.toString()).size()
== 1);
- tec =
coordinator.getLongRunningByGroup().get(GROUP_ID.toString()).iterator().next();
- assertEquals(GROUP_ID, ResourceGroupId.of(tec.getGroupName()));
- assertEquals(tserverAddr.toString(), tec.getCompactor());
-
verify(job);
}
diff --git
a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
index 376568d550..9e53765c02 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
@@ -140,8 +140,6 @@ public class Monitor extends AbstractServer implements
Connection.Listener {
private ManagerMonitorInfo mmi;
private GCStatus gcStatus;
private volatile Optional<HostAndPort> coordinatorHost = Optional.empty();
- private final String coordinatorMissingMsg =
- "Error getting the compaction coordinator client. Check that the Manager
is running.";
private EmbeddedWebServer server;
private int livePort = 0;
diff --git
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
index 3a30fda67f..f52c69e0ce 100644
---
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
+++
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
@@ -32,14 +32,11 @@ import java.util.stream.Collectors;
import jakarta.inject.Inject;
import jakarta.servlet.http.HttpServletRequest;
-import jakarta.validation.constraints.NotNull;
-import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
@@ -48,17 +45,17 @@ import
org.apache.accumulo.core.client.admin.TabletInformation;
import org.apache.accumulo.core.client.admin.servers.ServerId;
import org.apache.accumulo.core.data.ResourceGroupId;
import org.apache.accumulo.core.data.TableId;
-import org.apache.accumulo.core.metadata.schema.ExternalCompactionId;
import org.apache.accumulo.core.metrics.flatbuffers.FMetric;
import org.apache.accumulo.core.process.thrift.MetricResponse;
+import org.apache.accumulo.core.util.compaction.RunningCompactionInfo;
import org.apache.accumulo.monitor.Monitor;
import org.apache.accumulo.monitor.next.InformationFetcher.InstanceSummary;
import org.apache.accumulo.monitor.next.SystemInformation.ProcessSummary;
import org.apache.accumulo.monitor.next.SystemInformation.TableSummary;
+import
org.apache.accumulo.monitor.next.SystemInformation.TimeOrderedRunningCompactionSet;
import org.apache.accumulo.monitor.next.ec.CompactorsSummary;
import org.apache.accumulo.monitor.next.ec.CoordinatorSummary;
-import org.apache.accumulo.monitor.next.ec.RunningCompactionDetails;
-import org.apache.accumulo.monitor.next.ec.RunningCompactionsSummary;
+import
org.apache.accumulo.monitor.next.endpoint.responses.RunningCompactionsSummary;
import org.apache.accumulo.monitor.next.sservers.ScanServerView;
import io.micrometer.core.instrument.Meter.Id;
@@ -329,6 +326,35 @@ public class Endpoints {
return
monitor.getInformationFetcher().getSummaryForEndpoint().getCompactionMetricSummary();
}
+ @GET
+ @Path("compactions/running")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Description("Returns all long running major compactions")
+ public RunningCompactionsSummary getCompactions() {
+ Map<String,TimeOrderedRunningCompactionSet> longRunning =
+
monitor.getInformationFetcher().getSummaryForEndpoint().getTopRunningCompactions();
+ return new RunningCompactionsSummary(
+
longRunning.values().stream().flatMap(TimeOrderedRunningCompactionSet::stream).distinct()
+ .sorted(TimeOrderedRunningCompactionSet.OLDEST_FIRST_COMPARATOR)
+ .map(RunningCompactionInfo::new).collect(Collectors.toList()));
+ }
+
+ @GET
+ @Path("compactions/running/{" + GROUP_PARAM_KEY + "}")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Description("Returns all long running major compactions for the resource
group")
+ public RunningCompactionsSummary
+ getCompactions(@PathParam(GROUP_PARAM_KEY) String resourceGroup) {
+ validateResourceGroup(resourceGroup);
+ TimeOrderedRunningCompactionSet longRunning =
monitor.getInformationFetcher()
+ .getSummaryForEndpoint().getTopRunningCompactions().get(resourceGroup);
+ if (longRunning == null) {
+ return new RunningCompactionsSummary(List.of());
+ }
+ return new RunningCompactionsSummary(
+
longRunning.stream().map(RunningCompactionInfo::new).collect(Collectors.toList()));
+ }
+
@GET
@Path("ec")
@Produces(MediaType.APPLICATION_JSON)
@@ -348,33 +374,6 @@ public class Endpoints {
return new CompactorsSummary(summary.getCompactorServers(),
summary.getTimestamp());
}
- @GET
- @Path("ec/running")
- @Produces(MediaType.APPLICATION_JSON)
- @Description("Returns the 50 longest-running External Compactions for the
UI")
- public RunningCompactionsSummary getExternalCompactions() {
- return new RunningCompactionsSummary(
-
monitor.getInformationFetcher().getSummaryForEndpoint().getTopRunningCompactions());
- }
-
- @GET
- @Path("ec/details")
- @Produces(MediaType.APPLICATION_JSON)
- @Description("Returns details for a running External Compaction by ECID")
- public RunningCompactionDetails
- getExternalCompactionDetails(@QueryParam("ecid") @NotNull String ecid) {
- if (ecid.isBlank()) {
- throw new BadRequestException("Missing required query parameter: ecid");
- }
- final var externalCompactionId = ExternalCompactionId.from(ecid);
- var runningCompaction =
monitor.getInformationFetcher().getSummaryForEndpoint()
- .getRunningCompactions().get(externalCompactionId.canonical());
- if (runningCompaction == null) {
- throw new IllegalStateException("Failed to find details for ECID: " +
externalCompactionId);
- }
- return new RunningCompactionDetails(runningCompaction);
- }
-
@GET
@Path("tables")
@Produces(MediaType.APPLICATION_JSON)
diff --git
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/InformationFetcher.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/InformationFetcher.java
index 428ae1da00..cb67c61fc4 100644
---
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/InformationFetcher.java
+++
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/InformationFetcher.java
@@ -24,7 +24,6 @@ import java.time.Duration;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
@@ -42,8 +41,6 @@ import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.TabletInformation;
import org.apache.accumulo.core.client.admin.servers.ServerId;
import org.apache.accumulo.core.client.admin.servers.ServerId.Type;
-import org.apache.accumulo.core.compaction.thrift.CompactionCoordinatorService;
-import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.RowRange;
import org.apache.accumulo.core.data.TableId;
@@ -53,9 +50,9 @@ import org.apache.accumulo.core.rpc.ThriftUtil;
import org.apache.accumulo.core.rpc.clients.ThriftClientTypes;
import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
import org.apache.accumulo.core.util.threads.ThreadPools;
import org.apache.accumulo.server.ServerContext;
-import org.apache.thrift.transport.TTransportException;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.eclipse.jetty.util.NanoTime;
import org.slf4j.Logger;
@@ -169,55 +166,26 @@ public class InformationFetcher implements
RemovalListener<ServerId,MetricRespon
}
}
- private class CompactionListFetcher implements Runnable {
-
- private final String coordinatorMissingMsg =
- "Error getting the compaction coordinator client. Check that the
Manager is running.";
+ private class RunningCompactionFetcher implements Runnable {
private final SystemInformation summary;
+ private final ThreadPoolExecutor executor;
- public CompactionListFetcher(SystemInformation summary) {
+ public RunningCompactionFetcher(SystemInformation summary,
ThreadPoolExecutor executor) {
this.summary = summary;
- }
-
- private Map<String,TExternalCompaction> getRunningCompactions() {
- Set<ServerId> managers =
ctx.instanceOperations().getServers(ServerId.Type.MANAGER);
- if (managers.isEmpty()) {
- throw new IllegalStateException(coordinatorMissingMsg);
- }
- ServerId manager = managers.iterator().next();
- HostAndPort hp = HostAndPort.fromParts(manager.getHost(),
manager.getPort());
- try {
- CompactionCoordinatorService.Client client =
- ThriftUtil.getClient(ThriftClientTypes.COORDINATOR, hp, ctx);
- try {
- var running = client.getRunningCompactions(TraceUtil.traceInfo(),
ctx.rpcCreds());
- if (running == null || running.getCompactions() == null) {
- return Map.of();
- }
- return running.getCompactions();
- } catch (Exception e) {
- throw new IllegalStateException("Unable to get running compactions
from " + hp, e);
- } finally {
- if (client != null) {
- ThriftUtil.returnClient(client, ctx);
- }
- }
- } catch (TTransportException e) {
- LOG.error("Unable to get Compaction coordinator at {}", hp, e);
- throw new IllegalStateException(coordinatorMissingMsg, e);
- }
+ this.executor = executor;
}
@Override
public void run() {
try {
- summary.processExternalCompactions(getRunningCompactions());
+ List<ServerId> failures =
ExternalCompactionUtil.getCompactionsRunningOnCompactors(ctx,
+ executor, (t) -> summary.processExternalCompaction(t));
+ summary.getProblemHosts().addAll(failures);
} catch (Exception e) {
LOG.warn("Error gathering running compaction information.", e);
}
}
-
}
private final String poolName = "MonitorMetricsThreadPool";
@@ -329,8 +297,8 @@ public class InformationFetcher implements
RemovalListener<ServerId,MetricRespon
}
ThreadPools.resizePool(pool, () -> Math.max(20, (futures.size() / 20)),
poolName);
- // Fetch external compaction information from the Manager
- futures.add(this.pool.submit(new CompactionListFetcher(summary)));
+ // Fetch external compaction information from the Compactors
+ futures.add(this.pool.submit(new RunningCompactionFetcher(summary,
pool)));
// Fetch Tablet / Tablet information from the metadata table
for (TableId tableId :
this.ctx.createQualifiedTableNameToIdMap().values()) {
diff --git
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
index 5ceb09ffe5..36bf500a99 100644
---
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
+++
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
@@ -24,14 +24,17 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Stream;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.admin.TabletAvailability;
@@ -39,6 +42,7 @@ import
org.apache.accumulo.core.client.admin.TabletInformation;
import org.apache.accumulo.core.client.admin.TabletMergeabilityInfo;
import org.apache.accumulo.core.client.admin.servers.ServerId;
import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
+import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.ResourceGroupId;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.data.TabletId;
@@ -50,7 +54,6 @@ import org.apache.accumulo.core.metrics.flatbuffers.FMetric;
import org.apache.accumulo.core.metrics.flatbuffers.FTag;
import org.apache.accumulo.core.process.thrift.MetricResponse;
import org.apache.accumulo.core.spi.balancer.TableLoadBalancer;
-import org.apache.accumulo.core.util.compaction.RunningCompactionInfo;
import org.apache.accumulo.monitor.next.sservers.ScanServerView;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.conf.TableConfiguration;
@@ -297,6 +300,58 @@ public class SystemInformation {
}
+ // Object that serves as a TopN view of the RunningCompactions, ordered by
+ // RunningCompaction start time. The first entry in this Set should be the
+ // oldest RunningCompaction.
+ public static class TimeOrderedRunningCompactionSet {
+
+ public static final Comparator<TExternalCompaction>
OLDEST_FIRST_COMPARATOR =
+ Comparator.comparingLong(TExternalCompaction::getStartTime)
+ .thenComparing(rc -> rc.getJob().getExternalCompactionId());
+ private final ConcurrentSkipListSet<TExternalCompaction> compactions =
+ new ConcurrentSkipListSet<>(OLDEST_FIRST_COMPARATOR);
+
+ // Tracking size here as ConcurrentSkipListSet.size() is not constant time
+ private final AtomicInteger size = new AtomicInteger(0);
+
+ private final int limit;
+
+ public TimeOrderedRunningCompactionSet(int limit) {
+ this.limit = limit;
+ }
+
+ public int size() {
+ return size.get();
+ }
+
+ public boolean add(TExternalCompaction e) {
+ boolean added = compactions.add(e);
+ if (added) {
+ if (size.incrementAndGet() > this.limit) {
+ this.remove(compactions.last());
+ }
+ }
+ return added;
+ }
+
+ public boolean remove(Object o) {
+ boolean removed = compactions.remove(o);
+ if (removed) {
+ size.decrementAndGet();
+ }
+ return removed;
+ }
+
+ public Iterator<TExternalCompaction> iterator() {
+ return compactions.iterator();
+ }
+
+ public Stream<TExternalCompaction> stream() {
+ return compactions.stream();
+ }
+
+ }
+
private static final Logger LOG =
LoggerFactory.getLogger(SystemInformation.class);
private final DistributionStatisticConfig DSC =
@@ -336,12 +391,12 @@ public class SystemInformation {
new ConcurrentHashMap<>();
// Compaction Information
- private static final int ACTIVE_COMPACTIONS_LIMIT = 50;
private final Map<String,List<FMetric>> queueMetrics = new
ConcurrentHashMap<>();
private volatile Set<ServerId> registeredCompactors = Set.of();
private volatile HostAndPort coordinatorHost;
- private volatile Map<String,TExternalCompaction> runningCompactions =
Map.of();
- private volatile List<RunningCompactionInfo> runningCompactionsTop =
List.of();
+
+ protected final Map<String,TimeOrderedRunningCompactionSet>
longRunningCompactionsByRg =
+ new ConcurrentHashMap<>();
// Table Information
private final Map<TableId,TableSummary> tables = new ConcurrentHashMap<>();
@@ -355,10 +410,13 @@ public class SystemInformation {
private long timestamp = 0;
private ScanServerView scanServerView;
+ private final int rgLongRunningCompactionSize;
public SystemInformation(Cache<ServerId,MetricResponse> allMetrics,
ServerContext ctx) {
this.allMetrics = allMetrics;
this.ctx = ctx;
+ this.rgLongRunningCompactionSize =
+
this.ctx.getConfiguration().getCount(Property.MONITOR_LONG_RUNNING_COMPACTION_LIMIT);
}
public void clear() {
@@ -376,8 +434,7 @@ public class SystemInformation {
queueMetrics.clear();
registeredCompactors = Set.of();
coordinatorHost = null;
- runningCompactions = Map.of();
- runningCompactionsTop = List.of();
+ longRunningCompactionsByRg.clear();
tables.clear();
tablets.clear();
deployment.clear();
@@ -484,12 +541,9 @@ public class SystemInformation {
}
}
- public void processExternalCompactions(Map<String,TExternalCompaction>
running) {
- if (running == null) {
- runningCompactions = Map.of();
- } else {
- runningCompactions = Map.copyOf(running);
- }
+ public void processExternalCompaction(TExternalCompaction tec) {
+ this.longRunningCompactionsByRg.computeIfAbsent(tec.getGroupName(),
+ k -> new
TimeOrderedRunningCompactionSet(rgLongRunningCompactionSize)).add(tec);
}
public void processExternalCompactionInventory(Set<ServerId> compactors,
HostAndPort host) {
@@ -541,8 +595,6 @@ public class SystemInformation {
timestamp = System.currentTimeMillis();
scanServerView = ScanServerView.fromMetrics(responses, scanServers.size(),
problemScanServerCount, timestamp);
- runningCompactionsTop =
- buildTopRunningCompactions(runningCompactions,
ACTIVE_COMPACTIONS_LIMIT);
}
public Set<String> getResourceGroups() {
@@ -612,12 +664,8 @@ public class SystemInformation {
return coordinatorHost;
}
- public Map<String,TExternalCompaction> getRunningCompactions() {
- return runningCompactions;
- }
-
- public List<RunningCompactionInfo> getTopRunningCompactions() {
- return runningCompactionsTop;
+ public Map<String,TimeOrderedRunningCompactionSet>
getTopRunningCompactions() {
+ return this.longRunningCompactionsByRg;
}
public Map<TableId,TableSummary> getTables() {
@@ -644,14 +692,4 @@ public class SystemInformation {
return this.scanServerView;
}
- private static List<RunningCompactionInfo>
- buildTopRunningCompactions(Map<String,TExternalCompaction>
allCompactions, int limit) {
- if (allCompactions == null || allCompactions.isEmpty()) {
- return List.of();
- }
- return allCompactions.values().stream().map(RunningCompactionInfo::new)
- .sorted(Comparator.comparingLong((RunningCompactionInfo r) ->
r.duration).reversed())
- .limit(limit).toList();
- }
-
}
diff --git
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/ec/CompactionInputFileDetails.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/ec/CompactionInputFileDetails.java
deleted file mode 100644
index 33aa05a537..0000000000
---
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/ec/CompactionInputFileDetails.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.monitor.next.ec;
-
-// Variable names become JSON keys
-public record CompactionInputFileDetails(String metadataFileEntry, long size,
long entries,
- long timestamp) {
-}
diff --git
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/ec/RunningCompactionDetails.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/ec/RunningCompactionDetails.java
deleted file mode 100644
index c3e605708e..0000000000
---
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/ec/RunningCompactionDetails.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.accumulo.monitor.next.ec;
-
-import java.util.Comparator;
-import java.util.List;
-
-import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
-import org.apache.accumulo.core.tabletserver.thrift.InputFile;
-import org.apache.accumulo.core.util.compaction.RunningCompactionInfo;
-
-public class RunningCompactionDetails extends RunningCompactionInfo {
-
- // Variable names become JSON keys
- public final List<CompactionInputFileDetails> inputFiles;
- public final String outputFile;
-
- public RunningCompactionDetails(TExternalCompaction ec) {
- super(ec);
- var job = ec.getJob();
- this.inputFiles = convertInputFiles(job.files);
- this.outputFile = job.outputFile;
- }
-
- /**
- * @return a list of {@link CompactionInputFileDetails} sorted largest to
smallest
- */
- private List<CompactionInputFileDetails> convertInputFiles(List<InputFile>
files) {
- return files.stream()
- .map(file -> new CompactionInputFileDetails(file.metadataFileEntry,
file.size, file.entries,
- file.timestamp))
-
.sorted(Comparator.comparingLong(CompactionInputFileDetails::size).reversed()).toList();
- }
-}
diff --git
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/ec/RunningCompactionsSummary.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/endpoint/responses/RunningCompactionsSummary.java
similarity index 95%
rename from
server/monitor/src/main/java/org/apache/accumulo/monitor/next/ec/RunningCompactionsSummary.java
rename to
server/monitor/src/main/java/org/apache/accumulo/monitor/next/endpoint/responses/RunningCompactionsSummary.java
index 4f39a41c78..de42d0c5b2 100644
---
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/ec/RunningCompactionsSummary.java
+++
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/endpoint/responses/RunningCompactionsSummary.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.accumulo.monitor.next.ec;
+package org.apache.accumulo.monitor.next.endpoint.responses;
import java.util.List;
import java.util.Map;
diff --git
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/ec.js
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/ec.js
index aee5b09996..f41c0c6831 100644
---
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/ec.js
+++
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/ec.js
@@ -41,7 +41,7 @@ $(function () {
runningTable = $('#runningTable').DataTable({
"autoWidth": false,
"ajax": {
- "url": contextPath + 'rest-v2/ec/running',
+ "url": contextPath + 'rest-v2/compactions/running',
"dataSrc": "running"
},
"stateSave": true,
diff --git
a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_3_IT.java
b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_3_IT.java
index 259c54ea5d..9c855ba390 100644
---
a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_3_IT.java
+++
b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_3_IT.java
@@ -42,11 +42,9 @@ import java.util.stream.Collectors;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.compaction.thrift.CompactionCoordinatorService;
import org.apache.accumulo.core.compaction.thrift.TCompactionState;
import org.apache.accumulo.core.compaction.thrift.TCompactionStatusUpdate;
import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
-import org.apache.accumulo.core.compaction.thrift.TExternalCompactionList;
import org.apache.accumulo.core.compaction.thrift.TExternalCompactionMap;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.TableId;
@@ -55,9 +53,6 @@ import
org.apache.accumulo.core.metadata.schema.ExternalCompactionId;
import org.apache.accumulo.core.metadata.schema.TabletMetadata;
import org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType;
import org.apache.accumulo.core.metadata.schema.TabletsMetadata;
-import org.apache.accumulo.core.rpc.ThriftUtil;
-import org.apache.accumulo.core.rpc.clients.ThriftClientTypes;
-import org.apache.accumulo.core.trace.TraceUtil;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
import org.apache.accumulo.core.util.compaction.RunningCompactionInfo;
@@ -204,10 +199,6 @@ public class ExternalCompaction_3_IT extends
SharedMiniClusterBase {
} while (originalRunningInfo == null
|| originalRunningInfo.values().stream().allMatch(rci ->
rci.duration == 0));
- Map<String,TExternalCompactionList> longestRunning =
getLongRunningCompactions(ctx);
- assertTrue(longestRunning.containsKey(GROUP2));
- assertEquals(originalRunningInfo.size(),
longestRunning.get(GROUP2).getCompactions().size());
-
// Stop the Manager (Coordinator)
getCluster().getClusterControl().stop(ServerType.MANAGER);
@@ -227,11 +218,6 @@ public class ExternalCompaction_3_IT extends
SharedMiniClusterBase {
assertTrue(lastState.equals(TCompactionState.IN_PROGRESS.name()));
}
- longestRunning = getLongRunningCompactions(ctx);
- assertTrue(longestRunning.containsKey(GROUP2));
- assertEquals(postRestartRunningInfo.size(),
- longestRunning.get(GROUP2).getCompactions().size());
-
// We need to cancel the compaction or delete the table here because we
initiate a user
// compaction above in the test. Even though the external compaction was
cancelled
// because we split the table, FaTE will continue to queue up a
compaction
@@ -279,31 +265,4 @@ public class ExternalCompaction_3_IT extends
SharedMiniClusterBase {
return results;
}
- private Map<String,TExternalCompactionList>
getLongRunningCompactions(ServerContext ctx)
- throws InterruptedException {
-
- Map<String,TExternalCompactionList> results = new HashMap<>();
-
- while (results.isEmpty()) {
- try {
- Optional<HostAndPort> coordinatorHost =
- ExternalCompactionUtil.findCompactionCoordinator(ctx);
- if (coordinatorHost.isEmpty()) {
- throw new TTransportException(
- "Unable to get CompactionCoordinator address from ZooKeeper");
- }
- CompactionCoordinatorService.Client client =
- ThriftUtil.getClient(ThriftClientTypes.COORDINATOR,
coordinatorHost.orElseThrow(), ctx);
- try {
- results = client.getLongRunningCompactions(TraceUtil.traceInfo(),
ctx.rpcCreds());
- } finally {
- ThriftUtil.returnClient(client, ctx);
- }
- } catch (TException t) {
- Thread.sleep(2000);
- }
- }
- return results;
- }
-
}
diff --git
a/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
b/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
index 5b7993403b..75faf0664f 100644
---
a/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
+++
b/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
@@ -28,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.time.Duration;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -35,6 +36,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import org.apache.accumulo.core.Constants;
@@ -45,6 +47,7 @@ import
org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.clientImpl.ClientContext;
import org.apache.accumulo.core.clientImpl.Namespace;
+import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
import org.apache.accumulo.core.data.TableId;
import org.apache.accumulo.core.fate.AdminUtil;
import org.apache.accumulo.core.fate.Fate;
@@ -508,7 +511,7 @@ public class FateConcurrencyIT extends
AccumuloClusterHarness {
@Test
public void multipleCompactions() throws InterruptedException, IOException {
- int tableCount = 4;
+ final int tableCount = 4;
// Start 4 Compactors for the default group
MiniAccumuloClusterImpl mini = (MiniAccumuloClusterImpl) getCluster();
@@ -524,8 +527,13 @@ public class FateConcurrencyIT extends
AccumuloClusterHarness {
assertEquals(tableCount,
tables.stream().map(SlowOps::getTableName).filter(this::findFate).count());
- Wait.waitFor(() -> tableCount
- ==
ExternalCompactionUtil.getCompactionsRunningOnCompactors((ClientContext)
client).size());
+ Wait.waitFor(() -> {
+ List<TExternalCompaction> compactions = new ArrayList<>();
+ AtomicInteger compactionCount = new AtomicInteger(0);
+ ExternalCompactionUtil.getCompactionsRunningOnCompactors((ClientContext)
client,
+ (t) -> compactionCount.incrementAndGet());
+ return compactions.size() == compactionCount.get();
+ });
tables.forEach(t -> {
try {
diff --git a/test/src/main/java/org/apache/accumulo/test/util/SlowOps.java
b/test/src/main/java/org/apache/accumulo/test/util/SlowOps.java
index 8e7a6c14b6..83a47d9f44 100644
--- a/test/src/main/java/org/apache/accumulo/test/util/SlowOps.java
+++ b/test/src/main/java/org/apache/accumulo/test/util/SlowOps.java
@@ -29,6 +29,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.AccumuloException;
@@ -221,14 +222,20 @@ public class SlowOps {
* wait for compaction to start on table - The compaction will acquire a
fate transaction lock
* that used to block a subsequent online command while the fate
transaction lock was held.
*/
- TableId tableId =
TableId.of(client.tableOperations().tableIdMap().get(tableName));
+ final TableId tableId =
TableId.of(client.tableOperations().tableIdMap().get(tableName));
do {
- boolean tableFound =
-
ExternalCompactionUtil.getCompactionsRunningOnCompactors((ClientContext)
client).stream()
- .map(rc ->
KeyExtent.fromThrift(rc.getJob().getExtent()).tableId())
- .anyMatch(tableId::equals);
+ final AtomicBoolean tableFound = new AtomicBoolean(false);
+ try {
+
ExternalCompactionUtil.getCompactionsRunningOnCompactors((ClientContext)
client, (e) -> {
+ if
(KeyExtent.fromThrift(e.getJob().getExtent()).tableId().equals(tableId)) {
+ tableFound.compareAndSet(false, true);
+ }
+ });
+ } catch (InterruptedException e) {
+ throw new IllegalStateException("Interruped while getting compactions
from compactors", e);
+ }
- if (tableFound) {
+ if (tableFound.get()) {
return true;
}