diff --git a/server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java b/server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java index d1831e164d76f..fa1348c82d71a 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java @@ -1052,8 +1052,7 @@ public void testDoNotInfinitelyWaitForMapping() { internalCluster().ensureAtLeastNumDataNodes(3); createIndex( "test", - indexSettings(1, 0) - .put("index.analysis.analyzer.test_analyzer.type", "custom") + indexSettings(1, 0).put("index.analysis.analyzer.test_analyzer.type", "custom") .put("index.analysis.analyzer.test_analyzer.tokenizer", "standard") .putList("index.analysis.analyzer.test_analyzer.filter", "test_token_filter") .build() diff --git a/server/src/internalClusterTest/java/org/elasticsearch/monitor/metrics/NodeIndexingMetricsIT.java b/server/src/internalClusterTest/java/org/elasticsearch/monitor/metrics/NodeIndexingMetricsIT.java index 75357c7011bcf..77c4c5a804f77 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/monitor/metrics/NodeIndexingMetricsIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/monitor/metrics/NodeIndexingMetricsIT.java @@ -32,10 +32,8 @@ import org.elasticsearch.index.analysis.AbstractTokenFilterFactory; import org.elasticsearch.index.analysis.TokenFilterFactory; import org.elasticsearch.index.engine.VersionConflictEngineException; -import org.elasticsearch.index.mapper.DocumentParsingException; import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.indices.analysis.AnalysisModule; -import org.elasticsearch.indices.recovery.IndexRecoveryIT; import org.elasticsearch.plugins.AnalysisPlugin; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.PluginsService; @@ -98,9 +96,9 @@ public void testZeroMetricsForVersionConflictsForNonIndexingOperations() { ensureStableCluster(1); final TestTelemetryPlugin plugin = internalCluster().getInstance(PluginsService.class, dataNode) - .filterPlugins(TestTelemetryPlugin.class) - .findFirst() - .orElseThrow(); + .filterPlugins(TestTelemetryPlugin.class) + .findFirst() + .orElseThrow(); plugin.resetMeter(); assertAcked(prepareCreate("index_no_refresh", Settings.builder().put("index.refresh_interval", "-1"))); @@ -117,11 +115,10 @@ public void testZeroMetricsForVersionConflictsForNonIndexingOperations() { } { var e = expectThrows( - VersionConflictEngineException.class, - () -> client(dataNode).get( - new GetRequest(indexName, docId).version(10) - .versionType(randomFrom(VersionType.EXTERNAL, VersionType.EXTERNAL_GTE)) - ).actionGet() + VersionConflictEngineException.class, + () -> client(dataNode).get( + new GetRequest(indexName, docId).version(10).versionType(randomFrom(VersionType.EXTERNAL, VersionType.EXTERNAL_GTE)) + ).actionGet() ); assertThat(e.getMessage(), containsString("version conflict")); assertThat(e.status(), is(RestStatus.CONFLICT)); @@ -132,12 +129,12 @@ public void testZeroMetricsForVersionConflictsForNonIndexingOperations() { client(dataNode).admin().indices().prepareRefresh(indexName).get(); { var e = expectThrows( - VersionConflictEngineException.class, - () -> client(dataNode).get( - new GetRequest(indexName, docId).version(5) - .versionType(randomFrom(VersionType.EXTERNAL, VersionType.EXTERNAL_GTE)) - .realtime(false) - ).actionGet() + VersionConflictEngineException.class, + () -> client(dataNode).get( + new GetRequest(indexName, docId).version(5) + .versionType(randomFrom(VersionType.EXTERNAL, VersionType.EXTERNAL_GTE)) + .realtime(false) + ).actionGet() ); assertThat(e.getMessage(), containsString("version conflict")); assertThat(e.status(), is(RestStatus.CONFLICT)); @@ -186,9 +183,9 @@ public void testMetricsForIndexingVersionConflicts() { ensureStableCluster(1); final TestTelemetryPlugin plugin = internalCluster().getInstance(PluginsService.class, dataNode) - .filterPlugins(TestTelemetryPlugin.class) - .findFirst() - .orElseThrow(); + .filterPlugins(TestTelemetryPlugin.class) + .findFirst() + .orElseThrow(); plugin.resetMeter(); assertAcked( @@ -223,9 +220,9 @@ public void testMetricsForIndexingVersionConflicts() { // if_seq_no conflict { var e = expectThrows( - VersionConflictEngineException.class, - () -> client(dataNode).index(new IndexRequest("test").id(docId).source(Map.of()).setIfSeqNo(1).setIfPrimaryTerm(1)) - .actionGet() + VersionConflictEngineException.class, + () -> client(dataNode).index(new IndexRequest("test").id(docId).source(Map.of()).setIfSeqNo(1).setIfPrimaryTerm(1)) + .actionGet() ); assertThat(e.getMessage(), containsString("version conflict")); assertThat(e.status(), is(RestStatus.CONFLICT)); @@ -250,10 +247,8 @@ public void testMetricsForIndexingVersionConflicts() { { var e = expectThrows( MapperParsingException.class, - () -> client(dataNode).index( - new IndexRequest("test").id(docId + "other") - .source(Map.of("test_field", "this will error")) - ).actionGet() + () -> client(dataNode).index(new IndexRequest("test").id(docId + "other").source(Map.of("test_field", "this will error"))) + .actionGet() ); assertThat(e.status(), is(RestStatus.BAD_REQUEST)); } @@ -268,7 +263,6 @@ public void testMetricsForIndexingVersionConflicts() { assertThat(measurements.get(1).attributes(), is(Map.of("es.indexing.indexing.failed.cause", "version_conflict"))); } - public static final class TestAnalysisPlugin extends Plugin implements AnalysisPlugin { final AtomicBoolean throwParsingError = new AtomicBoolean(false); diff --git a/server/src/main/java/org/elasticsearch/monitor/metrics/NodeMetrics.java b/server/src/main/java/org/elasticsearch/monitor/metrics/NodeMetrics.java index 66e733a4cf7c9..f6bce105ee591 100644 --- a/server/src/main/java/org/elasticsearch/monitor/metrics/NodeMetrics.java +++ b/server/src/main/java/org/elasticsearch/monitor/metrics/NodeMetrics.java @@ -29,7 +29,6 @@ import java.io.IOException; import java.net.InetAddress; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional;