This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push:
new e16d51b457 Backport IdleProcessMetricsIT from #4764
e16d51b457 is described below
commit e16d51b457ae2dfb3fbc62745465baeaa5032580
Author: Christopher Tubbs <[email protected]>
AuthorDate: Fri Jul 26 07:24:41 2024 -0400
Backport IdleProcessMetricsIT from #4764
* Backport the fix for the unused variable from #4764
* Also, simplify a few trivial reflection related exceptions by using
ReflectiveOperationException base class when the individual child
classes are not needed
---
.../java/org/apache/accumulo/core/clientImpl/ClientContext.java | 5 +----
.../java/org/apache/accumulo/server/metrics/MetricsInfoImpl.java | 7 ++-----
.../apache/accumulo/manager/metrics/ReplicationMetricsTest.java | 2 +-
.../org/apache/accumulo/test/functional/IdleProcessMetricsIT.java | 4 +++-
4 files changed, 7 insertions(+), 11 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
index 75b63940ce..7c6ba76549 100644
--- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
+++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
@@ -28,7 +28,6 @@ import static java.util.concurrent.TimeUnit.SECONDS;
import static
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.LOCATION;
import java.lang.Thread.UncaughtExceptionHandler;
-import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.nio.file.Path;
import java.util.Collection;
@@ -206,9 +205,7 @@ public class ClientContext implements AccumuloClient {
}
});
return scanServerSelector;
- } catch (ClassNotFoundException | InstantiationException |
IllegalAccessException
- | IllegalArgumentException | InvocationTargetException |
NoSuchMethodException
- | SecurityException e) {
+ } catch (ReflectiveOperationException | IllegalArgumentException |
SecurityException e) {
throw new RuntimeException("Error creating ScanServerSelector
implementation: " + clazz, e);
}
}
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsInfoImpl.java
b/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsInfoImpl.java
index b1fcb8fa83..9053567dd5 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsInfoImpl.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/metrics/MetricsInfoImpl.java
@@ -20,7 +20,6 @@ package org.apache.accumulo.server.metrics;
import static org.apache.hadoop.util.StringUtils.getTrimmedStrings;
-import java.lang.reflect.InvocationTargetException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
@@ -247,8 +246,7 @@ public class MetricsInfoImpl implements MetricsInfo {
registry.config().commonTags(commonTags.values());
registry.config().meterFilter(replicationFilter);
addRegistry(registry);
- } catch (ClassNotFoundException | NoSuchMethodException |
InvocationTargetException
- | InstantiationException | IllegalAccessException ex) {
+ } catch (ReflectiveOperationException ex) {
LOG.warn("Could not load registry {}", factoryName, ex);
}
}
@@ -270,8 +268,7 @@ public class MetricsInfoImpl implements MetricsInfo {
@VisibleForTesting
@SuppressWarnings("deprecation")
static MeterRegistry getRegistryFromFactory(final String factoryName, final
ServerContext context)
- throws ClassNotFoundException, NoSuchMethodException,
InvocationTargetException,
- InstantiationException, IllegalAccessException {
+ throws ReflectiveOperationException {
try {
LOG.info("look for meter spi registry factory {}", factoryName);
Class<? extends
org.apache.accumulo.core.spi.metrics.MeterRegistryFactory> clazz =
diff --git
a/server/manager/src/test/java/org/apache/accumulo/manager/metrics/ReplicationMetricsTest.java
b/server/manager/src/test/java/org/apache/accumulo/manager/metrics/ReplicationMetricsTest.java
index de9755e9a5..8e1312daeb 100644
---
a/server/manager/src/test/java/org/apache/accumulo/manager/metrics/ReplicationMetricsTest.java
+++
b/server/manager/src/test/java/org/apache/accumulo/manager/metrics/ReplicationMetricsTest.java
@@ -100,7 +100,7 @@ public class ReplicationMetricsTest {
}
private void replaceField(Object instance, String fieldName, Object target)
- throws NoSuchFieldException, IllegalAccessException {
+ throws ReflectiveOperationException {
Field field =
instance.getClass().getSuperclass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(instance, target);
diff --git
a/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java
b/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java
index c57cfc8480..e7a4e7418b 100644
---
a/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java
+++
b/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java
@@ -18,11 +18,13 @@
*/
package org.apache.accumulo.test.functional;
+import static
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.MAX_DATA;
import static
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.QUEUE1;
import static
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.compact;
import static
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.createTable;
import static
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.verify;
import static
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.writeData;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Duration;
@@ -219,7 +221,7 @@ public class IdleProcessMetricsIT extends
SharedMiniClusterBase {
try (Scanner scanner = client.createScanner(table1,
Authorizations.EMPTY)) {
scanner.setConsistencyLevel(ScannerBase.ConsistencyLevel.EVENTUAL);
- var ignored = scanner.stream().count();
+ assertEquals(MAX_DATA, scanner.stream().count());
}
log.info("Waiting for sserver to be not idle after starting a scan");