diff --git a/benchmarks/src/main/java/org/opensearch/benchmark/routing/allocation/AllocationBenchmark.java b/benchmarks/src/main/java/org/opensearch/benchmark/routing/allocation/AllocationBenchmark.java index 1faf522f3a1c9..c8365c5cecdb7 100644 --- a/benchmarks/src/main/java/org/opensearch/benchmark/routing/allocation/AllocationBenchmark.java +++ b/benchmarks/src/main/java/org/opensearch/benchmark/routing/allocation/AllocationBenchmark.java @@ -143,7 +143,6 @@ public class AllocationBenchmark { public int clusterConcurrentRecoveries; private AllocationService initialClusterStrategy; - private AllocationService clusterExcludeStrategy; private AllocationService clusterZoneAwareExcludeStrategy; private ClusterState initialClusterState; diff --git a/benchmarks/src/main/java/org/opensearch/benchmark/routing/allocation/RerouteBenchmark.java b/benchmarks/src/main/java/org/opensearch/benchmark/routing/allocation/RerouteBenchmark.java index e54bca579423b..011fade1f2a58 100644 --- a/benchmarks/src/main/java/org/opensearch/benchmark/routing/allocation/RerouteBenchmark.java +++ b/benchmarks/src/main/java/org/opensearch/benchmark/routing/allocation/RerouteBenchmark.java @@ -64,8 +64,6 @@ public void setUp() throws Exception { final String[] params = indicesNodes.split("\\|"); numIndices = toInt(params[0]); numNodes = toInt(params[1]); - - int totalShardCount = (numReplicas + 1) * numShards * numIndices; Metadata.Builder mb = Metadata.builder(); for (int i = 1; i <= numIndices; i++) { mb.put( diff --git a/build.gradle b/build.gradle index c4c2b0a3f5407..d175d2d7b9ce7 100644 --- a/build.gradle +++ b/build.gradle @@ -28,47 +28,46 @@ * under the License. */ -import java.nio.charset.StandardCharsets; -import java.io.ByteArrayOutputStream; import com.avast.gradle.dockercompose.tasks.ComposePull import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin import org.apache.tools.ant.taskdefs.condition.Os +import org.gradle.plugins.ide.eclipse.model.AccessRule +import org.gradle.plugins.ide.eclipse.model.SourceFolder import org.opensearch.gradle.BuildPlugin +import org.opensearch.gradle.CheckCompatibilityTask import org.opensearch.gradle.Version import org.opensearch.gradle.VersionProperties import org.opensearch.gradle.info.BuildParams import org.opensearch.gradle.plugin.PluginBuildPlugin import org.opensearch.gradle.tar.SymbolicLinkPreservingTar -import org.gradle.plugins.ide.eclipse.model.AccessRule -import org.gradle.plugins.ide.eclipse.model.EclipseJdt -import org.gradle.plugins.ide.eclipse.model.SourceFolder -import org.gradle.api.Project; -import org.gradle.process.ExecResult; -import org.opensearch.gradle.CheckCompatibilityTask + +import java.nio.charset.StandardCharsets import static org.opensearch.gradle.util.GradleUtils.maybeConfigure plugins { + id "test-report-aggregation" + id 'jacoco-report-aggregation' id 'lifecycle-base' id 'opensearch.docker-support' id 'opensearch.global-build-info' - id "com.diffplug.spotless" version "6.25.0" apply false + id "com.diffplug.spotless" version "7.1.0" apply false id "org.gradle.test-retry" version "1.6.2" apply false - id "test-report-aggregation" - id 'jacoco-report-aggregation' + id "org.openrewrite.rewrite" version "7.11.0" apply false } apply from: 'gradle/build-complete.gradle' -apply from: 'gradle/runtime-jdk-provision.gradle' -apply from: 'gradle/ide.gradle' +apply from: 'gradle/code-convention.gradle' +apply from: 'gradle/code-coverage.gradle' apply from: 'gradle/forbidden-dependencies.gradle' apply from: 'gradle/formatting.gradle' +apply from: 'gradle/ide.gradle' apply from: 'gradle/local-distribution.gradle' -apply from: 'gradle/run.gradle' apply from: 'gradle/missing-javadoc.gradle' -apply from: 'gradle/code-coverage.gradle' +apply from: 'gradle/run.gradle' +apply from: 'gradle/runtime-jdk-provision.gradle' // common maven publishing configuration allprojects { @@ -76,7 +75,31 @@ allprojects { version = VersionProperties.getOpenSearch() description = "OpenSearch subproject ${project.path}" } - +allprojects { + configurations.configureEach { + resolutionStrategy { + force( + 'org.jetbrains:annotations:26.0.2', + 'org.apache.commons:commons-text:1.13.1', + 'org.ow2.asm:asm:9.8', + 'org.ow2.asm:asm-util:9.8', + ) + eachDependency { details -> + if (details.requested.group.startsWith('com.fasterxml.jackson')) { + details.useVersion '2.17.3' + } + if (details.requested.group == 'org.openrewrite.recipe' && + details.requested.name == 'rewrite-java-dependencies') { + details.useVersion '1.37.0' + } + if (details.requested.group == 'com.google.errorprone' && + details.requested.name == 'error_prone_annotations') { + details.useVersion '2.36.0' + } + } + } + } +} configure(allprojects - project(':distribution:archives:integ-test-zip')) { project.pluginManager.withPlugin('nebula.maven-base-publish') { if (project.pluginManager.hasPlugin('opensearch.build') == false) { diff --git a/buildSrc/src/test/java/org/opensearch/gradle/pluginzip/PublishTests.java b/buildSrc/src/test/java/org/opensearch/gradle/pluginzip/PublishTests.java index 8e246ff9ecd11..f7edc453e5670 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/pluginzip/PublishTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/pluginzip/PublishTests.java @@ -142,22 +142,22 @@ public void applyZipPublicationPluginWithConfig() throws IOException, URISyntaxE // and how these tasks are chained. The problem is that there is a known gradle issue (#20301) that does // not allow for it ATM. If, however, it is fixed in the future the following is the code that can // be used... - + Project project = ProjectBuilder.builder().build(); project.getPluginManager().apply(Publish.class); // add publications via API - + // evaluate the project ((DefaultProject)project).evaluate(); - + // - Check that "validatePluginZipPom" and/or "publishPluginZipPublicationToZipStagingRepository" // tasks have dependencies on "generatePomFileForNebulaPublication". // - Check that there is the staging repository added. - + // However, due to known issue(1): https://github.com/gradle/gradle/issues/20301 // it is impossible to reach to individual tasks and work with them. // (1): https://docs.gradle.org/7.4/release-notes.html#known-issues - + // I.e.: The following code throws exception, basically any access to individual tasks fails. project.getTasks().getByName("validatePluginZipPom"); ------------------------------- */ diff --git a/client/rest-high-level/src/test/java/org/opensearch/client/documentation/CRUDDocumentationIT.java b/client/rest-high-level/src/test/java/org/opensearch/client/documentation/CRUDDocumentationIT.java index 123a51a54788e..6dda130f121f0 100644 --- a/client/rest-high-level/src/test/java/org/opensearch/client/documentation/CRUDDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/opensearch/client/documentation/CRUDDocumentationIT.java @@ -1941,10 +1941,10 @@ public void testMultiGet() throws Exception { MultiGetItemResponse missingIndexItem = response.getResponses()[2]; // tag::multi-get-indexnotfound assertNull(missingIndexItem.getResponse()); // <1> - Exception e = missingIndexItem.getFailure().getFailure(); // <2> - OpenSearchException ee = (OpenSearchException) e; // <3> + Exception e = missingIndexItem.getFailure().getFailure(); // <3> // TODO status is broken! fix in a followup // assertEquals(RestStatus.NOT_FOUND, ee.status()); // <4> + // <2> assertThat(e.getMessage(), containsString("reason=no such index [missing_index]")); // <5> // end::multi-get-indexnotfound @@ -2033,10 +2033,10 @@ public void onFailure(Exception e) { MultiGetResponse response = client.mget(request, RequestOptions.DEFAULT); MultiGetItemResponse item = response.getResponses()[0]; assertNull(item.getResponse()); // <1> - Exception e = item.getFailure().getFailure(); // <2> - OpenSearchException ee = (OpenSearchException) e; // <3> + Exception e = item.getFailure().getFailure(); // <3> // TODO status is broken! fix in a followup // assertEquals(RestStatus.CONFLICT, ee.status()); // <4> + // <2> assertThat(e.getMessage(), containsString("version conflict, current version [1] is " + "different than the one provided [1000]")); // <5> diff --git a/client/sniffer/licenses/jackson-core-2.17.3.jar.sha1 b/client/sniffer/licenses/jackson-core-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..13c532bb8cfc9 --- /dev/null +++ b/client/sniffer/licenses/jackson-core-2.17.3.jar.sha1 @@ -0,0 +1 @@ +1d6eb3e959c737692b720d3492b2f1f34c4c8579 \ No newline at end of file diff --git a/client/sniffer/licenses/jackson-core-2.18.2.jar.sha1 b/client/sniffer/licenses/jackson-core-2.18.2.jar.sha1 deleted file mode 100644 index 96350c9307ae7..0000000000000 --- a/client/sniffer/licenses/jackson-core-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -fb64ccac5c27dca8819418eb4e443a9f496d9ee7 \ No newline at end of file diff --git a/distribution/tools/plugin-cli/src/main/java/org/opensearch/tools/cli/plugin/InstallPluginCommand.java b/distribution/tools/plugin-cli/src/main/java/org/opensearch/tools/cli/plugin/InstallPluginCommand.java index ea76e051d253e..b8b0f44e42e5c 100644 --- a/distribution/tools/plugin-cli/src/main/java/org/opensearch/tools/cli/plugin/InstallPluginCommand.java +++ b/distribution/tools/plugin-cli/src/main/java/org/opensearch/tools/cli/plugin/InstallPluginCommand.java @@ -701,7 +701,6 @@ private Path unzip(Path zip, Path pluginsDir) throws IOException, UserException try (ZipFile zipFile = new ZipFile(zip, "UTF8", true, false)) { final Enumeration entries = zipFile.getEntries(); ZipArchiveEntry entry; - byte[] buffer = new byte[8192]; while (entries.hasMoreElements()) { entry = entries.nextElement(); if (entry.getName().startsWith("opensearch/")) { diff --git a/distribution/tools/plugin-cli/src/test/java/org/opensearch/tools/cli/plugin/InstallPluginCommandTests.java b/distribution/tools/plugin-cli/src/test/java/org/opensearch/tools/cli/plugin/InstallPluginCommandTests.java index 70cccc94a26f9..40acb58fc5247 100644 --- a/distribution/tools/plugin-cli/src/test/java/org/opensearch/tools/cli/plugin/InstallPluginCommandTests.java +++ b/distribution/tools/plugin-cli/src/test/java/org/opensearch/tools/cli/plugin/InstallPluginCommandTests.java @@ -398,9 +398,7 @@ void assertConfigAndBin(String name, Path original, Environment env) throws IOEx Path binDir = env.binDir().resolve(name); assertTrue("bin dir exists", Files.exists(binDir)); assertTrue("bin is a dir", Files.isDirectory(binDir)); - PosixFileAttributes binAttributes = null; if (isPosix) { - binAttributes = Files.readAttributes(env.binDir(), PosixFileAttributes.class); } try (DirectoryStream stream = Files.newDirectoryStream(binDir)) { for (Path file : stream) { diff --git a/gradle.properties b/gradle.properties index 47c3efdfbd2a0..18d264255bc6f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,8 @@ org.gradle.caching=true org.gradle.warning.mode=none org.gradle.parallel=true +# https://github.com/openrewrite/rewrite-gradle-plugin/issues/212 +org.gradle.workers.max=4 org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Xss2m \ --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ diff --git a/gradle/code-convention.gradle b/gradle/code-convention.gradle new file mode 100644 index 0000000000000..3bfb7d338b8fa --- /dev/null +++ b/gradle/code-convention.gradle @@ -0,0 +1,70 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch 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 + * + * http://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. + */ + +import org.opensearch.gradle.BuildPlugin + +import static java.lang.System.getenv + +allprojects { + plugins.withType(BuildPlugin).whenPluginAdded { + project.apply plugin: "org.openrewrite.rewrite" + rewrite { + activeRecipe("org.opensearch.openrewrite.recipe.CodeCleanup") + configFile = file("$rootDir/gradle/code-convention.yml") + exclusions.add("**OpenSearchTestCaseTests.java") + exclusions.add("**/simple-bulk11.json") + exclusions.add("**/simple-msearch5.json") + exclusions.add("**AbstractBenchmark.java") + exclusions.add("**ScriptClassPathResolutionContext.java") + exclusions.add("**StarTreeMapper.java") + exclusions.add("**SearchAfterIT.java") + failOnDryRunResults = true + } + repositories { + mavenCentral() + } + dependencies { + rewrite("org.openrewrite.recipe:rewrite-rewrite:0.9.0") + rewrite("org.openrewrite.recipe:rewrite-static-analysis:2.12.0") + } + tasks { + if (getenv("dogFoodDev")) { + assemble { + dependsOn(rewriteRun) + } + } + if (!getenv("skipDogFood")) { + check { + dependsOn(rewriteDryRun) + } + } + } + } +} diff --git a/gradle/code-convention.yml b/gradle/code-convention.yml new file mode 100644 index 0000000000000..5ddfdd9746123 --- /dev/null +++ b/gradle/code-convention.yml @@ -0,0 +1,16 @@ +type: specs.openrewrite.org/v1beta/recipe +name: org.opensearch.openrewrite.recipe.CodeCleanup +displayName: CodeCleanup +description: Automatically cleanup code, e.g. remove unnecessary parentheses, simplify expressions. +recipeList: + - org.openrewrite.java.RemoveUnusedImports + - org.openrewrite.staticanalysis.RemoveUnusedLocalVariables + - org.openrewrite.staticanalysis.RemoveUnusedPrivateFields + - org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods +# - org.openrewrite.staticanalysis.EmptyBlock +# - org.openrewrite.java.OrderImports +# - org.openrewrite.java.format.RemoveTrailingWhitespace +# - org.openrewrite.staticanalysis.EmptyBlock +# - org.openrewrite.staticanalysis.RemoveCallsToSystemGc +# - org.openrewrite.staticanalysis.UnnecessaryThrows +# - org.openrewrite.text.EndOfLineAtEndOfFile diff --git a/gradle/formatting.gradle b/gradle/formatting.gradle index 45d63fd43e875..af14ee4971d0f 100644 --- a/gradle/formatting.gradle +++ b/gradle/formatting.gradle @@ -30,84 +30,56 @@ import org.opensearch.gradle.BuildPlugin -/* - * This script plugin configures formatting for Java source using Spotless - * for Gradle. Since the act of formatting existing source can interfere - * with developers' workflows, we don't automatically format all code - * (yet). Instead, we maintain a list of projects that are excluded from - * formatting, until we reach a point where we can comfortably format them - * in one go without too much disruption. - * - * Any new sub-projects must not be added to the exclusions list! - * - * To perform a reformat, run: - * - * ./gradlew spotlessApply - * - * To check the current format, run: - * - * ./gradlew spotlessJavaCheck - * - * This is also carried out by the `precommit` task. - * - * For more about Spotless, see: - * - * https://github.com/diffplug/spotless/tree/master/plugin-gradle - */ +import static java.lang.System.getenv allprojects { plugins.withType(BuildPlugin).whenPluginAdded { - project.apply plugin: "com.diffplug.spotless" - - spotless { - java { - // Normally this isn't necessary, but we have Java sources in - // non-standard places - target '**/*.java' - - removeUnusedImports() - importOrder( - 'de.thetaphi', - 'com.carrotsearch', - 'com.fasterxml', - 'com.avast', - 'com.sun', - 'com.maxmind|com.github|com.networknt|groovy|nebula', - 'org.antlr', - 'software.amazon', - 'com.azure|com.microsoft|com.ibm|com.google|joptsimple|org.apache|org.bouncycastle|org.codehaus|org.opensearch|org.objectweb|org.joda|org.hamcrest|org.openjdk|org.gradle|org.junit', - 'javax', - 'java', - '', - '\\#java|\\#org.opensearch|\\#org.hamcrest|\\#' - ) - - eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('buildSrc/formatterConfig.xml') - trimTrailingWhitespace() - endWithNewline() - - custom 'Refuse wildcard imports', { - // Wildcard imports can't be resolved; fail the build - if (it =~ /\s+import .*\*;/) { - throw new AssertionError("Do not use wildcard imports. 'spotlessApply' cannot resolve this issue.") - } - } - - // See DEVELOPER_GUIDE.md for details of when to enable this. - if (System.getProperty('spotless.paddedcell') != null) { - paddedCell() - } + project.apply plugin: "com.diffplug.spotless" + spotless { + java { + // Normally this isn't necessary, but we have Java sources in + // non-standard places + target '**/*.java' + importOrder( + 'de.thetaphi', + 'com.carrotsearch', + 'com.fasterxml', + 'com.avast', + 'com.sun', + 'com.maxmind|com.github|com.networknt|groovy|nebula', + 'org.antlr', + 'software.amazon', + 'com.azure|com.microsoft|com.ibm|com.google|joptsimple|org.apache|org.bouncycastle|org.codehaus|org.opensearch|org.objectweb|org.joda|org.hamcrest|org.openjdk|org.gradle|org.junit', + 'javax', + 'java', + '', + '\\#java|\\#org.opensearch|\\#org.hamcrest|\\#' + ) + eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('buildSrc/formatterConfig.xml') + endWithNewline() + removeWildcardImports() + // See DEVELOPER_GUIDE.md for details of when to enable this. + if (System.getProperty('spotless.paddedcell') != null) { + paddedCell() } - format 'misc', { - target '*.md', '*.gradle', '**/*.json', '**/*.yaml', '**/*.yml', '**/*.svg' - - targetExclude '**/simple-bulk11.json', '**/simple-msearch5.json' - - trimTrailingWhitespace() - endWithNewline() + } + format 'misc', { + target '*.md', '*.gradle', '**/*.json', '**/*.yaml', '**/*.yml', '**/*.svg' + targetExclude '**/simple-bulk11.json', '**/simple-msearch5.json' + endWithNewline() + } + } + tasks { + if (getenv("dogFoodDev")) { + assemble { + dependsOn(spotlessJavaApply) } } - - precommit.dependsOn 'spotlessJavaCheck' + if (!getenv("skipDogFood")) { + check { + dependsOn(spotlessJavaCheck) + } + } + } } } diff --git a/gradle/rewrite.gradle b/gradle/rewrite.gradle new file mode 100644 index 0000000000000..bdc5fb8379f41 --- /dev/null +++ b/gradle/rewrite.gradle @@ -0,0 +1,74 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch 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 + * + * http://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. + */ + +import org.opensearch.gradle.BuildPlugin + +/** + * # - org.openrewrite.staticanalysis.ModifierOrder + # + # - org.openrewrite.java.format.RemoveTrailingWhitespace + # - org.openrewrite.java.recipes.JavaRecipeBestPractices + # - org.openrewrite.java.recipes.RecipeNullabilityBestPractices + # - org.openrewrite.java.recipes.RecipeTestingBestPractices + # - org.openrewrite.staticanalysis.EqualsAvoidsNull + # - org.openrewrite.staticanalysis.JavaApiBestPractices + # - org.openrewrite.staticanalysis.MissingOverrideAnnotation + # - org.openrewrite.staticanalysis.RemoveUnusedLocalVariables + # - org.openrewrite.staticanalysis.RemoveUnusedPrivateFields + # - org.openrewrite.staticanalysis.StringLiteralEquality + # - org.openrewrite.staticanalysis.WrappingAndBraces + # - org.openrewrite.text.EndOfLineAtEndOfFile + */ +allprojects { + plugins.withType(BuildPlugin).whenPluginAdded { + project.apply plugin: "org.openrewrite.rewrite" + rewrite { + activeRecipe("org.opensearch.openrewrite.recipe.CodeCleanup") + configFile = file("$rootDir/gradle/rewrite.yml") + exclusions.add("**OpenSearchTestCaseTests.java") + exclusions.add("**AbstractBenchmark.java") + exclusions.add("**ScriptClassPathResolutionContext.java") + exclusions.add("**StarTreeMapper.java") + failOnDryRunResults = true + } + repositories { + mavenCentral() + } + dependencies { + rewrite("org.openrewrite.recipe:rewrite-rewrite:0.9.0") + rewrite("org.openrewrite.recipe:rewrite-static-analysis:2.12.0") + } + tasks { + rewriteDryRun { + dependsOn(check) + } + } + } +} diff --git a/gradle/rewrite.yml b/gradle/rewrite.yml new file mode 100644 index 0000000000000..af2e9a77ec9db --- /dev/null +++ b/gradle/rewrite.yml @@ -0,0 +1,13 @@ +type: specs.openrewrite.org/v1beta/recipe +name: org.opensearch.openrewrite.recipe.CodeCleanup +displayName: CodeCleanup +description: Automatically cleanup code, e.g. remove unnecessary parentheses, simplify expressions. +recipeList: + - org.openrewrite.java.RemoveUnusedImports +# - org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods +# - org.openrewrite.java.format.RemoveTrailingWhitespace +# - org.openrewrite.staticanalysis.EmptyBlock +# - org.openrewrite.staticanalysis.RemoveCallsToSystemGc +# - org.openrewrite.staticanalysis.RemoveUnusedLocalVariables +# - org.openrewrite.staticanalysis.RemoveUnusedPrivateFields +# - org.openrewrite.staticanalysis.UnnecessaryThrows diff --git a/libs/agent-sm/agent/src/main/java/org/opensearch/javaagent/StackCallerProtectionDomainChainExtractor.java b/libs/agent-sm/agent/src/main/java/org/opensearch/javaagent/StackCallerProtectionDomainChainExtractor.java index 8c348a29ab69e..4d3e52c4196ea 100644 --- a/libs/agent-sm/agent/src/main/java/org/opensearch/javaagent/StackCallerProtectionDomainChainExtractor.java +++ b/libs/agent-sm/agent/src/main/java/org/opensearch/javaagent/StackCallerProtectionDomainChainExtractor.java @@ -24,8 +24,6 @@ public final class StackCallerProtectionDomainChainExtractor implements Function * Single instance of stateless class. */ public static final StackCallerProtectionDomainChainExtractor INSTANCE = new StackCallerProtectionDomainChainExtractor(); - - private static final StackWalker STACK_WALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); /** * Classes that are used to check if the stack frame is from AccessController. Temporarily supports both the * AccessController from the JDK (marked for removal) and its replacement in the Java Agent. diff --git a/libs/core/licenses/jackson-core-2.17.3.jar.sha1 b/libs/core/licenses/jackson-core-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..13c532bb8cfc9 --- /dev/null +++ b/libs/core/licenses/jackson-core-2.17.3.jar.sha1 @@ -0,0 +1 @@ +1d6eb3e959c737692b720d3492b2f1f34c4c8579 \ No newline at end of file diff --git a/libs/core/licenses/jackson-core-2.18.2.jar.sha1 b/libs/core/licenses/jackson-core-2.18.2.jar.sha1 deleted file mode 100644 index 96350c9307ae7..0000000000000 --- a/libs/core/licenses/jackson-core-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -fb64ccac5c27dca8819418eb4e443a9f496d9ee7 \ No newline at end of file diff --git a/libs/core/src/main/java/org/opensearch/core/xcontent/XContentBuilder.java b/libs/core/src/main/java/org/opensearch/core/xcontent/XContentBuilder.java index 552945d085884..987434a85d2f1 100644 --- a/libs/core/src/main/java/org/opensearch/core/xcontent/XContentBuilder.java +++ b/libs/core/src/main/java/org/opensearch/core/xcontent/XContentBuilder.java @@ -744,7 +744,7 @@ public XContentBuilder utf8Value(byte[] bytes, int offset, int length) throws IO /** * Write a time-based field and value, if the passed timeValue is null a * null value is written, otherwise a date transformers lookup is performed. - + * @throws IllegalArgumentException if there is no transformers for the type of object */ public XContentBuilder timeField(String name, Object timeValue) throws IOException { @@ -772,7 +772,7 @@ public XContentBuilder timeField(String name, String readableName, long value) t /** * Write a time-based value, if the value is null a null value is written, * otherwise a date transformers lookup is performed. - + * @throws IllegalArgumentException if there is no transformers for the type of object */ public XContentBuilder timeValue(Object timeValue) throws IOException { diff --git a/libs/dissect/src/main/java/org/opensearch/dissect/DissectParser.java b/libs/dissect/src/main/java/org/opensearch/dissect/DissectParser.java index 828d4b7de450e..c05f7a9816839 100644 --- a/libs/dissect/src/main/java/org/opensearch/dissect/DissectParser.java +++ b/libs/dissect/src/main/java/org/opensearch/dissect/DissectParser.java @@ -195,18 +195,18 @@ public DissectParser(String pattern, String appendSeparator) { */ public Map parse(String inputString) { /* - + This implements a naive string matching algorithm. The string is walked left to right, comparing each byte against another string's bytes looking for matches. If the bytes match, then a second cursor looks ahead to see if all the bytes of the other string matches. If they all match, record it and advances the primary cursor to the match point. If it can not match all of the bytes then progress the main cursor. Repeat till the end of the input string. Since the string being searching for (the delimiter) is generally small and rare the naive approach is efficient. - + In this case the string that is walked is the input string, and the string being searched for is the current delimiter. For example for a dissect pattern of {@code %{a},%{b}:%{c}} the delimiters (comma then colon) are searched for in the input string. At class construction the list of keys+delimiters are found (dissectPairs), which allows the use of that ordered list to know which delimiter to use for the search. The delimiters is progressed once the current delimiter is matched. - + There are two special cases that requires additional parsing beyond the standard naive algorithm. Consecutive delimiters should results in a empty matches unless the {@code ->} is provided. For example given the dissect pattern of {@code %{a},%{b},%{c},%{d}} and input string of {@code foo,,,} the match should be successful with empty values for b,c and d. diff --git a/libs/task-commons/src/main/java/org/opensearch/task/commons/clients/TaskListRequest.java b/libs/task-commons/src/main/java/org/opensearch/task/commons/clients/TaskListRequest.java index 625e15dfb3b6d..bc983ff71eb9c 100644 --- a/libs/task-commons/src/main/java/org/opensearch/task/commons/clients/TaskListRequest.java +++ b/libs/task-commons/src/main/java/org/opensearch/task/commons/clients/TaskListRequest.java @@ -10,7 +10,6 @@ import org.opensearch.task.commons.task.TaskStatus; import org.opensearch.task.commons.task.TaskType; -import org.opensearch.task.commons.worker.WorkerNode; /** * Request object for listing tasks @@ -27,11 +26,6 @@ public class TaskListRequest { */ private TaskType[] taskTypes; - /** - * Filter listTasks response by specific worker node - */ - private WorkerNode workerNodes; - /** * Depicts the start page number for the list call. * @@ -71,16 +65,6 @@ public TaskListRequest taskType(TaskStatus... taskStatus) { return this; } - /** - * Update worker node to filter with in the request - * @param workerNode WorkerNode - * @return ListTaskRequest - */ - private TaskListRequest workerNode(WorkerNode workerNode) { - this.workerNodes = workerNode; - return this; - } - /** * Update page number to start with when fetching the list of tasks * @param startPageNumber startPageNumber diff --git a/libs/x-content/licenses/jackson-core-2.17.3.jar.sha1 b/libs/x-content/licenses/jackson-core-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..13c532bb8cfc9 --- /dev/null +++ b/libs/x-content/licenses/jackson-core-2.17.3.jar.sha1 @@ -0,0 +1 @@ +1d6eb3e959c737692b720d3492b2f1f34c4c8579 \ No newline at end of file diff --git a/libs/x-content/licenses/jackson-core-2.18.2.jar.sha1 b/libs/x-content/licenses/jackson-core-2.18.2.jar.sha1 deleted file mode 100644 index 96350c9307ae7..0000000000000 --- a/libs/x-content/licenses/jackson-core-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -fb64ccac5c27dca8819418eb4e443a9f496d9ee7 \ No newline at end of file diff --git a/libs/x-content/licenses/jackson-dataformat-cbor-2.17.3.jar.sha1 b/libs/x-content/licenses/jackson-dataformat-cbor-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..6ff493a7256c9 --- /dev/null +++ b/libs/x-content/licenses/jackson-dataformat-cbor-2.17.3.jar.sha1 @@ -0,0 +1 @@ +5286b5df35824b8c2a8ceae9a54e99dca9220e15 \ No newline at end of file diff --git a/libs/x-content/licenses/jackson-dataformat-cbor-2.18.2.jar.sha1 b/libs/x-content/licenses/jackson-dataformat-cbor-2.18.2.jar.sha1 deleted file mode 100644 index 8b946b98ddbf9..0000000000000 --- a/libs/x-content/licenses/jackson-dataformat-cbor-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d4870757eff0344130f60e3ddb882b2336640f73 \ No newline at end of file diff --git a/libs/x-content/licenses/jackson-dataformat-smile-2.17.3.jar.sha1 b/libs/x-content/licenses/jackson-dataformat-smile-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..7d71c29876246 --- /dev/null +++ b/libs/x-content/licenses/jackson-dataformat-smile-2.17.3.jar.sha1 @@ -0,0 +1 @@ +cd19020c7bace93ce269e85ac6fee782a6bf4e16 \ No newline at end of file diff --git a/libs/x-content/licenses/jackson-dataformat-smile-2.18.2.jar.sha1 b/libs/x-content/licenses/jackson-dataformat-smile-2.18.2.jar.sha1 deleted file mode 100644 index 9fbdb9b3a2506..0000000000000 --- a/libs/x-content/licenses/jackson-dataformat-smile-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -44caf62d743bb5e5876e95efba5a55a1cab1b0db \ No newline at end of file diff --git a/libs/x-content/licenses/jackson-dataformat-yaml-2.17.3.jar.sha1 b/libs/x-content/licenses/jackson-dataformat-yaml-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..332ff6d34fdc1 --- /dev/null +++ b/libs/x-content/licenses/jackson-dataformat-yaml-2.17.3.jar.sha1 @@ -0,0 +1 @@ +536e9d9ee966cf40a8b5d2f9ba505551364d0ad5 \ No newline at end of file diff --git a/libs/x-content/licenses/jackson-dataformat-yaml-2.18.2.jar.sha1 b/libs/x-content/licenses/jackson-dataformat-yaml-2.18.2.jar.sha1 deleted file mode 100644 index 9dac9ee8e1e72..0000000000000 --- a/libs/x-content/licenses/jackson-dataformat-yaml-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d000e13505d1cf564371516fa3d5b8769a779dc9 \ No newline at end of file diff --git a/modules/autotagging-commons/src/test/java/org/opensearch/rule/action/TransportCreateRuleActionTests.java b/modules/autotagging-commons/src/test/java/org/opensearch/rule/action/TransportCreateRuleActionTests.java index 072e2278bea14..c9594d03ec996 100644 --- a/modules/autotagging-commons/src/test/java/org/opensearch/rule/action/TransportCreateRuleActionTests.java +++ b/modules/autotagging-commons/src/test/java/org/opensearch/rule/action/TransportCreateRuleActionTests.java @@ -40,8 +40,6 @@ public class TransportCreateRuleActionTests extends OpenSearchTestCase { private RulePersistenceServiceRegistry persistenceRegistry; private RuleRoutingService mockRoutingService; - private final String testIndexName = "test-index"; - public void setUp() throws Exception { super.setUp(); transportService = mock(TransportService.class); diff --git a/modules/cache-common/src/internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheIT.java b/modules/cache-common/src/internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheIT.java index 08458cd2a054d..9f77f1f4f74ca 100644 --- a/modules/cache-common/src/internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheIT.java +++ b/modules/cache-common/src/internalClusterTest/java/org/opensearch/cache/common/tier/TieredSpilloverCacheIT.java @@ -245,7 +245,6 @@ public void testWithDynamicHeapTookTimePolicy() throws Exception { // Force merge the index to ensure there can be no background merges during the subsequent searches that would invalidate the cache ForceMergeResponse forceMergeResponse = client.admin().indices().prepareForceMerge("index").setFlush(true).get(); OpenSearchAssertions.assertAllSuccessful(forceMergeResponse); - long perQuerySizeInCacheInBytes = -1; for (int iterator = 0; iterator < numberOfIndexedItems; iterator++) { SearchResponse resp = client.prepareSearch("index") .setRequestCache(true) diff --git a/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java b/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java index 2dc115b73c378..368fb0e236efc 100644 --- a/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java +++ b/modules/cache-common/src/test/java/org/opensearch/cache/common/tier/TieredSpilloverCacheTests.java @@ -1858,8 +1858,6 @@ public void testGetPutAndInvalidateWithDiskCacheDisabled() throws Exception { for (int iter = 0; iter < numOfItems2; iter++) { ICacheKey key = getICacheKey(UUID.randomUUID().toString()); int keySegment = tieredSpilloverCache.getSegmentNumber(key); - TieredSpilloverCache.TieredSpilloverCacheSegment segment = - tieredSpilloverCache.tieredSpilloverCacheSegments[keySegment]; LoadAwareCacheLoader, String> loadAwareCacheLoader = getLoadAwareCacheLoader(); tieredSpilloverCache.computeIfAbsent(key, loadAwareCacheLoader); } @@ -2600,17 +2598,6 @@ private TieredSpilloverCache getTieredSpilloverCache( return builder.build(); } - private TieredSpilloverCache initializeTieredSpilloverCache( - int keyValueSize, - int diskCacheSize, - RemovalListener, String> removalListener, - Settings settings, - long diskDeliberateDelay - - ) { - return initializeTieredSpilloverCache(keyValueSize, diskCacheSize, removalListener, settings, diskDeliberateDelay, null, 256); - } - private TieredSpilloverCache initializeTieredSpilloverCache( int keyValueSize, int diskCacheSize, diff --git a/modules/ingest-common/src/test/java/org/opensearch/ingest/common/ForEachProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/opensearch/ingest/common/ForEachProcessorFactoryTests.java index 996e379e6e2d9..c69874053b5a9 100644 --- a/modules/ingest-common/src/test/java/org/opensearch/ingest/common/ForEachProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/opensearch/ingest/common/ForEachProcessorFactoryTests.java @@ -50,7 +50,6 @@ public class ForEachProcessorFactoryTests extends OpenSearchTestCase { private final ScriptService scriptService = mock(ScriptService.class); - private final Consumer genericExecutor = Runnable::run; public void testCreate() throws Exception { Processor processor = new TestProcessor(ingestDocument -> {}); diff --git a/modules/ingest-geoip/licenses/jackson-annotations-2.17.3.jar.sha1 b/modules/ingest-geoip/licenses/jackson-annotations-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c96fec30e5fc5 --- /dev/null +++ b/modules/ingest-geoip/licenses/jackson-annotations-2.17.3.jar.sha1 @@ -0,0 +1 @@ +4f30a05d2eee0ab700cdc27aa5967e934d3042b2 \ No newline at end of file diff --git a/modules/ingest-geoip/licenses/jackson-annotations-2.18.2.jar.sha1 b/modules/ingest-geoip/licenses/jackson-annotations-2.18.2.jar.sha1 deleted file mode 100644 index a06e1d5f28425..0000000000000 --- a/modules/ingest-geoip/licenses/jackson-annotations-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -985d77751ebc7fce5db115a986bc9aa82f973f4a \ No newline at end of file diff --git a/modules/ingest-geoip/licenses/jackson-databind-2.17.3.jar.sha1 b/modules/ingest-geoip/licenses/jackson-databind-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c310f4f68ca92 --- /dev/null +++ b/modules/ingest-geoip/licenses/jackson-databind-2.17.3.jar.sha1 @@ -0,0 +1 @@ +42c617beb411ee813bdc39a287424bfb19d99185 \ No newline at end of file diff --git a/modules/ingest-geoip/licenses/jackson-databind-2.18.2.jar.sha1 b/modules/ingest-geoip/licenses/jackson-databind-2.18.2.jar.sha1 deleted file mode 100644 index eedbfff66c705..0000000000000 --- a/modules/ingest-geoip/licenses/jackson-databind-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -deef8697b92141fb6caf7aa86966cff4eec9b04f \ No newline at end of file diff --git a/modules/ingest-geoip/licenses/jackson-datatype-jsr310-2.17.3.jar.sha1 b/modules/ingest-geoip/licenses/jackson-datatype-jsr310-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..6d0a55ebdd7a4 --- /dev/null +++ b/modules/ingest-geoip/licenses/jackson-datatype-jsr310-2.17.3.jar.sha1 @@ -0,0 +1 @@ +a25fe2f5607fea9e00ed00cf81b7aa2eaacbbd6e \ No newline at end of file diff --git a/modules/ingest-geoip/licenses/jackson-datatype-jsr310-2.18.2.jar.sha1 b/modules/ingest-geoip/licenses/jackson-datatype-jsr310-2.18.2.jar.sha1 deleted file mode 100644 index 7b9ab1d1e08d1..0000000000000 --- a/modules/ingest-geoip/licenses/jackson-datatype-jsr310-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -7b6ff96adf421f4c6edbd694e797dd8fe434510a \ No newline at end of file diff --git a/modules/lang-expression/licenses/asm-9.7.jar.sha1 b/modules/lang-expression/licenses/asm-9.7.jar.sha1 deleted file mode 100644 index 84c9a9703af6d..0000000000000 --- a/modules/lang-expression/licenses/asm-9.7.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -073d7b3086e14beb604ced229c302feff6449723 \ No newline at end of file diff --git a/modules/lang-expression/licenses/asm-9.8.jar.sha1 b/modules/lang-expression/licenses/asm-9.8.jar.sha1 new file mode 100644 index 0000000000000..24005efca428d --- /dev/null +++ b/modules/lang-expression/licenses/asm-9.8.jar.sha1 @@ -0,0 +1 @@ +dc19ecb3f7889b7860697215cae99c0f9b6f6b4b \ No newline at end of file diff --git a/modules/lang-painless/licenses/asm-9.7.jar.sha1 b/modules/lang-painless/licenses/asm-9.7.jar.sha1 deleted file mode 100644 index 84c9a9703af6d..0000000000000 --- a/modules/lang-painless/licenses/asm-9.7.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -073d7b3086e14beb604ced229c302feff6449723 \ No newline at end of file diff --git a/modules/lang-painless/licenses/asm-9.8.jar.sha1 b/modules/lang-painless/licenses/asm-9.8.jar.sha1 new file mode 100644 index 0000000000000..24005efca428d --- /dev/null +++ b/modules/lang-painless/licenses/asm-9.8.jar.sha1 @@ -0,0 +1 @@ +dc19ecb3f7889b7860697215cae99c0f9b6f6b4b \ No newline at end of file diff --git a/modules/lang-painless/licenses/asm-util-9.7.jar.sha1 b/modules/lang-painless/licenses/asm-util-9.7.jar.sha1 deleted file mode 100644 index 37c0d27efe46f..0000000000000 --- a/modules/lang-painless/licenses/asm-util-9.7.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -c0655519f24d92af2202cb681cd7c1569df6ead6 \ No newline at end of file diff --git a/modules/lang-painless/licenses/asm-util-9.8.jar.sha1 b/modules/lang-painless/licenses/asm-util-9.8.jar.sha1 new file mode 100644 index 0000000000000..bd60871d16324 --- /dev/null +++ b/modules/lang-painless/licenses/asm-util-9.8.jar.sha1 @@ -0,0 +1 @@ +395f1c1f035258511f27bc9b2583d76e4b143f59 \ No newline at end of file diff --git a/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessParser.java b/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessParser.java index 7ad5d113637c8..cfc59df71d0e1 100644 --- a/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessParser.java +++ b/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessParser.java @@ -2456,7 +2456,6 @@ private NoncondexpressionContext noncondexpression(int _p) throws RecognitionExc ParserRuleContext _parentctx = _ctx; int _parentState = getState(); NoncondexpressionContext _localctx = new NoncondexpressionContext(_ctx, _parentState); - NoncondexpressionContext _prevctx = _localctx; int _startState = 32; enterRecursionRule(_localctx, 32, RULE_noncondexpression, _p); int _la; @@ -2467,7 +2466,6 @@ private NoncondexpressionContext noncondexpression(int _p) throws RecognitionExc { _localctx = new SingleContext(_localctx); _ctx = _localctx; - _prevctx = _localctx; setState(266); unary(); @@ -2479,7 +2477,6 @@ private NoncondexpressionContext noncondexpression(int _p) throws RecognitionExc while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); - _prevctx = _localctx; { setState(307); _errHandler.sync(this); diff --git a/modules/lang-painless/src/test/java/org/opensearch/painless/ContextExampleTests.java b/modules/lang-painless/src/test/java/org/opensearch/painless/ContextExampleTests.java index 740a49e6a9a77..6568b26241e7f 100644 --- a/modules/lang-painless/src/test/java/org/opensearch/painless/ContextExampleTests.java +++ b/modules/lang-painless/src/test/java/org/opensearch/painless/ContextExampleTests.java @@ -47,12 +47,12 @@ public class ContextExampleTests extends ScriptTestCase { // **** Docs Generator Code **** /* - + import java.io.FileWriter; import java.io.IOException; - + public class Generator { - + public final static String[] theatres = new String[] {"Down Port", "Graye", "Skyline", "Courtyard"}; public final static String[] plays = new String[] {"Driving", "Pick It Up", "Sway and Pull", "Harriot", "The Busline", "Ants Underground", "Exploria", "Line and Single", "Shafted", "Sunnyside Down", @@ -61,7 +61,7 @@ public class Generator { "Joel Madigan", "Jessica Brown", "Baz Knight", "Jo Hangum", "Rachel Grass", "Phoebe Miller", "Sarah Notch", "Brayden Green", "Joshua Iller", "Jon Hittle", "Rob Kettleman", "Laura Conrad", "Simon Hower", "Nora Blue", "Mike Candlestick", "Jacey Bell"}; - + public static void writeSeat(FileWriter writer, int id, String theatre, String play, String[] actors, String date, String time, int row, int number, double cost, boolean sold) throws IOException { StringBuilder builder = new StringBuilder(); @@ -94,11 +94,11 @@ public static void writeSeat(FileWriter writer, int id, String theatre, String p builder.append(" }\n"); writer.write(builder.toString()); } - + public static void main(String args[]) throws IOException { FileWriter writer = new FileWriter("/home/jdconrad/test/seats.json"); int id = 0; - + for (int playCount = 0; playCount < 12; ++playCount) { String play = plays[playCount]; String theatre; @@ -106,7 +106,7 @@ public static void main(String args[]) throws IOException { int startMonth; int endMonth; String time; - + if (playCount == 0) { theatre = theatres[0]; actor = new String[] {actors[0], actors[1], actors[2], actors[3]}; @@ -184,10 +184,10 @@ public static void main(String args[]) throws IOException { } else { throw new RuntimeException("too many plays"); } - + int rows; int number; - + if (playCount < 6) { rows = 3; number = 12; @@ -200,32 +200,32 @@ public static void main(String args[]) throws IOException { } else { throw new RuntimeException("too many seats"); } - + for (int month = startMonth; month <= endMonth; ++month) { for (int day = 1; day <= 14; ++day) { for (int row = 1; row <= rows; ++row) { for (int count = 1; count <= number; ++count) { String date = "2018-" + month + "-" + day; double cost = (25 - row) * 1.25; - + writeSeat(writer, ++id, theatre, play, actor, date, time, row, count, cost, false); } } } } } - + writer.write("\n"); writer.close(); } } - + */ // **** Initial Mappings **** /* - + curl -X PUT "localhost:9200/seats" -H 'Content-Type: application/json' -d' { "mappings": { @@ -246,13 +246,13 @@ public static void main(String args[]) throws IOException { } } ' - + */ // Create Ingest to Modify Dates: /* - + curl -X PUT "localhost:9200/_ingest/pipeline/seats" -H 'Content-Type: application/json' -d' { "description": "update datetime for seats", @@ -265,7 +265,7 @@ public static void main(String args[]) throws IOException { ] } ' - + */ public void testIngestProcessorScript() { @@ -304,9 +304,9 @@ public void testIngestProcessorScript() { // Post Generated Data: /* - + curl -XPOST localhost:9200/seats/seat/_bulk?pipeline=seats -H "Content-Type: application/x-ndjson" --data-binary "@/home/jdconrad/test/seats.json" - + */ // Use script_fields API to add two extra fields to the hits diff --git a/modules/rank-eval/src/test/java/org/opensearch/index/rankeval/DiscountedCumulativeGainTests.java b/modules/rank-eval/src/test/java/org/opensearch/index/rankeval/DiscountedCumulativeGainTests.java index d96e3212e05a2..aca00b42a9331 100644 --- a/modules/rank-eval/src/test/java/org/opensearch/index/rankeval/DiscountedCumulativeGainTests.java +++ b/modules/rank-eval/src/test/java/org/opensearch/index/rankeval/DiscountedCumulativeGainTests.java @@ -94,7 +94,7 @@ public void testDCGAt() { /* Check with normalization: to get the maximal possible dcg, sort documents by relevance in descending order - + rank | relevance | 2^(relevance) - 1 | log_2(rank + 1) | (2^(relevance) - 1) / log_2(rank + 1) --------------------------------------------------------------------------------------- 1 | 3 | 7.0 | 1.0  | 7.0 @@ -103,7 +103,7 @@ public void testDCGAt() { 4 | 2 | 3.0 | 2.321928094887362 | 1.2920296742201793 5 | 1 | 1.0 | 2.584962500721156  | 0.38685280723454163 6 | 0 | 0.0 | 2.807354922057604  | 0.0 - + idcg = 14.595390756454922 (sum of last column) */ dcg = new DiscountedCumulativeGain(true, null, 10); @@ -146,7 +146,7 @@ public void testDCGAtSixMissingRatings() { /* Check with normalization: to get the maximal possible dcg, sort documents by relevance in descending order - + rank | relevance | 2^(relevance) - 1 | log_2(rank + 1) | (2^(relevance) - 1) / log_2(rank + 1) ---------------------------------------------------------------------------------------- 1 | 3 | 7.0 | 1.0  | 7.0 @@ -155,7 +155,7 @@ public void testDCGAtSixMissingRatings() { 4 | 1 | 1.0 | 2.321928094887362   | 0.43067655807339 5 | n.a | n.a | n.a.  | n.a. 6 | n.a | n.a | n.a  | n.a - + idcg = 13.347184833073591 (sum of last column) */ dcg = new DiscountedCumulativeGain(true, null, 10); @@ -203,7 +203,7 @@ public void testDCGAtFourMoreRatings() { /* Check with normalization: to get the maximal possible dcg, sort documents by relevance in descending order - + rank | relevance | 2^(relevance) - 1 | log_2(rank + 1) | (2^(relevance) - 1) / log_2(rank + 1) --------------------------------------------------------------------------------------- 1 | 3 | 7.0 | 1.0  | 7.0 @@ -213,7 +213,7 @@ public void testDCGAtFourMoreRatings() { --------------------------------------------------------------------------------------- 5 | n.a | n.a | n.a.  | n.a. 6 | n.a | n.a | n.a  | n.a - + idcg = 13.347184833073591 (sum of last column) */ dcg = new DiscountedCumulativeGain(true, null, 10); diff --git a/modules/reindex/src/internalClusterTest/java/org/opensearch/client/documentation/ReindexDocumentationIT.java b/modules/reindex/src/internalClusterTest/java/org/opensearch/client/documentation/ReindexDocumentationIT.java index 9bc97d0213e73..288b7e370c647 100644 --- a/modules/reindex/src/internalClusterTest/java/org/opensearch/client/documentation/ReindexDocumentationIT.java +++ b/modules/reindex/src/internalClusterTest/java/org/opensearch/client/documentation/ReindexDocumentationIT.java @@ -61,7 +61,6 @@ import org.opensearch.tasks.TaskInfo; import org.opensearch.test.OpenSearchIntegTestCase; import org.opensearch.transport.client.Client; -import org.hamcrest.Matcher; import org.junit.Before; import java.util.Arrays; diff --git a/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexBasicTests.java b/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexBasicTests.java index 24adba16d0bad..19926f15b0df0 100644 --- a/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexBasicTests.java +++ b/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexBasicTests.java @@ -144,7 +144,6 @@ public void testMultipleSources() throws Exception { Map> docs = new HashMap<>(); for (int sourceIndex = 0; sourceIndex < sourceIndices; sourceIndex++) { String indexName = "source" + sourceIndex; - String typeName = "test" + sourceIndex; docs.put(indexName, new ArrayList<>()); int numDocs = between(50, 200); for (int i = 0; i < numDocs; i++) { diff --git a/plugins/arrow-flight-rpc/licenses/error_prone_annotations-2.31.0.jar.sha1 b/plugins/arrow-flight-rpc/licenses/error_prone_annotations-2.31.0.jar.sha1 deleted file mode 100644 index 4872d644799f5..0000000000000 --- a/plugins/arrow-flight-rpc/licenses/error_prone_annotations-2.31.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -c3ba307b915d6d506e98ffbb49e6d2d12edad65b \ No newline at end of file diff --git a/plugins/arrow-flight-rpc/licenses/error_prone_annotations-2.36.0.jar.sha1 b/plugins/arrow-flight-rpc/licenses/error_prone_annotations-2.36.0.jar.sha1 new file mode 100644 index 0000000000000..2770835697e79 --- /dev/null +++ b/plugins/arrow-flight-rpc/licenses/error_prone_annotations-2.36.0.jar.sha1 @@ -0,0 +1 @@ +227d4d4957ccc3dc5761bd897e3a0ee587e750a7 \ No newline at end of file diff --git a/plugins/arrow-flight-rpc/licenses/jackson-annotations-2.17.3.jar.sha1 b/plugins/arrow-flight-rpc/licenses/jackson-annotations-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c96fec30e5fc5 --- /dev/null +++ b/plugins/arrow-flight-rpc/licenses/jackson-annotations-2.17.3.jar.sha1 @@ -0,0 +1 @@ +4f30a05d2eee0ab700cdc27aa5967e934d3042b2 \ No newline at end of file diff --git a/plugins/arrow-flight-rpc/licenses/jackson-annotations-2.18.2.jar.sha1 b/plugins/arrow-flight-rpc/licenses/jackson-annotations-2.18.2.jar.sha1 deleted file mode 100644 index a06e1d5f28425..0000000000000 --- a/plugins/arrow-flight-rpc/licenses/jackson-annotations-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -985d77751ebc7fce5db115a986bc9aa82f973f4a \ No newline at end of file diff --git a/plugins/arrow-flight-rpc/licenses/jackson-databind-2.17.3.jar.sha1 b/plugins/arrow-flight-rpc/licenses/jackson-databind-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c310f4f68ca92 --- /dev/null +++ b/plugins/arrow-flight-rpc/licenses/jackson-databind-2.17.3.jar.sha1 @@ -0,0 +1 @@ +42c617beb411ee813bdc39a287424bfb19d99185 \ No newline at end of file diff --git a/plugins/arrow-flight-rpc/licenses/jackson-databind-2.18.2.jar.sha1 b/plugins/arrow-flight-rpc/licenses/jackson-databind-2.18.2.jar.sha1 deleted file mode 100644 index eedbfff66c705..0000000000000 --- a/plugins/arrow-flight-rpc/licenses/jackson-databind-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -deef8697b92141fb6caf7aa86966cff4eec9b04f \ No newline at end of file diff --git a/plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/FlightClientManager.java b/plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/FlightClientManager.java index c81f4d3c270e7..6fb320aba0334 100644 --- a/plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/FlightClientManager.java +++ b/plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/FlightClientManager.java @@ -35,7 +35,6 @@ import java.util.Map; 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.ExecutorService; @@ -247,10 +246,6 @@ private static boolean isValidNode(DiscoveryNode node) { return node != null && !node.getVersion().before(MIN_SUPPORTED_VERSION) && FeatureFlags.isEnabled(ARROW_STREAMS_SETTING); } - private Set getCurrentClusterNodes() { - return Objects.requireNonNull(clientConfig.clusterService).state().nodes().getNodes().keySet(); - } - @VisibleForTesting Map getFlightClients() { return flightClients; diff --git a/plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/ServerConfig.java b/plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/ServerConfig.java index 78b8b1dd56a6a..709d7debed182 100644 --- a/plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/ServerConfig.java +++ b/plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/ServerConfig.java @@ -101,8 +101,6 @@ public ServerConfig() {} * The thread pool name for the Flight client. */ public static final String FLIGHT_CLIENT_THREAD_POOL_NAME = "flight-client"; - - private static final String host = "localhost"; private static boolean enableSsl; private static int threadPoolMin; private static int threadPoolMax; diff --git a/plugins/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/impl/BaseFlightProducerTests.java b/plugins/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/impl/BaseFlightProducerTests.java index 65caae55e9e40..5b0ccccb0c5d3 100644 --- a/plugins/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/impl/BaseFlightProducerTests.java +++ b/plugins/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/impl/BaseFlightProducerTests.java @@ -566,8 +566,9 @@ public void testGetFlightInfo_LocationNotFound() { } public void testGetFlightInfo_SchemaError() { - when(streamManager.getStreamProducer(any(FlightStreamTicket.class))) - .thenReturn(Optional.of(FlightStreamManager.StreamProducerHolder.create(streamProducer, allocator))); + when(streamManager.getStreamProducer(any(FlightStreamTicket.class))).thenReturn( + Optional.of(FlightStreamManager.StreamProducerHolder.create(streamProducer, allocator)) + ); Location location = Location.forGrpcInsecure("localhost", 8815); when(flightClientManager.getFlightClientLocation(LOCAL_NODE_ID)).thenReturn(Optional.of(location)); when(streamProducer.createRoot(allocator)).thenReturn(mock(VectorSchemaRoot.class)); diff --git a/plugins/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/impl/FlightStreamReaderTests.java b/plugins/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/impl/FlightStreamReaderTests.java index f8bb592662a85..2a879635e186d 100644 --- a/plugins/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/impl/FlightStreamReaderTests.java +++ b/plugins/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/impl/FlightStreamReaderTests.java @@ -58,7 +58,7 @@ public void tearDown() throws Exception { public void testNext_ReturnsTrue_WhenFlightStreamHasNext() throws Exception { when(mockFlightStream.next()).thenReturn(true); assertTrue(iterator.next()); - assert(mockFlightStream).next(); + assert (mockFlightStream).next(); } public void testNext_ReturnsFalse_WhenFlightStreamHasNoNext() throws Exception { diff --git a/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java b/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java index 3b3c5fd82f87f..b7428a69704aa 100644 --- a/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java +++ b/plugins/cache-ehcache/src/test/java/org/opensearch/cache/store/disk/EhCacheDiskCacheTests.java @@ -1264,35 +1264,6 @@ PersistentCacheManager buildCacheManager() { } } - private EhcacheDiskCache.Builder createDummyBuilder(String storagePath) throws IOException { - Settings settings = Settings.builder().build(); - MockRemovalListener removalListener = new MockRemovalListener<>(); - ToLongBiFunction, String> weigher = getWeigher(); - try (NodeEnvironment env = newNodeEnvironment(settings)) { - if (storagePath == null || storagePath.isBlank()) { - storagePath = env.nodePaths()[0].path.toString() + "/request_cache"; - } - return (EhcacheDiskCache.Builder) new EhcacheDiskCache.Builder().setThreadPoolAlias( - "ehcacheTest" - ) - .setIsEventListenerModeSync(true) - .setStoragePath(storagePath) - .setKeyType(String.class) - .setValueType(String.class) - .setKeySerializer(new StringSerializer()) - .setDiskCacheAlias("test1") - .setValueSerializer(new StringSerializer()) - .setDimensionNames(List.of(dimensionName)) - .setCacheType(CacheType.INDICES_REQUEST_CACHE) - .setSettings(settings) - .setExpireAfterAccess(TimeValue.MAX_VALUE) - .setMaximumWeightInBytes(CACHE_SIZE_IN_BYTES) - .setRemovalListener(removalListener) - .setWeigher(weigher) - .setStatsTrackingEnabled(false); - } - } - private List getRandomDimensions(List dimensionNames) { Random rand = Randomness.get(); int bound = 3; diff --git a/plugins/crypto-kms/licenses/jackson-annotations-2.17.3.jar.sha1 b/plugins/crypto-kms/licenses/jackson-annotations-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c96fec30e5fc5 --- /dev/null +++ b/plugins/crypto-kms/licenses/jackson-annotations-2.17.3.jar.sha1 @@ -0,0 +1 @@ +4f30a05d2eee0ab700cdc27aa5967e934d3042b2 \ No newline at end of file diff --git a/plugins/crypto-kms/licenses/jackson-annotations-2.18.2.jar.sha1 b/plugins/crypto-kms/licenses/jackson-annotations-2.18.2.jar.sha1 deleted file mode 100644 index a06e1d5f28425..0000000000000 --- a/plugins/crypto-kms/licenses/jackson-annotations-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -985d77751ebc7fce5db115a986bc9aa82f973f4a \ No newline at end of file diff --git a/plugins/crypto-kms/licenses/jackson-databind-2.17.3.jar.sha1 b/plugins/crypto-kms/licenses/jackson-databind-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c310f4f68ca92 --- /dev/null +++ b/plugins/crypto-kms/licenses/jackson-databind-2.17.3.jar.sha1 @@ -0,0 +1 @@ +42c617beb411ee813bdc39a287424bfb19d99185 \ No newline at end of file diff --git a/plugins/crypto-kms/licenses/jackson-databind-2.18.2.jar.sha1 b/plugins/crypto-kms/licenses/jackson-databind-2.18.2.jar.sha1 deleted file mode 100644 index eedbfff66c705..0000000000000 --- a/plugins/crypto-kms/licenses/jackson-databind-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -deef8697b92141fb6caf7aa86966cff4eec9b04f \ No newline at end of file diff --git a/plugins/discovery-ec2/licenses/jackson-annotations-2.17.3.jar.sha1 b/plugins/discovery-ec2/licenses/jackson-annotations-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c96fec30e5fc5 --- /dev/null +++ b/plugins/discovery-ec2/licenses/jackson-annotations-2.17.3.jar.sha1 @@ -0,0 +1 @@ +4f30a05d2eee0ab700cdc27aa5967e934d3042b2 \ No newline at end of file diff --git a/plugins/discovery-ec2/licenses/jackson-annotations-2.18.2.jar.sha1 b/plugins/discovery-ec2/licenses/jackson-annotations-2.18.2.jar.sha1 deleted file mode 100644 index a06e1d5f28425..0000000000000 --- a/plugins/discovery-ec2/licenses/jackson-annotations-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -985d77751ebc7fce5db115a986bc9aa82f973f4a \ No newline at end of file diff --git a/plugins/discovery-ec2/licenses/jackson-databind-2.17.3.jar.sha1 b/plugins/discovery-ec2/licenses/jackson-databind-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c310f4f68ca92 --- /dev/null +++ b/plugins/discovery-ec2/licenses/jackson-databind-2.17.3.jar.sha1 @@ -0,0 +1 @@ +42c617beb411ee813bdc39a287424bfb19d99185 \ No newline at end of file diff --git a/plugins/discovery-ec2/licenses/jackson-databind-2.18.2.jar.sha1 b/plugins/discovery-ec2/licenses/jackson-databind-2.18.2.jar.sha1 deleted file mode 100644 index eedbfff66c705..0000000000000 --- a/plugins/discovery-ec2/licenses/jackson-databind-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -deef8697b92141fb6caf7aa86966cff4eec9b04f \ No newline at end of file diff --git a/plugins/discovery-ec2/src/main/java/org/opensearch/discovery/ec2/Ec2ClientSettings.java b/plugins/discovery-ec2/src/main/java/org/opensearch/discovery/ec2/Ec2ClientSettings.java index 8c010bbcdec3a..1d930cd5472da 100644 --- a/plugins/discovery-ec2/src/main/java/org/opensearch/discovery/ec2/Ec2ClientSettings.java +++ b/plugins/discovery-ec2/src/main/java/org/opensearch/discovery/ec2/Ec2ClientSettings.java @@ -39,7 +39,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.settings.SecureSetting; import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Setting.Property; @@ -110,8 +109,6 @@ final class Ec2ClientSettings { private static final Logger logger = LogManager.getLogger(Ec2ClientSettings.class); - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(Ec2ClientSettings.class); - /** Credentials to authenticate with ec2. */ final AwsCredentials credentials; diff --git a/plugins/identity-shiro/src/main/java/org/opensearch/identity/shiro/ShiroIdentityPlugin.java b/plugins/identity-shiro/src/main/java/org/opensearch/identity/shiro/ShiroIdentityPlugin.java index 4ca61ddeb6bcd..284b99a39aa70 100644 --- a/plugins/identity-shiro/src/main/java/org/opensearch/identity/shiro/ShiroIdentityPlugin.java +++ b/plugins/identity-shiro/src/main/java/org/opensearch/identity/shiro/ShiroIdentityPlugin.java @@ -9,7 +9,6 @@ package org.opensearch.identity.shiro; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.shiro.SecurityUtils; import org.apache.shiro.mgt.SecurityManager; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; @@ -48,7 +47,6 @@ * Identity implementation with Shiro */ public final class ShiroIdentityPlugin extends Plugin implements IdentityPlugin, ActionPlugin { - private Logger log = LogManager.getLogger(this.getClass()); private final Settings settings; private final ShiroTokenManager authTokenHandler; diff --git a/plugins/identity-shiro/src/test/java/org/opensearch/identity/shiro/ShiroIdentityPluginTests.java b/plugins/identity-shiro/src/test/java/org/opensearch/identity/shiro/ShiroIdentityPluginTests.java index a15538e48bd66..e89737ae6adb7 100644 --- a/plugins/identity-shiro/src/test/java/org/opensearch/identity/shiro/ShiroIdentityPluginTests.java +++ b/plugins/identity-shiro/src/test/java/org/opensearch/identity/shiro/ShiroIdentityPluginTests.java @@ -17,7 +17,6 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThrows; diff --git a/plugins/ingestion-kinesis/licenses/jackson-annotations-2.17.3.jar.sha1 b/plugins/ingestion-kinesis/licenses/jackson-annotations-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c96fec30e5fc5 --- /dev/null +++ b/plugins/ingestion-kinesis/licenses/jackson-annotations-2.17.3.jar.sha1 @@ -0,0 +1 @@ +4f30a05d2eee0ab700cdc27aa5967e934d3042b2 \ No newline at end of file diff --git a/plugins/ingestion-kinesis/licenses/jackson-annotations-2.18.2.jar.sha1 b/plugins/ingestion-kinesis/licenses/jackson-annotations-2.18.2.jar.sha1 deleted file mode 100644 index a06e1d5f28425..0000000000000 --- a/plugins/ingestion-kinesis/licenses/jackson-annotations-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -985d77751ebc7fce5db115a986bc9aa82f973f4a \ No newline at end of file diff --git a/plugins/ingestion-kinesis/licenses/jackson-databind-2.17.3.jar.sha1 b/plugins/ingestion-kinesis/licenses/jackson-databind-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c310f4f68ca92 --- /dev/null +++ b/plugins/ingestion-kinesis/licenses/jackson-databind-2.17.3.jar.sha1 @@ -0,0 +1 @@ +42c617beb411ee813bdc39a287424bfb19d99185 \ No newline at end of file diff --git a/plugins/ingestion-kinesis/licenses/jackson-databind-2.18.2.jar.sha1 b/plugins/ingestion-kinesis/licenses/jackson-databind-2.18.2.jar.sha1 deleted file mode 100644 index eedbfff66c705..0000000000000 --- a/plugins/ingestion-kinesis/licenses/jackson-databind-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -deef8697b92141fb6caf7aa86966cff4eec9b04f \ No newline at end of file diff --git a/plugins/repository-azure/licenses/asm-9.7.jar.sha1 b/plugins/repository-azure/licenses/asm-9.7.jar.sha1 deleted file mode 100644 index 84c9a9703af6d..0000000000000 --- a/plugins/repository-azure/licenses/asm-9.7.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -073d7b3086e14beb604ced229c302feff6449723 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/asm-9.8.jar.sha1 b/plugins/repository-azure/licenses/asm-9.8.jar.sha1 new file mode 100644 index 0000000000000..24005efca428d --- /dev/null +++ b/plugins/repository-azure/licenses/asm-9.8.jar.sha1 @@ -0,0 +1 @@ +dc19ecb3f7889b7860697215cae99c0f9b6f6b4b \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-annotations-2.17.3.jar.sha1 b/plugins/repository-azure/licenses/jackson-annotations-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c96fec30e5fc5 --- /dev/null +++ b/plugins/repository-azure/licenses/jackson-annotations-2.17.3.jar.sha1 @@ -0,0 +1 @@ +4f30a05d2eee0ab700cdc27aa5967e934d3042b2 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-annotations-2.18.2.jar.sha1 b/plugins/repository-azure/licenses/jackson-annotations-2.18.2.jar.sha1 deleted file mode 100644 index a06e1d5f28425..0000000000000 --- a/plugins/repository-azure/licenses/jackson-annotations-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -985d77751ebc7fce5db115a986bc9aa82f973f4a \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-databind-2.17.3.jar.sha1 b/plugins/repository-azure/licenses/jackson-databind-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c310f4f68ca92 --- /dev/null +++ b/plugins/repository-azure/licenses/jackson-databind-2.17.3.jar.sha1 @@ -0,0 +1 @@ +42c617beb411ee813bdc39a287424bfb19d99185 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-databind-2.18.2.jar.sha1 b/plugins/repository-azure/licenses/jackson-databind-2.18.2.jar.sha1 deleted file mode 100644 index eedbfff66c705..0000000000000 --- a/plugins/repository-azure/licenses/jackson-databind-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -deef8697b92141fb6caf7aa86966cff4eec9b04f \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-dataformat-xml-2.17.3.jar.sha1 b/plugins/repository-azure/licenses/jackson-dataformat-xml-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..9b2965f3efca0 --- /dev/null +++ b/plugins/repository-azure/licenses/jackson-dataformat-xml-2.17.3.jar.sha1 @@ -0,0 +1 @@ +cae13eba442238be7f265dd7c5681a63fb22bf71 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-dataformat-xml-2.18.2.jar.sha1 b/plugins/repository-azure/licenses/jackson-dataformat-xml-2.18.2.jar.sha1 deleted file mode 100644 index 61ee41aa8adf4..0000000000000 --- a/plugins/repository-azure/licenses/jackson-dataformat-xml-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -069cb3b7bd34b3f7842cc4a6fd717981433bf73e \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-datatype-jsr310-2.17.3.jar.sha1 b/plugins/repository-azure/licenses/jackson-datatype-jsr310-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..6d0a55ebdd7a4 --- /dev/null +++ b/plugins/repository-azure/licenses/jackson-datatype-jsr310-2.17.3.jar.sha1 @@ -0,0 +1 @@ +a25fe2f5607fea9e00ed00cf81b7aa2eaacbbd6e \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-datatype-jsr310-2.18.2.jar.sha1 b/plugins/repository-azure/licenses/jackson-datatype-jsr310-2.18.2.jar.sha1 deleted file mode 100644 index 7b9ab1d1e08d1..0000000000000 --- a/plugins/repository-azure/licenses/jackson-datatype-jsr310-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -7b6ff96adf421f4c6edbd694e797dd8fe434510a \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-module-jaxb-annotations-2.17.3.jar.sha1 b/plugins/repository-azure/licenses/jackson-module-jaxb-annotations-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c8766eb9dcbdd --- /dev/null +++ b/plugins/repository-azure/licenses/jackson-module-jaxb-annotations-2.17.3.jar.sha1 @@ -0,0 +1 @@ +0ba7b7b68e0c564dd69ba757bdfc93b04e884478 \ No newline at end of file diff --git a/plugins/repository-azure/licenses/jackson-module-jaxb-annotations-2.18.2.jar.sha1 b/plugins/repository-azure/licenses/jackson-module-jaxb-annotations-2.18.2.jar.sha1 deleted file mode 100644 index b98599718965b..0000000000000 --- a/plugins/repository-azure/licenses/jackson-module-jaxb-annotations-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -048c96032e5a428739e28ff04973717c032df598 \ No newline at end of file diff --git a/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java b/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java index 19c9af317247f..7688b3c8b93ab 100644 --- a/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java +++ b/plugins/repository-azure/src/main/java/org/opensearch/repositories/azure/AzureStorageService.java @@ -172,7 +172,7 @@ public Tuple> client(String clientName) { * Obtains a {@code BlobServiceClient} on each invocation using the current client * settings. BlobServiceClient is thread safe and and could be cached but the settings * can change, therefore the instance might be recreated from scratch. - + * @param clientName client name * @param statsCollector statistics collector * @return the {@code BlobServiceClient} instance and context diff --git a/plugins/repository-s3/licenses/jackson-annotations-2.17.3.jar.sha1 b/plugins/repository-s3/licenses/jackson-annotations-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c96fec30e5fc5 --- /dev/null +++ b/plugins/repository-s3/licenses/jackson-annotations-2.17.3.jar.sha1 @@ -0,0 +1 @@ +4f30a05d2eee0ab700cdc27aa5967e934d3042b2 \ No newline at end of file diff --git a/plugins/repository-s3/licenses/jackson-annotations-2.18.2.jar.sha1 b/plugins/repository-s3/licenses/jackson-annotations-2.18.2.jar.sha1 deleted file mode 100644 index a06e1d5f28425..0000000000000 --- a/plugins/repository-s3/licenses/jackson-annotations-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -985d77751ebc7fce5db115a986bc9aa82f973f4a \ No newline at end of file diff --git a/plugins/repository-s3/licenses/jackson-databind-2.17.3.jar.sha1 b/plugins/repository-s3/licenses/jackson-databind-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..c310f4f68ca92 --- /dev/null +++ b/plugins/repository-s3/licenses/jackson-databind-2.17.3.jar.sha1 @@ -0,0 +1 @@ +42c617beb411ee813bdc39a287424bfb19d99185 \ No newline at end of file diff --git a/plugins/repository-s3/licenses/jackson-databind-2.18.2.jar.sha1 b/plugins/repository-s3/licenses/jackson-databind-2.18.2.jar.sha1 deleted file mode 100644 index eedbfff66c705..0000000000000 --- a/plugins/repository-s3/licenses/jackson-databind-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -deef8697b92141fb6caf7aa86966cff4eec9b04f \ No newline at end of file diff --git a/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3BlobStore.java b/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3BlobStore.java index 5b677a49694a2..5adbcc675d082 100644 --- a/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3BlobStore.java +++ b/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3BlobStore.java @@ -36,7 +36,6 @@ import software.amazon.awssdk.services.s3.model.StorageClass; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.cluster.metadata.RepositoryMetadata; import org.opensearch.common.blobstore.BlobContainer; import org.opensearch.common.blobstore.BlobPath; @@ -71,8 +70,6 @@ public class S3BlobStore implements BlobStore { - private static final Logger logger = LogManager.getLogger(S3BlobStore.class); - private final S3Service service; private final S3AsyncService s3AsyncService; diff --git a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelTelemetry.java b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelTelemetry.java index 0c697d2cc5e8c..606fdc317df16 100644 --- a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelTelemetry.java +++ b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/OTelTelemetry.java @@ -24,7 +24,7 @@ public class OTelTelemetry implements Telemetry { /** * Creates Telemetry instance - + */ /** * Creates Telemetry instance diff --git a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/sampler/OTelSamplerFactory.java b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/sampler/OTelSamplerFactory.java index da8887867a43f..578d3247d8e43 100644 --- a/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/sampler/OTelSamplerFactory.java +++ b/plugins/telemetry-otel/src/main/java/org/opensearch/telemetry/tracing/sampler/OTelSamplerFactory.java @@ -9,7 +9,6 @@ package org.opensearch.telemetry.tracing.sampler; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.SpecialPermission; import org.opensearch.common.settings.Settings; import org.opensearch.telemetry.OTelTelemetrySettings; @@ -29,11 +28,6 @@ */ public class OTelSamplerFactory { - /** - * Logger instance for logging messages related to the OTelSamplerFactory. - */ - private static final Logger logger = LogManager.getLogger(OTelSamplerFactory.class); - /** * Base constructor. */ diff --git a/plugins/transport-grpc/licenses/error_prone_annotations-2.24.1.jar.sha1 b/plugins/transport-grpc/licenses/error_prone_annotations-2.24.1.jar.sha1 deleted file mode 100644 index 67723f6f51248..0000000000000 --- a/plugins/transport-grpc/licenses/error_prone_annotations-2.24.1.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -32b299e45105aa9b0df8279c74dc1edfcf313ff0 \ No newline at end of file diff --git a/plugins/transport-grpc/licenses/error_prone_annotations-2.36.0.jar.sha1 b/plugins/transport-grpc/licenses/error_prone_annotations-2.36.0.jar.sha1 new file mode 100644 index 0000000000000..2770835697e79 --- /dev/null +++ b/plugins/transport-grpc/licenses/error_prone_annotations-2.36.0.jar.sha1 @@ -0,0 +1 @@ +227d4d4957ccc3dc5761bd897e3a0ee587e750a7 \ No newline at end of file diff --git a/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/request/search/RescorerBuilderProtoUtils.java b/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/request/search/RescorerBuilderProtoUtils.java index 38f22f05a94e9..70d4cdb047a08 100644 --- a/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/request/search/RescorerBuilderProtoUtils.java +++ b/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/request/search/RescorerBuilderProtoUtils.java @@ -37,9 +37,9 @@ protected static RescorerBuilder parseFromProto(Rescore rescoreProto) { /* RescorerBuilder rescorer = null; // TODO populate rescorerBuilder - + return rescorer; - + */ } diff --git a/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/response/exceptions/ShardOperationFailedExceptionProtoUtils.java b/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/response/exceptions/ShardOperationFailedExceptionProtoUtils.java index 929eb3b19d646..bdabec9dc28a0 100644 --- a/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/response/exceptions/ShardOperationFailedExceptionProtoUtils.java +++ b/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/response/exceptions/ShardOperationFailedExceptionProtoUtils.java @@ -8,8 +8,6 @@ package org.opensearch.plugin.transport.grpc.proto.response.exceptions; import org.opensearch.core.action.ShardOperationFailedException; -import org.opensearch.core.xcontent.ToXContent; -import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.protobufs.ObjectMap; /** diff --git a/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/response/exceptions/shardoperationfailedexception/ShardOperationFailedExceptionProtoUtils.java b/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/response/exceptions/shardoperationfailedexception/ShardOperationFailedExceptionProtoUtils.java index c5a26930d9300..40edb78374579 100644 --- a/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/response/exceptions/shardoperationfailedexception/ShardOperationFailedExceptionProtoUtils.java +++ b/plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/proto/response/exceptions/shardoperationfailedexception/ShardOperationFailedExceptionProtoUtils.java @@ -11,8 +11,6 @@ import org.opensearch.action.support.replication.ReplicationResponse; import org.opensearch.core.action.ShardOperationFailedException; import org.opensearch.core.action.support.DefaultShardOperationFailedException; -import org.opensearch.core.xcontent.ToXContent; -import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.protobufs.ShardFailure; import org.opensearch.snapshots.SnapshotShardFailure; diff --git a/server/licenses/jackson-core-2.17.3.jar.sha1 b/server/licenses/jackson-core-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..13c532bb8cfc9 --- /dev/null +++ b/server/licenses/jackson-core-2.17.3.jar.sha1 @@ -0,0 +1 @@ +1d6eb3e959c737692b720d3492b2f1f34c4c8579 \ No newline at end of file diff --git a/server/licenses/jackson-core-2.18.2.jar.sha1 b/server/licenses/jackson-core-2.18.2.jar.sha1 deleted file mode 100644 index 96350c9307ae7..0000000000000 --- a/server/licenses/jackson-core-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -fb64ccac5c27dca8819418eb4e443a9f496d9ee7 \ No newline at end of file diff --git a/server/licenses/jackson-dataformat-cbor-2.17.3.jar.sha1 b/server/licenses/jackson-dataformat-cbor-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..6ff493a7256c9 --- /dev/null +++ b/server/licenses/jackson-dataformat-cbor-2.17.3.jar.sha1 @@ -0,0 +1 @@ +5286b5df35824b8c2a8ceae9a54e99dca9220e15 \ No newline at end of file diff --git a/server/licenses/jackson-dataformat-cbor-2.18.2.jar.sha1 b/server/licenses/jackson-dataformat-cbor-2.18.2.jar.sha1 deleted file mode 100644 index 8b946b98ddbf9..0000000000000 --- a/server/licenses/jackson-dataformat-cbor-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d4870757eff0344130f60e3ddb882b2336640f73 \ No newline at end of file diff --git a/server/licenses/jackson-dataformat-smile-2.17.3.jar.sha1 b/server/licenses/jackson-dataformat-smile-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..7d71c29876246 --- /dev/null +++ b/server/licenses/jackson-dataformat-smile-2.17.3.jar.sha1 @@ -0,0 +1 @@ +cd19020c7bace93ce269e85ac6fee782a6bf4e16 \ No newline at end of file diff --git a/server/licenses/jackson-dataformat-smile-2.18.2.jar.sha1 b/server/licenses/jackson-dataformat-smile-2.18.2.jar.sha1 deleted file mode 100644 index 9fbdb9b3a2506..0000000000000 --- a/server/licenses/jackson-dataformat-smile-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -44caf62d743bb5e5876e95efba5a55a1cab1b0db \ No newline at end of file diff --git a/server/licenses/jackson-dataformat-yaml-2.17.3.jar.sha1 b/server/licenses/jackson-dataformat-yaml-2.17.3.jar.sha1 new file mode 100644 index 0000000000000..332ff6d34fdc1 --- /dev/null +++ b/server/licenses/jackson-dataformat-yaml-2.17.3.jar.sha1 @@ -0,0 +1 @@ +536e9d9ee966cf40a8b5d2f9ba505551364d0ad5 \ No newline at end of file diff --git a/server/licenses/jackson-dataformat-yaml-2.18.2.jar.sha1 b/server/licenses/jackson-dataformat-yaml-2.18.2.jar.sha1 deleted file mode 100644 index 9dac9ee8e1e72..0000000000000 --- a/server/licenses/jackson-dataformat-yaml-2.18.2.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d000e13505d1cf564371516fa3d5b8769a779dc9 \ No newline at end of file diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java index 912c48d7bbdfe..f428eeace7410 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java @@ -503,12 +503,6 @@ public void testDiskMonitorResetLastRuntimeMilliSecOnlyInFirstCall() throws Exce }, 30L, TimeUnit.SECONDS); } - private String populateNode(final String dataNodeName) throws Exception { - final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT); - createAndPopulateIndex(indexName, dataNodeName); - return indexName; - } - private void createIndex(String indexName, String nodeName, boolean isWarmIndex) throws Exception { final Settings.Builder indexSettingBuilder = Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java index f7156840a140e..83cf1bef6bb57 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java @@ -1526,7 +1526,6 @@ private TransportNodesListShardStoreMetadataBatch.NodesStoreFilesMetadataBatch p ensureGreen(indices); } shardAttributesMap = prepareRequestMap(indices, 1); - TransportNodesListShardStoreMetadataBatch.NodesStoreFilesMetadataBatch response; return ActionTestUtils.executeBlocking( internalCluster().getInstance(TransportNodesListShardStoreMetadataBatch.class), new TransportNodesListShardStoreMetadataBatch.Request(shardAttributesMap, nodes) diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/remote/RemoteClusterStateTermVersionIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/remote/RemoteClusterStateTermVersionIT.java index 256c2ef44b078..98b8131d01b39 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/remote/RemoteClusterStateTermVersionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/remote/RemoteClusterStateTermVersionIT.java @@ -47,10 +47,8 @@ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class RemoteClusterStateTermVersionIT extends RemoteStoreBaseIntegTestCase { private static final String INDEX_NAME = "test-index"; - private static final String INDEX_NAME_1 = "test-index-1"; List indexRoutingPaths; AtomicInteger indexRoutingFiles = new AtomicInteger(); - private final RemoteStoreEnums.PathType pathType = RemoteStoreEnums.PathType.HASHED_PREFIX; @Before public void setup() { diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/remote/RemoteRepositoryConfigurationIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/remote/RemoteRepositoryConfigurationIT.java index 48afa85dc5691..21e55ad7ecd2e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/remote/RemoteRepositoryConfigurationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/remote/RemoteRepositoryConfigurationIT.java @@ -43,7 +43,6 @@ */ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class RemoteRepositoryConfigurationIT extends MigrationBaseTestCase { - private final String REMOTE_PRI_DOCREP_REP = "remote-primary-docrep-replica"; protected String remoteRepoPrefix = "remote_store"; diff --git a/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureSettingsIT.java b/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureSettingsIT.java index 5426f4037294f..8c05d48b5f585 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureSettingsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/ShardIndexingPressureSettingsIT.java @@ -425,11 +425,9 @@ public void testShardIndexingPressureEnforcedEnabledDisabledSetting() throws Exc public void testShardIndexingPressureEnforcedEnabledNoOpIfFeatureDisabled() throws Exception { final BulkRequest bulkRequest = new BulkRequest(); - int totalRequestSize = 0; for (int i = 0; i < 80; ++i) { IndexRequest request = new IndexRequest(INDEX_NAME).id(UUIDs.base64UUID()) .source(Collections.singletonMap("key", randomAlphaOfLength(50))); - totalRequestSize += request.ramBytesUsed(); assertTrue(request.ramBytesUsed() > request.source().length()); bulkRequest.add(request); } @@ -469,11 +467,9 @@ public void testShardIndexingPressureEnforcedEnabledNoOpIfFeatureDisabled() thro public void testShardIndexingPressureVerifyShardMinLimitSettingUpdate() throws Exception { final BulkRequest bulkRequest = new BulkRequest(); - int totalRequestSize = 0; for (int i = 0; i < 80; ++i) { IndexRequest request = new IndexRequest(INDEX_NAME).id(UUIDs.base64UUID()) .source(Collections.singletonMap("key", randomAlphaOfLength(50))); - totalRequestSize += request.ramBytesUsed(); assertTrue(request.ramBytesUsed() > request.source().length()); bulkRequest.add(request); } diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java index e2db9f85131a9..6f26515e7b75e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java @@ -1617,7 +1617,7 @@ public void testOngoingRecoveryAndClusterManagerFailOver() throws Exception { /* Shard assignment is stuck because recovery is blocked at CLEAN_FILES stage. Once, it times out after 60s the replica shards get assigned. https://github.com/opensearch-project/OpenSearch/issues/18098. - + Stack trace: Caused by: org.opensearch.transport.ReceiveTimeoutTransportException: [node_t3][127.0.0.1:56648][internal:index/shard/recovery/clean_files] request_id [20] timed out after [60026ms] at org.opensearch.transport.TransportService$TimeoutHandler.run(TransportService.java:1399) ~[main/:?] diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationClusterSettingIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationClusterSettingIT.java index d2f1e6313db07..daf2e58ac154a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationClusterSettingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationClusterSettingIT.java @@ -35,7 +35,6 @@ public class SegmentReplicationClusterSettingIT extends OpenSearchIntegTestCase { protected static final String INDEX_NAME = "test-idx-1"; - private static final String SYSTEM_INDEX_NAME = ".test-system-index"; protected static final int SHARD_COUNT = 1; protected static final int REPLICA_COUNT = 1; diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/settings/SearchOnlyReplicaIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/settings/SearchOnlyReplicaIT.java index db34bb113320d..b338ddca65465 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/settings/SearchOnlyReplicaIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/settings/SearchOnlyReplicaIT.java @@ -39,8 +39,6 @@ public class SearchOnlyReplicaIT extends RemoteStoreBaseIntegTestCase { private static final String TEST_INDEX = "test_index"; - private final String expectedFailureMessage = "To set index.number_of_search_replicas, index.replication.type must be set to SEGMENT"; - @Override public Settings indexSettings() { return Settings.builder() diff --git a/server/src/internalClusterTest/java/org/opensearch/ratelimitting/admissioncontrol/AdmissionForClusterManagerIT.java b/server/src/internalClusterTest/java/org/opensearch/ratelimitting/admissioncontrol/AdmissionForClusterManagerIT.java index 3294a80cb6777..db76ed6b7d007 100644 --- a/server/src/internalClusterTest/java/org/opensearch/ratelimitting/admissioncontrol/AdmissionForClusterManagerIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/ratelimitting/admissioncontrol/AdmissionForClusterManagerIT.java @@ -9,7 +9,6 @@ package org.opensearch.ratelimitting.admissioncontrol; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.admin.indices.alias.get.GetAliasesRequest; import org.opensearch.action.admin.indices.alias.get.GetAliasesResponse; import org.opensearch.action.support.clustermanager.term.GetTermVersionAction; @@ -53,8 +52,6 @@ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class AdmissionForClusterManagerIT extends OpenSearchIntegTestCase { - private static final Logger LOGGER = LogManager.getLogger(AdmissionForClusterManagerIT.class); - public static final String INDEX_NAME = "test_index"; private String clusterManagerNodeId; diff --git a/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteDualReplicationIT.java b/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteDualReplicationIT.java index d046f41ce0590..7a721c395df60 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteDualReplicationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotemigration/RemoteDualReplicationIT.java @@ -232,14 +232,14 @@ public void testRemotePrimaryDocRepAndRemoteReplica() throws Exception { public void testRetentionLeasePresentOnDocrepReplicaButNotRemote() throws Exception { /* Reducing indices.memory.shard_inactive_time to force a flush and trigger translog sync, instead of relying on Global CKP Sync action which doesn't run on remote enabled copies - + Under steady state, RetentionLeases would be on (GlobalCkp + 1) on a docrep enabled shard copy and (GlobalCkp) for a remote enabled shard copy. This is because we block translog sync on remote enabled shard copies during the GlobalCkpSync background task. - + RLs on remote enabled copies are brought up to (GlobalCkp + 1) upon a flush request issued by IndexingMemoryController when the shard becomes inactive after SHARD_INACTIVE_TIME_SETTING interval. - + Flush triggers a force sync of translog which bumps the RetentionLease sequence number along with it */ extraSettings = Settings.builder().put(IndexingMemoryController.SHARD_INACTIVE_TIME_SETTING.getKey(), "3s").build(); @@ -668,10 +668,10 @@ public void testFailoverRemotePrimaryToDocrepReplicaReseedToRemotePrimary() thro /* Performs the same experiment as testRemotePrimaryDocRepReplica. - + This ensures that the primary shard for the index has moved over to remote enabled node whereas the replica copy is still left behind on the docrep nodes - + At this stage, segrep lag computation shouldn't consider the docrep shard copy while calculating bytes lag */ public void testZeroSegrepLagForShardsWithMixedReplicationGroup() throws Exception { diff --git a/server/src/internalClusterTest/java/org/opensearch/remotemigration/ResizeIndexMigrationTestCase.java b/server/src/internalClusterTest/java/org/opensearch/remotemigration/ResizeIndexMigrationTestCase.java index b804e6dbc1231..3a7c976972491 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotemigration/ResizeIndexMigrationTestCase.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotemigration/ResizeIndexMigrationTestCase.java @@ -69,7 +69,6 @@ public void testFailResizeIndexWhileDocRepToRemoteStoreMigration() throws Except // add a remote node addRemote = true; - String remoteNodeName = internalCluster().startDataOnlyNode(); internalCluster().validateClusterFormed(); // set remote store migration direction @@ -77,24 +76,20 @@ public void testFailResizeIndexWhileDocRepToRemoteStoreMigration() throws Except assertAcked(internalCluster().client().admin().cluster().updateSettings(updateSettingsRequest).actionGet()); ResizeType resizeType; - int resizeShardsNum; - String cause; - switch (randomIntBetween(0, 2)) { - case 0: + int resizeShardsNum = switch (randomIntBetween(0, 2)) { + case 0 -> { resizeType = ResizeType.SHRINK; - resizeShardsNum = 5; - cause = "shrink_index"; - break; - case 1: + yield 5; + } + case 1 -> { resizeType = ResizeType.SPLIT; - resizeShardsNum = 20; - cause = "split_index"; - break; - default: + yield 20; + } + default -> { resizeType = ResizeType.CLONE; - resizeShardsNum = 10; - cause = "clone_index"; - } + yield 10; + } + }; internalCluster().client() .admin() @@ -163,7 +158,6 @@ public void testFailResizeIndexWhileRemoteStoreToDocRepMigration() throws Except // add a non-remote node addRemote = false; - String nonRemoteNodeName = internalCluster().startDataOnlyNode(); internalCluster().validateClusterFormed(); // set docrep migration direction @@ -171,24 +165,20 @@ public void testFailResizeIndexWhileRemoteStoreToDocRepMigration() throws Except assertAcked(internalCluster().client().admin().cluster().updateSettings(updateSettingsRequest).actionGet()); ResizeType resizeType; - int resizeShardsNum; - String cause; - switch (randomIntBetween(0, 2)) { - case 0: + int resizeShardsNum = switch (randomIntBetween(0, 2)) { + case 0 -> { resizeType = ResizeType.SHRINK; - resizeShardsNum = 5; - cause = "shrink_index"; - break; - case 1: + yield 5; + } + case 1 -> { resizeType = ResizeType.SPLIT; - resizeShardsNum = 20; - cause = "split_index"; - break; - default: + yield 20; + } + default -> { resizeType = ResizeType.CLONE; - resizeShardsNum = 10; - cause = "clone_index"; - } + yield 10; + } + }; internalCluster().client() .admin() diff --git a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexPrimaryRelocationIT.java b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexPrimaryRelocationIT.java index 67316ed0e6e6b..b518cc7f7bab6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexPrimaryRelocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexPrimaryRelocationIT.java @@ -16,8 +16,6 @@ import java.nio.file.Path; -import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings; - @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class RemoteIndexPrimaryRelocationIT extends IndexPrimaryRelocationIT { diff --git a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexRecoveryIT.java b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexRecoveryIT.java index 1961b0fa43705..0f0bbe7dcab4b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexRecoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteIndexRecoveryIT.java @@ -26,7 +26,6 @@ import java.nio.file.Path; import static org.opensearch.indices.recovery.RecoverySettings.INDICES_RECOVERY_CHUNK_SIZE_SETTING; -import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings; @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class RemoteIndexRecoveryIT extends IndexRecoveryIT { diff --git a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteRestoreSnapshotIT.java b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteRestoreSnapshotIT.java index 9929a614ea3e4..455ebd01d16e7 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteRestoreSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteRestoreSnapshotIT.java @@ -594,7 +594,6 @@ public void testRestoreShallowSnapshotRepository() throws ExecutionException, In Arrays.copyOf(pathTokens, pathTokens.length - 1); Path location = PathUtils.get(String.join("/", pathTokens)); pathTokens = absolutePath2.toString().split("/"); - String basePath2 = pathTokens[pathTokens.length - 1]; Arrays.copyOf(pathTokens, pathTokens.length - 1); Path location2 = PathUtils.get(String.join("/", pathTokens)); logger.info("Path 1 [{}]", absolutePath1); @@ -689,7 +688,6 @@ public void testRestoreShallowSnapshotIndexAfterSnapshot() throws ExecutionExcep Arrays.copyOf(pathTokens, pathTokens.length - 1); Path location = PathUtils.get(String.join("/", pathTokens)); pathTokens = absolutePath2.toString().split("/"); - String basePath2 = pathTokens[pathTokens.length - 1]; Arrays.copyOf(pathTokens, pathTokens.length - 1); Path location2 = PathUtils.get(String.join("/", pathTokens)); logger.info("Path 1 [{}]", absolutePath1); diff --git a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreClusterStateRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreClusterStateRestoreIT.java index e2fada2e3496c..69e45e41bd843 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreClusterStateRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreClusterStateRestoreIT.java @@ -83,10 +83,6 @@ protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(REMOTE_CLUSTER_STATE_ENABLED_SETTING.getKey(), true).build(); } - private void addNewNodes(int dataNodeCount, int clusterManagerNodeCount) { - internalCluster().startNodes(dataNodeCount + clusterManagerNodeCount); - } - private Map initialTestSetup(int shardCount, int replicaCount, int dataNodeCount, int clusterManagerNodeCount) { prepareCluster(clusterManagerNodeCount, dataNodeCount, INDEX_NAME, replicaCount, shardCount); Map indexStats = indexData(1, false, INDEX_NAME); diff --git a/server/src/internalClusterTest/java/org/opensearch/remotestore/RestoreShallowSnapshotV2IT.java b/server/src/internalClusterTest/java/org/opensearch/remotestore/RestoreShallowSnapshotV2IT.java index 19c84b818d692..8abeb873fc740 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotestore/RestoreShallowSnapshotV2IT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotestore/RestoreShallowSnapshotV2IT.java @@ -667,7 +667,6 @@ public void testRestoreShallowSnapshotRepository() throws ExecutionException, In Arrays.copyOf(pathTokens, pathTokens.length - 1); Path location = PathUtils.get(String.join("/", pathTokens)); pathTokens = absolutePath2.toString().split("/"); - String basePath2 = pathTokens[pathTokens.length - 1]; Arrays.copyOf(pathTokens, pathTokens.length - 1); Path location2 = PathUtils.get(String.join("/", pathTokens)); logger.info("Path 1 [{}]", absolutePath1); @@ -758,7 +757,6 @@ public void testRestoreShallowSnapshotIndexAfterSnapshot() throws ExecutionExcep Arrays.copyOf(pathTokens, pathTokens.length - 1); Path location = PathUtils.get(String.join("/", pathTokens)); pathTokens = absolutePath2.toString().split("/"); - String basePath2 = pathTokens[pathTokens.length - 1]; Arrays.copyOf(pathTokens, pathTokens.length - 1); Path location2 = PathUtils.get(String.join("/", pathTokens)); logger.info("Path 1 [{}]", absolutePath1); diff --git a/server/src/internalClusterTest/java/org/opensearch/remotestore/SegmentReplicationWithRemoteStorePressureIT.java b/server/src/internalClusterTest/java/org/opensearch/remotestore/SegmentReplicationWithRemoteStorePressureIT.java index 6cfc76b7e3223..ab133c28e1ef7 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotestore/SegmentReplicationWithRemoteStorePressureIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotestore/SegmentReplicationWithRemoteStorePressureIT.java @@ -16,8 +16,6 @@ import java.nio.file.Path; -import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings; - /** * This class executes the SegmentReplicationPressureIT suite with remote store integration enabled. */ diff --git a/server/src/internalClusterTest/java/org/opensearch/search/SearchWeightedRoutingIT.java b/server/src/internalClusterTest/java/org/opensearch/search/SearchWeightedRoutingIT.java index 7516b0090d2fa..b0ef7f8658303 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/SearchWeightedRoutingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/SearchWeightedRoutingIT.java @@ -935,7 +935,6 @@ public void testSearchAggregationWithNetworkDisruption_FailOpenEnabled() throws Set hitNodes = new HashSet<>(); Future[] responses = new Future[51]; - int size = 17; logger.info("--> making search requests"); for (int i = 0; i < 50; i++) { responses[i] = internalCluster().client(nodeMap.get("b").get(0)) diff --git a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/DoubleTermsIT.java b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/DoubleTermsIT.java index ccb4af8386472..a1e2f1ee32e99 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/DoubleTermsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/DoubleTermsIT.java @@ -427,20 +427,20 @@ public void testMultiValuedFieldWithValueScriptNotUnique() throws Exception { } /* - + [1, 2] [2, 3] [3, 4] [4, 5] [5, 6] - + 1 - count: 1 - sum: 1 2 - count: 2 - sum: 4 3 - count: 2 - sum: 6 4 - count: 2 - sum: 8 5 - count: 2 - sum: 10 6 - count: 1 - sum: 6 - + */ public void testScriptSingleValue() throws Exception { diff --git a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/LongTermsIT.java b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/LongTermsIT.java index 49031bfd3fc1d..f743f5e737d09 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/LongTermsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/LongTermsIT.java @@ -414,20 +414,20 @@ public void testMultiValuedFieldWithValueScriptNotUnique() throws Exception { } /* - + [1, 2] [2, 3] [3, 4] [4, 5] [5, 6] - + 1 - count: 1 - sum: 1 2 - count: 2 - sum: 4 3 - count: 2 - sum: 6 4 - count: 2 - sum: 8 5 - count: 2 - sum: 10 6 - count: 1 - sum: 6 - + */ public void testScriptSingleValue() throws Exception { diff --git a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/RangeIT.java b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/RangeIT.java index 5483db285dded..fe07b31238787 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/RangeIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/RangeIT.java @@ -614,7 +614,7 @@ public void testMultiValuedFieldWithValueScript() throws Exception { [9, 10] [10, 11] [11, 12] - + r1: 2 r2: 3, 3, 4, 4, 5, 5 r3: 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12 @@ -769,7 +769,7 @@ public void testScriptMultiValued() throws Exception { [8, 9] [9, 10] [10, 11] - + r1: 1, 2, 2 r2: 3, 3, 4, 4, 5, 5 r3: 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11 diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/DeleteSnapshotIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/DeleteSnapshotIT.java index ee4622a7d0f40..6894b4c7f3654 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/DeleteSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/DeleteSnapshotIT.java @@ -35,7 +35,6 @@ import static org.opensearch.index.remote.RemoteStoreEnums.DataCategory.SEGMENTS; import static org.opensearch.index.remote.RemoteStoreEnums.DataType.LOCK_FILES; -import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; import static org.hamcrest.Matchers.comparesEqualTo; import static org.hamcrest.Matchers.is; diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/RemoteIndexSnapshotStatusApiIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/RemoteIndexSnapshotStatusApiIT.java index e84de36df2fca..60dc20aeceac8 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/RemoteIndexSnapshotStatusApiIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/RemoteIndexSnapshotStatusApiIT.java @@ -51,7 +51,6 @@ import java.util.Map; import java.util.concurrent.TimeUnit; -import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings; import static org.opensearch.snapshots.SnapshotsService.MAX_SHARDS_ALLOWED_IN_STATUS_API; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/SystemRepositoryIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/SystemRepositoryIT.java index bb5cc89d4e1d5..cb2a408877013 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/SystemRepositoryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/SystemRepositoryIT.java @@ -17,8 +17,6 @@ import java.nio.file.Path; -import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings; - @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class SystemRepositoryIT extends AbstractSnapshotIntegTestCase { protected Path absolutePath; diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java index 17b633c533218..b95ad18471d0e 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java @@ -146,19 +146,6 @@ public NodesInfoRequest removeMetric(String metric) { return this; } - /** - * Helper method for adding and removing metrics. Used when deserializing - * a NodesInfoRequest from an ordered list of booleans. - * - * @param addMetric Whether or not to include a metric. - * @param metricName Name of the metric to include or remove. - */ - private void optionallyAddMetric(boolean addMetric, String metricName) { - if (addMetric) { - requestedMetrics.add(metricName); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/node/stats/NodesStatsRequest.java b/server/src/main/java/org/opensearch/action/admin/cluster/node/stats/NodesStatsRequest.java index db45d19dcdcb0..2392f28e6bbcb 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/node/stats/NodesStatsRequest.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/node/stats/NodesStatsRequest.java @@ -172,17 +172,6 @@ public NodesStatsRequest removeMetric(String metric) { return this; } - /** - * Helper method for adding metrics during deserialization. - * @param includeMetric Whether or not to include a metric. - * @param metricName Name of the metric to add. - */ - private void optionallyAddMetric(boolean includeMetric, String metricName) { - if (includeMetric) { - requestedMetrics.add(metricName); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/shards/routing/weighted/delete/TransportDeleteWeightedRoutingAction.java b/server/src/main/java/org/opensearch/action/admin/cluster/shards/routing/weighted/delete/TransportDeleteWeightedRoutingAction.java index cea85ebf588bd..48112ebd72822 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/shards/routing/weighted/delete/TransportDeleteWeightedRoutingAction.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/shards/routing/weighted/delete/TransportDeleteWeightedRoutingAction.java @@ -9,7 +9,6 @@ package org.opensearch.action.admin.cluster.shards.routing.weighted.delete; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction; import org.opensearch.cluster.ClusterState; @@ -35,8 +34,6 @@ public class TransportDeleteWeightedRoutingAction extends TransportClusterManage ClusterDeleteWeightedRoutingRequest, ClusterDeleteWeightedRoutingResponse> { - private static final Logger logger = LogManager.getLogger(TransportDeleteWeightedRoutingAction.class); - private final WeightedRoutingService weightedRoutingService; @Inject diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/shards/routing/weighted/get/TransportGetWeightedRoutingAction.java b/server/src/main/java/org/opensearch/action/admin/cluster/shards/routing/weighted/get/TransportGetWeightedRoutingAction.java index 6c110c0ea2a73..d62f8622eefd6 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/shards/routing/weighted/get/TransportGetWeightedRoutingAction.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/shards/routing/weighted/get/TransportGetWeightedRoutingAction.java @@ -9,7 +9,6 @@ package org.opensearch.action.admin.cluster.shards.routing.weighted.get; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeReadAction; import org.opensearch.cluster.ClusterState; @@ -36,7 +35,6 @@ public class TransportGetWeightedRoutingAction extends TransportClusterManagerNodeReadAction< ClusterGetWeightedRoutingRequest, ClusterGetWeightedRoutingResponse> { - private static final Logger logger = LogManager.getLogger(TransportGetWeightedRoutingAction.class); private final WeightedRoutingService weightedRoutingService; @Inject diff --git a/server/src/main/java/org/opensearch/action/admin/indices/datastream/GetDataStreamAction.java b/server/src/main/java/org/opensearch/action/admin/indices/datastream/GetDataStreamAction.java index 1db4e85887c23..92884adc2b33f 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/datastream/GetDataStreamAction.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/datastream/GetDataStreamAction.java @@ -323,10 +323,8 @@ protected void clusterManagerOperation(Request request, ClusterState state, Acti List dataStreamInfos = new ArrayList<>(dataStreams.size()); for (DataStream dataStream : dataStreams) { String indexTemplate = MetadataIndexTemplateService.findV2Template(state.metadata(), dataStream.getName(), false); - String ilmPolicyName = null; if (indexTemplate != null) { Settings settings = MetadataIndexTemplateService.resolveSettings(state.metadata(), indexTemplate); - ilmPolicyName = settings.get("index.lifecycle.name"); } else { logger.warn( "couldn't find any matching template for data stream [{}]. has it been restored (and possibly renamed)" diff --git a/server/src/main/java/org/opensearch/action/admin/indices/template/delete/TransportDeleteComponentTemplateAction.java b/server/src/main/java/org/opensearch/action/admin/indices/template/delete/TransportDeleteComponentTemplateAction.java index d1fe08cb5926c..0f449e95074da 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/template/delete/TransportDeleteComponentTemplateAction.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/template/delete/TransportDeleteComponentTemplateAction.java @@ -33,7 +33,6 @@ package org.opensearch.action.admin.indices.template.delete; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.clustermanager.AcknowledgedResponse; import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction; @@ -60,8 +59,6 @@ public class TransportDeleteComponentTemplateAction extends TransportClusterMana DeleteComponentTemplateAction.Request, AcknowledgedResponse> { - private static final Logger logger = LogManager.getLogger(TransportDeleteComponentTemplateAction.class); - private final MetadataIndexTemplateService indexTemplateService; @Inject diff --git a/server/src/main/java/org/opensearch/action/admin/indices/template/delete/TransportDeleteComposableIndexTemplateAction.java b/server/src/main/java/org/opensearch/action/admin/indices/template/delete/TransportDeleteComposableIndexTemplateAction.java index 53098447112ac..fc48ca0a930c7 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/template/delete/TransportDeleteComposableIndexTemplateAction.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/template/delete/TransportDeleteComposableIndexTemplateAction.java @@ -33,7 +33,6 @@ package org.opensearch.action.admin.indices.template.delete; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.clustermanager.AcknowledgedResponse; import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction; @@ -60,8 +59,6 @@ public class TransportDeleteComposableIndexTemplateAction extends TransportClust DeleteComposableIndexTemplateAction.Request, AcknowledgedResponse> { - private static final Logger logger = LogManager.getLogger(TransportDeleteComposableIndexTemplateAction.class); - private final MetadataIndexTemplateService indexTemplateService; @Inject diff --git a/server/src/main/java/org/opensearch/action/admin/indices/tiering/TransportHotToWarmTieringAction.java b/server/src/main/java/org/opensearch/action/admin/indices/tiering/TransportHotToWarmTieringAction.java index 8d1ab0bb37cdd..18a0287515579 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/tiering/TransportHotToWarmTieringAction.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/tiering/TransportHotToWarmTieringAction.java @@ -9,7 +9,6 @@ package org.opensearch.action.admin.indices.tiering; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction; import org.opensearch.cluster.ClusterInfoService; @@ -40,8 +39,6 @@ */ @ExperimentalApi public class TransportHotToWarmTieringAction extends TransportClusterManagerNodeAction { - - private static final Logger logger = LogManager.getLogger(TransportHotToWarmTieringAction.class); private final ClusterInfoService clusterInfoService; private final DiskThresholdSettings diskThresholdSettings; diff --git a/server/src/main/java/org/opensearch/action/admin/indices/view/ListViewNamesAction.java b/server/src/main/java/org/opensearch/action/admin/indices/view/ListViewNamesAction.java index eac0b1d5558ca..0a7d0054599d3 100644 --- a/server/src/main/java/org/opensearch/action/admin/indices/view/ListViewNamesAction.java +++ b/server/src/main/java/org/opensearch/action/admin/indices/view/ListViewNamesAction.java @@ -50,7 +50,6 @@ public Request(final StreamInput in) {} public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - final Request that = (Request) o; return true; } diff --git a/server/src/main/java/org/opensearch/action/ingest/SimulatePipelineRequest.java b/server/src/main/java/org/opensearch/action/ingest/SimulatePipelineRequest.java index b51f25d2e62b1..058dd54743eab 100644 --- a/server/src/main/java/org/opensearch/action/ingest/SimulatePipelineRequest.java +++ b/server/src/main/java/org/opensearch/action/ingest/SimulatePipelineRequest.java @@ -36,7 +36,6 @@ import org.opensearch.action.ActionRequest; import org.opensearch.action.ActionRequestValidationException; import org.opensearch.common.annotation.PublicApi; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.xcontent.XContentType; import org.opensearch.core.common.bytes.BytesReference; import org.opensearch.core.common.io.stream.StreamInput; @@ -65,8 +64,6 @@ */ @PublicApi(since = "1.0.0") public class SimulatePipelineRequest extends ActionRequest implements ToXContentObject { - - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(SimulatePipelineRequest.class); private String id; private boolean verbose; private BytesReference source; diff --git a/server/src/main/java/org/opensearch/action/pagination/WlmPaginationStrategy.java b/server/src/main/java/org/opensearch/action/pagination/WlmPaginationStrategy.java index 57f3b8017dec8..461c931a2eeec 100644 --- a/server/src/main/java/org/opensearch/action/pagination/WlmPaginationStrategy.java +++ b/server/src/main/java/org/opensearch/action/pagination/WlmPaginationStrategy.java @@ -39,7 +39,6 @@ public class WlmPaginationStrategy implements PaginationStrategy { private final List paginatedStats; private final int snapshotWorkloadGroupCount; private PageToken responseToken; - private static final String HASH_ALGORITHM = "SHA-256"; public WlmPaginationStrategy(int pageSize, String nextToken, SortBy sortBy, SortOrder sortOrder, WlmStatsResponse response) { this.pageSize = pageSize; diff --git a/server/src/main/java/org/opensearch/action/search/SearchRequestContext.java b/server/src/main/java/org/opensearch/action/search/SearchRequestContext.java index 398896734280e..3ab95f70c9fe3 100644 --- a/server/src/main/java/org/opensearch/action/search/SearchRequestContext.java +++ b/server/src/main/java/org/opensearch/action/search/SearchRequestContext.java @@ -9,7 +9,6 @@ package org.opensearch.action.search; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.lucene.search.TotalHits; import org.opensearch.common.annotation.InternalApi; import org.opensearch.core.index.Index; @@ -32,7 +31,6 @@ */ @InternalApi public class SearchRequestContext { - private static final Logger logger = LogManager.getLogger(); private final SearchRequestOperationsListener searchRequestOperationsListener; private long absoluteStartNanos; private final Map phaseTookMap; diff --git a/server/src/main/java/org/opensearch/action/support/TimeoutTaskCancellationUtility.java b/server/src/main/java/org/opensearch/action/support/TimeoutTaskCancellationUtility.java index ea6d2dbb65c43..059c2821ef67f 100644 --- a/server/src/main/java/org/opensearch/action/support/TimeoutTaskCancellationUtility.java +++ b/server/src/main/java/org/opensearch/action/support/TimeoutTaskCancellationUtility.java @@ -38,8 +38,6 @@ public class TimeoutTaskCancellationUtility { private static final Logger logger = LogManager.getLogger(TimeoutTaskCancellationUtility.class); - private static final AtomicBoolean executeResponseOrFailureOnce = new AtomicBoolean(true); - /** * Wraps a listener with a timeout listener {@link TimeoutRunnableListener} to schedule the task cancellation for provided tasks on * generic thread pool diff --git a/server/src/main/java/org/opensearch/action/support/clustermanager/term/TransportGetTermVersionAction.java b/server/src/main/java/org/opensearch/action/support/clustermanager/term/TransportGetTermVersionAction.java index 22861e0ba5c31..284118b61d1d6 100644 --- a/server/src/main/java/org/opensearch/action/support/clustermanager/term/TransportGetTermVersionAction.java +++ b/server/src/main/java/org/opensearch/action/support/clustermanager/term/TransportGetTermVersionAction.java @@ -9,7 +9,6 @@ package org.opensearch.action.support.clustermanager.term; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.support.ActionFilters; import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeReadAction; import org.opensearch.cluster.ClusterState; @@ -35,8 +34,6 @@ */ public class TransportGetTermVersionAction extends TransportClusterManagerNodeReadAction { - private final Logger logger = LogManager.getLogger(getClass()); - private final Discovery discovery; private boolean usePreCommitState = false; diff --git a/server/src/main/java/org/opensearch/cluster/action/index/MappingUpdatedAction.java b/server/src/main/java/org/opensearch/cluster/action/index/MappingUpdatedAction.java index 2caea2a8431a4..438597030c5ca 100644 --- a/server/src/main/java/org/opensearch/cluster/action/index/MappingUpdatedAction.java +++ b/server/src/main/java/org/opensearch/cluster/action/index/MappingUpdatedAction.java @@ -32,7 +32,6 @@ package org.opensearch.cluster.action.index; -import org.opensearch.OpenSearchException; import org.opensearch.action.admin.indices.mapping.put.AutoPutMappingAction; import org.opensearch.action.admin.indices.mapping.put.PutMappingRequest; import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest; @@ -44,7 +43,6 @@ import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; import org.opensearch.common.util.concurrent.RunOnce; -import org.opensearch.common.util.concurrent.UncategorizedExecutionException; import org.opensearch.core.action.ActionListener; import org.opensearch.core.index.Index; import org.opensearch.core.xcontent.MediaTypeRegistry; @@ -150,19 +148,6 @@ protected void sendUpdateMapping(Index index, Mapping mappingUpdate, ActionListe ); } - // todo: this explicit unwrap should not be necessary, but is until guessRootCause is fixed to allow wrapped non-es exception. - private static Exception unwrapException(Exception cause) { - return cause instanceof OpenSearchException ? unwrapEsException((OpenSearchException) cause) : cause; - } - - private static RuntimeException unwrapEsException(OpenSearchException esEx) { - Throwable root = esEx.unwrapCause(); - if (root instanceof RuntimeException) { - return (RuntimeException) root; - } - return new UncategorizedExecutionException("Failed execution", root); - } - /** * An adjustable semaphore * diff --git a/server/src/main/java/org/opensearch/cluster/metadata/WorkloadGroupMetadata.java b/server/src/main/java/org/opensearch/cluster/metadata/WorkloadGroupMetadata.java index f6f039e03f285..bea8a948d2669 100644 --- a/server/src/main/java/org/opensearch/cluster/metadata/WorkloadGroupMetadata.java +++ b/server/src/main/java/org/opensearch/cluster/metadata/WorkloadGroupMetadata.java @@ -12,7 +12,6 @@ import org.opensearch.cluster.Diff; import org.opensearch.cluster.DiffableUtils; import org.opensearch.cluster.NamedDiff; -import org.opensearch.core.ParseField; import org.opensearch.core.common.Strings; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; @@ -44,7 +43,6 @@ public class WorkloadGroupMetadata implements Metadata.Custom { // We are not changing this name to ensure the cluster state restore works when a OS version < 3.0 writes it to // either a remote store or on local disk and OS version >= 3.0 reads it public static final String TYPE = "queryGroups"; - private static final ParseField WORKLOAD_GROUP_FIELD = new ParseField("queryGroups"); private final Map workloadGroups; diff --git a/server/src/main/java/org/opensearch/cluster/routing/allocation/AwarenessReplicaBalance.java b/server/src/main/java/org/opensearch/cluster/routing/allocation/AwarenessReplicaBalance.java index 538d49d4e4701..9f52b08792e1a 100644 --- a/server/src/main/java/org/opensearch/cluster/routing/allocation/AwarenessReplicaBalance.java +++ b/server/src/main/java/org/opensearch/cluster/routing/allocation/AwarenessReplicaBalance.java @@ -80,14 +80,14 @@ private void setAwarenessAttributes(List awarenessAttributes) { /* For a cluster having zone as awareness attribute , it will return the size of zones if set it forced awareness attributes - + If there are multiple forced awareness attributes, it will return size of the largest list, as all copies of data is supposed to get distributed amongst those. - + cluster.routing.allocation.awareness.attributes: rack_id , zone cluster.routing.allocation.awareness.force.zone.values: zone1, zone2 cluster.routing.allocation.awareness.force.rack_id.values: rack_id1, rack_id2, rack_id3 - + In this case, awareness attributes would be 3. */ public int maxAwarenessAttributes() { diff --git a/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java b/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java index bd5b694f4fe41..42218310a3a12 100644 --- a/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java +++ b/server/src/main/java/org/opensearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java @@ -66,7 +66,6 @@ import java.util.Map; import java.util.Set; -import static org.opensearch.cluster.action.shard.ShardStateAction.FOLLOW_UP_REROUTE_PRIORITY_SETTING; import static org.opensearch.cluster.routing.allocation.ConstraintTypes.CLUSTER_PRIMARY_SHARD_BALANCE_CONSTRAINT_ID; import static org.opensearch.cluster.routing.allocation.ConstraintTypes.CLUSTER_PRIMARY_SHARD_REBALANCE_CONSTRAINT_ID; import static org.opensearch.cluster.routing.allocation.ConstraintTypes.INDEX_PRIMARY_SHARD_BALANCE_CONSTRAINT_ID; diff --git a/server/src/main/java/org/opensearch/cluster/routing/allocation/command/CancelAllocationCommand.java b/server/src/main/java/org/opensearch/cluster/routing/allocation/command/CancelAllocationCommand.java index a07f3eb9d95e1..5e35f587e7fa1 100644 --- a/server/src/main/java/org/opensearch/cluster/routing/allocation/command/CancelAllocationCommand.java +++ b/server/src/main/java/org/opensearch/cluster/routing/allocation/command/CancelAllocationCommand.java @@ -116,7 +116,7 @@ public String index() { } /** - + * Get the id of the shard which allocation should be canceled * @return id of the shard which allocation should be canceled */ diff --git a/server/src/main/java/org/opensearch/common/io/VersionedCodecStreamWrapper.java b/server/src/main/java/org/opensearch/common/io/VersionedCodecStreamWrapper.java index b62ae1f1d3956..c2efb897f8749 100644 --- a/server/src/main/java/org/opensearch/common/io/VersionedCodecStreamWrapper.java +++ b/server/src/main/java/org/opensearch/common/io/VersionedCodecStreamWrapper.java @@ -13,7 +13,6 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.index.CorruptIndexException; -import org.apache.lucene.store.ChecksumIndexInput; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; @@ -97,15 +96,6 @@ private int checkHeader(IndexInput indexInput) throws IOException { return CodecUtil.checkHeader(indexInput, this.codec, minVersion, this.currentVersion); } - /** - * Reads footer from file input stream containing checksum. - * The {@link IndexInput#getFilePointer()} should be at the footer start position. - * @param indexInput file input stream - */ - private void checkFooter(ChecksumIndexInput indexInput) throws IOException { - CodecUtil.checkFooter(indexInput); - } - /** * Writes header with {@code this.codec} and {@code this.currentVersion} to the file output stream * @param indexOutput file output stream diff --git a/server/src/main/java/org/opensearch/env/NodeEnvironment.java b/server/src/main/java/org/opensearch/env/NodeEnvironment.java index 4e284f1fe5c3e..a6e6679b9e272 100644 --- a/server/src/main/java/org/opensearch/env/NodeEnvironment.java +++ b/server/src/main/java/org/opensearch/env/NodeEnvironment.java @@ -677,18 +677,6 @@ public void deleteIndexDirectoryUnderLock(Index index, IndexSettings indexSettin } } - private void deleteIndexFileCacheDirectory(Index index) { - final Path indexCachePath = fileCacheNodePath().fileCachePath.resolve(index.getUUID()); - logger.trace("deleting index {} file cache directory, path: [{}]", index, indexCachePath); - if (Files.exists(indexCachePath)) { - try { - IOUtils.rm(indexCachePath); - } catch (IOException e) { - logger.error(() -> new ParameterizedMessage("Failed to delete cache path for index {}", index), e); - } - } - } - /** * Tries to lock all local shards for the given index. If any of the shard locks can't be acquired * a {@link ShardLockObtainFailedException} is thrown and all previously acquired locks are released. diff --git a/server/src/main/java/org/opensearch/extensions/ExtensionDependency.java b/server/src/main/java/org/opensearch/extensions/ExtensionDependency.java index 99f6a063b437e..4a61d319c275e 100644 --- a/server/src/main/java/org/opensearch/extensions/ExtensionDependency.java +++ b/server/src/main/java/org/opensearch/extensions/ExtensionDependency.java @@ -25,8 +25,6 @@ public class ExtensionDependency implements Writeable { private String uniqueId; private Version version; - private static final String UNIQUE_ID = "uniqueId"; - private static final String VERSION = "version"; public ExtensionDependency(String uniqueId, Version version) { this.uniqueId = uniqueId; diff --git a/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java b/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java index 19424e5213151..050fa1c7530cf 100644 --- a/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java +++ b/server/src/main/java/org/opensearch/extensions/ExtensionRequest.java @@ -9,7 +9,6 @@ package org.opensearch.extensions; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.common.Nullable; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; @@ -26,7 +25,6 @@ * @opensearch.internal */ public class ExtensionRequest extends TransportRequest { - private static final Logger logger = LogManager.getLogger(ExtensionRequest.class); private final ExtensionRequestProto.ExtensionRequest request; public ExtensionRequest(ExtensionRequestProto.RequestType requestType) { diff --git a/server/src/main/java/org/opensearch/extensions/OpenSearchRequest.java b/server/src/main/java/org/opensearch/extensions/OpenSearchRequest.java index 63ddfdc91eb7a..0f0c77a527f34 100644 --- a/server/src/main/java/org/opensearch/extensions/OpenSearchRequest.java +++ b/server/src/main/java/org/opensearch/extensions/OpenSearchRequest.java @@ -9,7 +9,6 @@ package org.opensearch.extensions; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; import org.opensearch.transport.TransportRequest; @@ -23,8 +22,6 @@ * @opensearch.internal */ public class OpenSearchRequest extends TransportRequest { - - private static final Logger logger = LogManager.getLogger(OpenSearchRequest.class); private ExtensionsManager.OpenSearchRequestType requestType; /** diff --git a/server/src/main/java/org/opensearch/extensions/UpdateSettingsRequest.java b/server/src/main/java/org/opensearch/extensions/UpdateSettingsRequest.java index 0295269b1787f..65ab7576a07bd 100644 --- a/server/src/main/java/org/opensearch/extensions/UpdateSettingsRequest.java +++ b/server/src/main/java/org/opensearch/extensions/UpdateSettingsRequest.java @@ -9,7 +9,6 @@ package org.opensearch.extensions; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.WriteableSetting; import org.opensearch.core.common.io.stream.StreamInput; @@ -25,7 +24,6 @@ * @opensearch.internal */ public class UpdateSettingsRequest extends TransportRequest { - private static final Logger logger = LogManager.getLogger(UpdateSettingsRequest.class); private WriteableSetting.SettingType settingType; private Setting componentSetting; diff --git a/server/src/main/java/org/opensearch/gateway/ShardsBatchGatewayAllocator.java b/server/src/main/java/org/opensearch/gateway/ShardsBatchGatewayAllocator.java index ce14cb3442f75..d72716a461389 100644 --- a/server/src/main/java/org/opensearch/gateway/ShardsBatchGatewayAllocator.java +++ b/server/src/main/java/org/opensearch/gateway/ShardsBatchGatewayAllocator.java @@ -43,7 +43,6 @@ import org.opensearch.indices.store.ShardAttributes; import org.opensearch.indices.store.TransportNodesListShardStoreMetadataBatch; import org.opensearch.indices.store.TransportNodesListShardStoreMetadataBatch.NodeStoreFilesMetadata; -import org.opensearch.indices.store.TransportNodesListShardStoreMetadataHelper; import org.opensearch.indices.store.TransportNodesListShardStoreMetadataHelper.StoreFilesMetadata; import org.opensearch.telemetry.metrics.noop.NoopMetricsRegistry; @@ -838,17 +837,6 @@ protected void removeShard(ShardId shardId) { this.batchInfo.remove(shardId); } - private TransportNodesListShardStoreMetadataBatch.NodeStoreFilesMetadata buildEmptyReplicaShardResponse() { - return new TransportNodesListShardStoreMetadataBatch.NodeStoreFilesMetadata( - new TransportNodesListShardStoreMetadataHelper.StoreFilesMetadata( - null, - Store.MetadataSnapshot.EMPTY, - Collections.emptyList() - ), - null - ); - } - private void removeFromBatch(ShardRouting shard) { removeShard(shard.shardId()); clearShardFromCache(shard.shardId()); diff --git a/server/src/main/java/org/opensearch/gateway/remote/RemoteClusterStateService.java b/server/src/main/java/org/opensearch/gateway/remote/RemoteClusterStateService.java index c68cce4034716..943f5becc528a 100644 --- a/server/src/main/java/org/opensearch/gateway/remote/RemoteClusterStateService.java +++ b/server/src/main/java/org/opensearch/gateway/remote/RemoteClusterStateService.java @@ -1948,13 +1948,6 @@ public void setRemoteStateReadTimeout(TimeValue remoteStateReadTimeout) { this.remoteStateReadTimeout = remoteStateReadTimeout; } - private BlobStoreTransferService getBlobStoreTransferService() { - if (blobStoreTransferService == null) { - blobStoreTransferService = new BlobStoreTransferService(getBlobStore(), threadpool); - } - return blobStoreTransferService; - } - Set getAllClusterUUIDs(String clusterName) throws IOException { Map clusterUUIDMetadata = clusterUUIDContainer(blobStoreRepository, clusterName).children(); if (clusterUUIDMetadata == null) { @@ -1963,22 +1956,6 @@ Set getAllClusterUUIDs(String clusterName) throws IOException { return Collections.unmodifiableSet(clusterUUIDMetadata.keySet()); } - private Map getLatestManifestForAllClusterUUIDs(String clusterName, Set clusterUUIDs) { - Map manifestsByClusterUUID = new HashMap<>(); - for (String clusterUUID : clusterUUIDs) { - try { - Optional manifest = getLatestClusterMetadataManifest(clusterName, clusterUUID); - manifest.ifPresent(clusterMetadataManifest -> manifestsByClusterUUID.put(clusterUUID, clusterMetadataManifest)); - } catch (Exception e) { - throw new IllegalStateException( - String.format(Locale.ROOT, "Exception in fetching manifest for clusterUUID: %s", clusterUUID), - e - ); - } - } - return manifestsByClusterUUID; - } - /** * This method creates a valid cluster UUID chain. * diff --git a/server/src/main/java/org/opensearch/identity/noop/NoopTokenManager.java b/server/src/main/java/org/opensearch/identity/noop/NoopTokenManager.java index fa6643b7447dc..d86a95300edbd 100644 --- a/server/src/main/java/org/opensearch/identity/noop/NoopTokenManager.java +++ b/server/src/main/java/org/opensearch/identity/noop/NoopTokenManager.java @@ -9,7 +9,6 @@ package org.opensearch.identity.noop; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.identity.IdentityService; import org.opensearch.identity.Subject; import org.opensearch.identity.tokens.AuthToken; @@ -21,8 +20,6 @@ */ public class NoopTokenManager implements TokenManager { - private static final Logger log = LogManager.getLogger(IdentityService.class); - /** * Issue a new Noop Token * @return a new Noop Token diff --git a/server/src/main/java/org/opensearch/identity/tokens/OnBehalfOfClaims.java b/server/src/main/java/org/opensearch/identity/tokens/OnBehalfOfClaims.java index 2b37ed954e7d4..653cf9f384867 100644 --- a/server/src/main/java/org/opensearch/identity/tokens/OnBehalfOfClaims.java +++ b/server/src/main/java/org/opensearch/identity/tokens/OnBehalfOfClaims.java @@ -25,7 +25,7 @@ public class OnBehalfOfClaims { * Constructor for OnBehalfOfClaims * @param aud the Audience for the token * @param expiration_seconds the length of time in seconds the token is valid - + */ public OnBehalfOfClaims(String aud, Long expiration_seconds) { this.audience = aud; diff --git a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilder.java b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilder.java index 3db3cbe9652fc..c39e83cb29687 100644 --- a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilder.java +++ b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/BaseStarTreeBuilder.java @@ -1102,18 +1102,6 @@ private StarTreeDocument createAggregatedDocs(InMemoryTreeNode node) throws IOEx return aggregatedStarTreeDocument; } - /** - * Handles the dimension of date time field type - * - * @param fieldName name of the field - * @param val value of the field - * @return returns the converted dimension of the field to a particular granularity - */ - private long handleDateDimension(final String fieldName, final long val) { - // TODO: handle timestamp granularity - return val; - } - public void close() throws IOException { } diff --git a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/SegmentDocsFileManager.java b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/SegmentDocsFileManager.java index 363e02b52d5e3..f0c73cbd4e1fd 100644 --- a/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/SegmentDocsFileManager.java +++ b/server/src/main/java/org/opensearch/index/compositeindex/datacube/startree/builder/SegmentDocsFileManager.java @@ -9,7 +9,6 @@ package org.opensearch.index.compositeindex.datacube.startree.builder; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.lucene.index.SegmentWriteState; import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; @@ -33,8 +32,6 @@ */ @ExperimentalApi public class SegmentDocsFileManager extends AbstractDocumentsFileManager implements Closeable { - - private static final Logger logger = LogManager.getLogger(SegmentDocsFileManager.class); private static final String SEGMENT_DOC_FILE_NAME = "segment.documents"; private IndexInput segmentDocsFileInput; private RandomAccessInput segmentRandomInput; diff --git a/server/src/main/java/org/opensearch/index/query/IdsQueryBuilder.java b/server/src/main/java/org/opensearch/index/query/IdsQueryBuilder.java index d7ebdbff10adb..f1ece685d18aa 100644 --- a/server/src/main/java/org/opensearch/index/query/IdsQueryBuilder.java +++ b/server/src/main/java/org/opensearch/index/query/IdsQueryBuilder.java @@ -34,7 +34,6 @@ import org.apache.lucene.search.Query; import org.opensearch.Version; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.core.ParseField; import org.opensearch.core.common.ParsingException; import org.opensearch.core.common.Strings; @@ -63,10 +62,7 @@ */ public class IdsQueryBuilder extends AbstractQueryBuilder { public static final String NAME = "ids"; - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(IdsQueryBuilder.class); static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Types are deprecated in [ids] queries."; - - private static final ParseField TYPE_FIELD = new ParseField("type"); private static final ParseField VALUES_FIELD = new ParseField("values"); private final Set ids = new HashSet<>(); diff --git a/server/src/main/java/org/opensearch/index/query/MultiMatchQueryBuilder.java b/server/src/main/java/org/opensearch/index/query/MultiMatchQueryBuilder.java index b336df33860e2..3a01a584e027e 100644 --- a/server/src/main/java/org/opensearch/index/query/MultiMatchQueryBuilder.java +++ b/server/src/main/java/org/opensearch/index/query/MultiMatchQueryBuilder.java @@ -643,7 +643,6 @@ public static MultiMatchQueryBuilder fromXContent(XContentParser parser) throws Operator operator = DEFAULT_OPERATOR; String minimumShouldMatch = null; String fuzzyRewrite = null; - Boolean useDisMax = null; Float tieBreaker = null; Float cutoffFrequency = null; Boolean lenient = null; diff --git a/server/src/main/java/org/opensearch/index/reindex/ReindexRequest.java b/server/src/main/java/org/opensearch/index/reindex/ReindexRequest.java index 393e01823024e..ccf5f1c6850fc 100644 --- a/server/src/main/java/org/opensearch/index/reindex/ReindexRequest.java +++ b/server/src/main/java/org/opensearch/index/reindex/ReindexRequest.java @@ -36,7 +36,6 @@ import org.opensearch.action.CompositeIndicesRequest; import org.opensearch.action.index.IndexRequest; import org.opensearch.action.search.SearchRequest; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.lucene.uid.Versions; import org.opensearch.common.unit.TimeValue; import org.opensearch.core.ParseField; @@ -345,7 +344,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws static final ObjectParser PARSER = new ObjectParser<>("reindex"); static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in reindex requests is deprecated."; - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(ReindexRequest.class); static { ObjectParser.Parser sourceParser = (parser, request, context) -> { diff --git a/server/src/main/java/org/opensearch/index/remote/RemoteStorePressureSettings.java b/server/src/main/java/org/opensearch/index/remote/RemoteStorePressureSettings.java index e66aa3444c214..504903b737e7c 100644 --- a/server/src/main/java/org/opensearch/index/remote/RemoteStorePressureSettings.java +++ b/server/src/main/java/org/opensearch/index/remote/RemoteStorePressureSettings.java @@ -101,10 +101,6 @@ long getMinRefreshSeqNoLagLimit() { return minRefreshSeqNoLagLimit; } - private void setMinRefreshSeqNoLagLimit(long minRefreshSeqNoLagLimit) { - this.minRefreshSeqNoLagLimit = minRefreshSeqNoLagLimit; - } - double getBytesLagVarianceFactor() { return bytesLagVarianceFactor; } diff --git a/server/src/main/java/org/opensearch/index/remote/RemoteStoreUtils.java b/server/src/main/java/org/opensearch/index/remote/RemoteStoreUtils.java index 32a1ca0e5d5ab..89a65f424e672 100644 --- a/server/src/main/java/org/opensearch/index/remote/RemoteStoreUtils.java +++ b/server/src/main/java/org/opensearch/index/remote/RemoteStoreUtils.java @@ -55,7 +55,6 @@ * @opensearch.internal */ public class RemoteStoreUtils { - private static final Logger logger = LogManager.getLogger(RemoteStoreUtils.class); public static final int LONG_MAX_LENGTH = String.valueOf(Long.MAX_VALUE).length(); /** diff --git a/server/src/main/java/org/opensearch/index/shard/ShardSplittingQuery.java b/server/src/main/java/org/opensearch/index/shard/ShardSplittingQuery.java index 4c1c4796ef6b2..e0801aa60faf3 100644 --- a/server/src/main/java/org/opensearch/index/shard/ShardSplittingQuery.java +++ b/server/src/main/java/org/opensearch/index/shard/ShardSplittingQuery.java @@ -243,7 +243,6 @@ private static void findSplitDocs(String idField, Predicate includeInS private final class Visitor extends StoredFieldVisitor { final LeafReader leafReader; private int leftToVisit = 2; - private final BytesRef spare = new BytesRef(); private String routing; private String id; diff --git a/server/src/main/java/org/opensearch/index/similarity/SimilarityProviders.java b/server/src/main/java/org/opensearch/index/similarity/SimilarityProviders.java index 3465632eee6da..2a7f6003d0cb7 100644 --- a/server/src/main/java/org/opensearch/index/similarity/SimilarityProviders.java +++ b/server/src/main/java/org/opensearch/index/similarity/SimilarityProviders.java @@ -65,7 +65,6 @@ import org.apache.lucene.search.similarities.NormalizationZ; import org.apache.lucene.search.similarities.Similarity; import org.opensearch.Version; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.settings.Settings; import org.opensearch.lucene.similarity.LegacyBM25Similarity; @@ -84,9 +83,8 @@ */ final class SimilarityProviders { - private SimilarityProviders() {} // no instantiation + private SimilarityProviders() {} - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(SimilarityProviders.class); static final String DISCOUNT_OVERLAPS = "discount_overlaps"; private static final Map BASIC_MODELS; diff --git a/server/src/main/java/org/opensearch/index/snapshots/blobstore/RemoteStoreShardShallowCopySnapshot.java b/server/src/main/java/org/opensearch/index/snapshots/blobstore/RemoteStoreShardShallowCopySnapshot.java index 9c0ea42810e16..200a617dfc509 100644 --- a/server/src/main/java/org/opensearch/index/snapshots/blobstore/RemoteStoreShardShallowCopySnapshot.java +++ b/server/src/main/java/org/opensearch/index/snapshots/blobstore/RemoteStoreShardShallowCopySnapshot.java @@ -355,7 +355,7 @@ public String snapshot() { /* Returns list of files in the shard - + @return list of files */ diff --git a/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java b/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java index e697e16d5e8a0..a9a03428d2a7e 100644 --- a/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java +++ b/server/src/main/java/org/opensearch/index/translog/RemoteFsTranslog.java @@ -215,7 +215,7 @@ static void download(TranslogTransferManager translogTransferManager, Path locat In Primary to Primary relocation , there can be concurrent upload and download of translog. While translog files are getting downloaded by new primary, it might hence be deleted by the primary Hence we retry if tlog/ckp files are not found . - + This doesn't happen in last download , where it is ensured that older primary has stopped modifying tlog data. */ IOException ex = null; diff --git a/server/src/main/java/org/opensearch/indices/analysis/AnalysisModule.java b/server/src/main/java/org/opensearch/indices/analysis/AnalysisModule.java index dbb3035a18f74..65d205e479ede 100644 --- a/server/src/main/java/org/opensearch/indices/analysis/AnalysisModule.java +++ b/server/src/main/java/org/opensearch/indices/analysis/AnalysisModule.java @@ -36,7 +36,6 @@ import org.opensearch.Version; import org.opensearch.cluster.metadata.IndexMetadata; import org.opensearch.common.NamedRegistry; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.settings.Settings; import org.opensearch.env.Environment; import org.opensearch.index.IndexSettings; @@ -86,7 +85,6 @@ public final class AnalysisModule { } private static final IndexSettings NA_INDEX_SETTINGS; - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(AnalysisModule.class); private final HunspellService hunspellService; private final AnalysisRegistry analysisRegistry; diff --git a/server/src/main/java/org/opensearch/node/resource/tracker/AverageIoUsageTracker.java b/server/src/main/java/org/opensearch/node/resource/tracker/AverageIoUsageTracker.java index 5472d4bda2326..9ac062fc15747 100644 --- a/server/src/main/java/org/opensearch/node/resource/tracker/AverageIoUsageTracker.java +++ b/server/src/main/java/org/opensearch/node/resource/tracker/AverageIoUsageTracker.java @@ -9,7 +9,6 @@ package org.opensearch.node.resource.tracker; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.lucene.util.Constants; import org.opensearch.common.ValidationException; import org.opensearch.common.unit.TimeValue; @@ -26,8 +25,6 @@ * and keeping track of the rolling average over a defined time window (windowDuration). */ public class AverageIoUsageTracker extends AbstractAverageUsageTracker { - - private static final Logger LOGGER = LogManager.getLogger(AverageIoUsageTracker.class); private final FsService fsService; private final HashMap prevIoTimeDeviceMap; private long prevTimeInMillis; diff --git a/server/src/main/java/org/opensearch/persistent/PersistentTasksClusterService.java b/server/src/main/java/org/opensearch/persistent/PersistentTasksClusterService.java index eb187224ebf07..4cab2bdd979de 100644 --- a/server/src/main/java/org/opensearch/persistent/PersistentTasksClusterService.java +++ b/server/src/main/java/org/opensearch/persistent/PersistentTasksClusterService.java @@ -372,7 +372,7 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS * @param taskName the task's name * @param taskParams the task's parameters * @param currentState the current {@link ClusterState} - + * @return a new {@link Assignment} */ private Assignment createAssignment( diff --git a/server/src/main/java/org/opensearch/plugins/SearchPlugin.java b/server/src/main/java/org/opensearch/plugins/SearchPlugin.java index 80a4619f56b64..651761e6b29e5 100644 --- a/server/src/main/java/org/opensearch/plugins/SearchPlugin.java +++ b/server/src/main/java/org/opensearch/plugins/SearchPlugin.java @@ -667,7 +667,7 @@ public PipelineAggregationSpec( * @param builderReader the reader registered for this aggregation's builder. Typically, a reference to a constructor that takes a * {@link StreamInput} * @param parser reads the aggregation builder from XContent - + */ public PipelineAggregationSpec( String name, diff --git a/server/src/main/java/org/opensearch/ratelimitting/admissioncontrol/AdmissionControlService.java b/server/src/main/java/org/opensearch/ratelimitting/admissioncontrol/AdmissionControlService.java index 5b842ff0d3399..747a790759098 100644 --- a/server/src/main/java/org/opensearch/ratelimitting/admissioncontrol/AdmissionControlService.java +++ b/server/src/main/java/org/opensearch/ratelimitting/admissioncontrol/AdmissionControlService.java @@ -9,7 +9,6 @@ package org.opensearch.ratelimitting.admissioncontrol; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.lucene.util.Constants; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.settings.Settings; @@ -37,7 +36,6 @@ public class AdmissionControlService { private final ThreadPool threadPool; public final AdmissionControlSettings admissionControlSettings; private final ConcurrentMap admissionControllers; - private static final Logger logger = LogManager.getLogger(AdmissionControlService.class); private final ClusterService clusterService; private final Settings settings; private final ResourceUsageCollectorService resourceUsageCollectorService; diff --git a/server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java b/server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java index 7cdbc31563654..e7d44967f87eb 100644 --- a/server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java +++ b/server/src/main/java/org/opensearch/repositories/blobstore/BlobStoreRepository.java @@ -322,8 +322,6 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp Setting.Property.Deprecated ); - private static final Logger staticLogger = LogManager.getLogger(BlobStoreRepository.class); - /** * Setting to disable caching of the latest repository data. */ diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java index d87fd4c8aa75d..5b96587a056e0 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestAddVotingConfigExclusionAction.java @@ -33,7 +33,6 @@ package org.opensearch.rest.action.admin.cluster; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.admin.cluster.configuration.AddVotingConfigExclusionsAction; import org.opensearch.action.admin.cluster.configuration.AddVotingConfigExclusionsRequest; import org.opensearch.common.unit.TimeValue; @@ -56,7 +55,6 @@ */ public class RestAddVotingConfigExclusionAction extends BaseRestHandler { private static final TimeValue DEFAULT_TIMEOUT = TimeValue.timeValueSeconds(30L); - private static final Logger logger = LogManager.getLogger(RestAddVotingConfigExclusionAction.class); private static final String DEPRECATION_MESSAGE = "POST /_cluster/voting_config_exclusions/{node_name} " + "will be removed in a future version. " diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterDeleteWeightedRoutingAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterDeleteWeightedRoutingAction.java index 6f58177b2221c..399cbc0842744 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterDeleteWeightedRoutingAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterDeleteWeightedRoutingAction.java @@ -9,7 +9,6 @@ package org.opensearch.rest.action.admin.cluster; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.admin.cluster.shards.routing.weighted.delete.ClusterDeleteWeightedRoutingRequest; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; @@ -32,8 +31,6 @@ */ public class RestClusterDeleteWeightedRoutingAction extends BaseRestHandler { - private static final Logger logger = LogManager.getLogger(RestClusterDeleteWeightedRoutingAction.class); - @Override public List routes() { return unmodifiableList( diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterGetWeightedRoutingAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterGetWeightedRoutingAction.java index 22fdf5ddbda4e..d597af89d299f 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterGetWeightedRoutingAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterGetWeightedRoutingAction.java @@ -9,7 +9,6 @@ package org.opensearch.rest.action.admin.cluster; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.admin.cluster.shards.routing.weighted.get.ClusterGetWeightedRoutingRequest; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; @@ -31,8 +30,6 @@ */ public class RestClusterGetWeightedRoutingAction extends BaseRestHandler { - private static final Logger logger = LogManager.getLogger(RestClusterGetWeightedRoutingAction.class); - @Override public List routes() { return singletonList(new Route(GET, "/_cluster/routing/awareness/{attribute}/weights")); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterPutWeightedRoutingAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterPutWeightedRoutingAction.java index f8eba1c1c2210..2a3994df7f73a 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterPutWeightedRoutingAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterPutWeightedRoutingAction.java @@ -9,7 +9,6 @@ package org.opensearch.rest.action.admin.cluster; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.action.admin.cluster.shards.routing.weighted.put.ClusterPutWeightedRoutingRequest; import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.RestRequest; @@ -31,8 +30,6 @@ */ public class RestClusterPutWeightedRoutingAction extends BaseRestHandler { - private static final Logger logger = LogManager.getLogger(RestClusterPutWeightedRoutingAction.class); - @Override public List routes() { return singletonList(new Route(PUT, "/_cluster/routing/awareness/{attribute}/weights")); diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/heuristic/MutualInformation.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/heuristic/MutualInformation.java index 86caa6d3b5059..d9a9471aca49e 100644 --- a/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/heuristic/MutualInformation.java +++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/terms/heuristic/MutualInformation.java @@ -120,7 +120,7 @@ public double getScore(long subsetFreq, long subsetSize, long supersetFreq, long + N01 / N * Math.log((N * N01) / (N0_ * N_1)) + N10 / N * Math.log((N * N10) / (N1_ * N_0)) + N00 / N * Math.log((N * N00) / (N0_ * N_0)); - + but we get many NaN if we do not take case of the 0s */ double getMITerm(double Nxy, double Nx_, double N_y, double N) { diff --git a/server/src/main/java/org/opensearch/search/query/ConcurrentQueryPhaseSearcher.java b/server/src/main/java/org/opensearch/search/query/ConcurrentQueryPhaseSearcher.java index 771ac60dfb5e5..58e0715718625 100644 --- a/server/src/main/java/org/opensearch/search/query/ConcurrentQueryPhaseSearcher.java +++ b/server/src/main/java/org/opensearch/search/query/ConcurrentQueryPhaseSearcher.java @@ -9,7 +9,6 @@ package org.opensearch.search.query; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.lucene.search.Collector; import org.apache.lucene.search.CollectorManager; import org.apache.lucene.search.Query; @@ -31,7 +30,6 @@ * search of Apache Lucene segments if it has been enabled. */ public class ConcurrentQueryPhaseSearcher extends DefaultQueryPhaseSearcher { - private static final Logger LOGGER = LogManager.getLogger(ConcurrentQueryPhaseSearcher.class); private final AggregationProcessor aggregationProcessor = new ConcurrentAggregationProcessor(); /** diff --git a/server/src/main/java/org/opensearch/search/query/QueryPhaseSearcherWrapper.java b/server/src/main/java/org/opensearch/search/query/QueryPhaseSearcherWrapper.java index 19a59e9f7bebe..76cfb18a6f459 100644 --- a/server/src/main/java/org/opensearch/search/query/QueryPhaseSearcherWrapper.java +++ b/server/src/main/java/org/opensearch/search/query/QueryPhaseSearcherWrapper.java @@ -9,7 +9,6 @@ package org.opensearch.search.query; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.apache.lucene.search.CollectorManager; import org.apache.lucene.search.Query; import org.opensearch.search.aggregations.AggregationProcessor; @@ -26,7 +25,6 @@ * @opensearch.internal */ public class QueryPhaseSearcherWrapper implements QueryPhaseSearcher { - private static final Logger LOGGER = LogManager.getLogger(QueryPhaseSearcherWrapper.class); private final QueryPhaseSearcher defaultQueryPhaseSearcher; private final QueryPhaseSearcher concurrentQueryPhaseSearcher; diff --git a/server/src/main/java/org/opensearch/search/startree/StarTreeQueryHelper.java b/server/src/main/java/org/opensearch/search/startree/StarTreeQueryHelper.java index 59ebd9afe1dc7..95953c602b29a 100644 --- a/server/src/main/java/org/opensearch/search/startree/StarTreeQueryHelper.java +++ b/server/src/main/java/org/opensearch/search/startree/StarTreeQueryHelper.java @@ -47,8 +47,6 @@ */ public class StarTreeQueryHelper { - private static StarTreeValues starTreeValues; - /** * Checks if the search context can be supported by star-tree */ diff --git a/server/src/main/java/org/opensearch/search/suggest/completion/context/GeoContextMapping.java b/server/src/main/java/org/opensearch/search/suggest/completion/context/GeoContextMapping.java index b00008b29fdfa..81ac096c0f34e 100644 --- a/server/src/main/java/org/opensearch/search/suggest/completion/context/GeoContextMapping.java +++ b/server/src/main/java/org/opensearch/search/suggest/completion/context/GeoContextMapping.java @@ -41,7 +41,6 @@ import org.opensearch.Version; import org.opensearch.common.geo.GeoPoint; import org.opensearch.common.geo.GeoUtils; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.unit.DistanceUnit; import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.core.xcontent.XContentParser; @@ -89,8 +88,6 @@ public class GeoContextMapping extends ContextMapping { static final String CONTEXT_PRECISION = "precision"; static final String CONTEXT_NEIGHBOURS = "neighbours"; - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(GeoContextMapping.class); - private final int precision; private final String fieldName; diff --git a/server/src/main/java/org/opensearch/snapshots/SnapshotShardsService.java b/server/src/main/java/org/opensearch/snapshots/SnapshotShardsService.java index 1e2264593310d..06a555790ddb0 100644 --- a/server/src/main/java/org/opensearch/snapshots/SnapshotShardsService.java +++ b/server/src/main/java/org/opensearch/snapshots/SnapshotShardsService.java @@ -322,17 +322,6 @@ public void onFailure(Exception e) { }); } - private boolean isRemoteSnapshot(ShardId shardId) { - final IndexService indexService = indicesService.indexService(shardId.getIndex()); - if (indexService != null) { - final IndexShard shard = indexService.getShardOrNull(shardId.id()); - if (shard != null) { - return shard.isRemoteSnapshot(); - } - } - return false; - } - // package private for testing static String summarizeFailure(Throwable t) { if (t.getCause() == null) { diff --git a/server/src/main/java/org/opensearch/threadpool/ThreadPool.java b/server/src/main/java/org/opensearch/threadpool/ThreadPool.java index b67b00bb42054..46b3abc500586 100644 --- a/server/src/main/java/org/opensearch/threadpool/ThreadPool.java +++ b/server/src/main/java/org/opensearch/threadpool/ThreadPool.java @@ -426,7 +426,7 @@ public void registerClusterSettingsListeners(ClusterSettings clusterSettings) { /* Scaling threadpool can provide only max and core Fixed/ResizableQueue can provide only size - + For example valid settings would be for scaling and fixed thead pool cluster.threadpool.snapshot.max : "5", cluster.threadpool.snapshot.core : "5", diff --git a/server/src/main/java/org/opensearch/transport/TransportLogger.java b/server/src/main/java/org/opensearch/transport/TransportLogger.java index 997b3bb5ba18e..ead31c49b2092 100644 --- a/server/src/main/java/org/opensearch/transport/TransportLogger.java +++ b/server/src/main/java/org/opensearch/transport/TransportLogger.java @@ -37,9 +37,7 @@ import org.opensearch.common.util.concurrent.ThreadContext; import org.opensearch.common.util.io.IOUtils; import org.opensearch.core.common.bytes.BytesReference; -import org.opensearch.core.common.io.stream.InputStreamStreamInput; import org.opensearch.core.common.io.stream.StreamInput; -import org.opensearch.core.compress.CompressorRegistry; import java.io.IOException; @@ -175,16 +173,4 @@ private static String format(TcpChannel channel, InboundMessage message, String } return sb.toString(); } - - private static StreamInput decompressingStream(byte status, StreamInput streamInput) throws IOException { - if (TransportStatus.isCompress(status) && streamInput.available() > 0) { - try { - return new InputStreamStreamInput(CompressorRegistry.defaultCompressor().threadLocalInputStream(streamInput)); - } catch (IllegalArgumentException e) { - throw new IllegalStateException("stream marked as compressed, but is missing deflate header"); - } - } else { - return streamInput; - } - } } diff --git a/server/src/main/java/org/opensearch/transport/TransportService.java b/server/src/main/java/org/opensearch/transport/TransportService.java index fe8631aa5ca3d..e16cb50fcaed8 100644 --- a/server/src/main/java/org/opensearch/transport/TransportService.java +++ b/server/src/main/java/org/opensearch/transport/TransportService.java @@ -578,7 +578,6 @@ public ConnectionManager.ConnectionValidator extensionConnectionValidator(Discov return (newConnection, actualProfile, listener) -> { // We don't validate cluster names to allow for CCS connections. handshake(newConnection, actualProfile.getHandshakeTimeout().millis(), cn -> true, ActionListener.map(listener, resp -> { - final DiscoveryNode remote = resp.discoveryNode; logger.info("Connection validation was skipped"); return null; })); diff --git a/server/src/test/java/org/opensearch/action/admin/indices/create/TransportCreateIndexActionTests.java b/server/src/test/java/org/opensearch/action/admin/indices/create/TransportCreateIndexActionTests.java index 5b5c8e5954157..708245f952105 100644 --- a/server/src/test/java/org/opensearch/action/admin/indices/create/TransportCreateIndexActionTests.java +++ b/server/src/test/java/org/opensearch/action/admin/indices/create/TransportCreateIndexActionTests.java @@ -83,11 +83,7 @@ public void testClusterManagerOperation_usesTransformedMapping() { // Capture ActionListener passed to applyTransformers final ArgumentCaptor> listenerCaptor = ArgumentCaptor.forClass(ActionListener.class); - doNothing().when(mappingTransformerRegistry).applyTransformers( - anyString(), - any(), - listenerCaptor.capture() - ); + doNothing().when(mappingTransformerRegistry).applyTransformers(anyString(), any(), listenerCaptor.capture()); // Act: Call the method action.clusterManagerOperation(request, clusterState, responseListener); @@ -96,8 +92,9 @@ public void testClusterManagerOperation_usesTransformedMapping() { listenerCaptor.getValue().onResponse(transformedMapping); // Assert: Capture request sent to createIndexService - ArgumentCaptor updateRequestCaptor = - ArgumentCaptor.forClass(CreateIndexClusterStateUpdateRequest.class); + ArgumentCaptor updateRequestCaptor = ArgumentCaptor.forClass( + CreateIndexClusterStateUpdateRequest.class + ); verify(createIndexService, times(1)).createIndex(updateRequestCaptor.capture(), any()); // Ensure transformed mapping is passed correctly diff --git a/server/src/test/java/org/opensearch/action/admin/indices/mapping/get/GetMappingsActionTests.java b/server/src/test/java/org/opensearch/action/admin/indices/mapping/get/GetMappingsActionTests.java index 87f218760038e..3890f6f823f37 100644 --- a/server/src/test/java/org/opensearch/action/admin/indices/mapping/get/GetMappingsActionTests.java +++ b/server/src/test/java/org/opensearch/action/admin/indices/mapping/get/GetMappingsActionTests.java @@ -79,7 +79,6 @@ public class GetMappingsActionTests extends OpenSearchTestCase { private ClusterService clusterService; private ThreadPool threadPool; private SettingsFilter settingsFilter; - private final String indexName = "test_index"; CapturingTransport capturingTransport = new CapturingTransport(); private DiscoveryNode localNode; private DiscoveryNode remoteNode; diff --git a/server/src/test/java/org/opensearch/action/bulk/BackoffPolicyTests.java b/server/src/test/java/org/opensearch/action/bulk/BackoffPolicyTests.java index 2f9ae9a154f46..611210ae33a55 100644 --- a/server/src/test/java/org/opensearch/action/bulk/BackoffPolicyTests.java +++ b/server/src/test/java/org/opensearch/action/bulk/BackoffPolicyTests.java @@ -101,7 +101,6 @@ public void testEqualJitterExponentialBackOffPolicy() { public void testExponentialBackOffPolicy() { long baseDelay = 10; - int maxDelay = 10000; long currentDelay = baseDelay; BackoffPolicy policy = BackoffPolicy.exponentialFullJitterBackoff(baseDelay); Iterator iterator = policy.iterator(); diff --git a/server/src/test/java/org/opensearch/action/explain/ExplainResponseTests.java b/server/src/test/java/org/opensearch/action/explain/ExplainResponseTests.java index f8d10128a82ad..620cf2ca6ccff 100644 --- a/server/src/test/java/org/opensearch/action/explain/ExplainResponseTests.java +++ b/server/src/test/java/org/opensearch/action/explain/ExplainResponseTests.java @@ -96,7 +96,6 @@ protected Predicate getRandomFieldsExcludeFilter() { public void testToXContent() throws IOException { String index = "index"; - String type = "type"; String id = "1"; boolean exist = true; Explanation explanation = Explanation.match(1.0f, "description", Collections.emptySet()); diff --git a/server/src/test/java/org/opensearch/action/search/TransportSearchActionTests.java b/server/src/test/java/org/opensearch/action/search/TransportSearchActionTests.java index 0a0015ae8cbf6..2ce9de61fef0d 100644 --- a/server/src/test/java/org/opensearch/action/search/TransportSearchActionTests.java +++ b/server/src/test/java/org/opensearch/action/search/TransportSearchActionTests.java @@ -459,7 +459,6 @@ public void testCCSRemoteReduceMergeFails() throws Exception { boolean local = randomBoolean(); OriginalIndices localIndices = local ? new OriginalIndices(new String[] { "index" }, SearchRequest.DEFAULT_INDICES_OPTIONS) : null; TransportSearchAction.SearchTimeProvider timeProvider = new TransportSearchAction.SearchTimeProvider(0, 0, () -> 0); - Function reduceContext = finalReduce -> null; try ( MockTransportService service = MockTransportService.createNewService(settings, Version.CURRENT, threadPool, NoopTracer.INSTANCE) ) { diff --git a/server/src/test/java/org/opensearch/cluster/metadata/MetadataCreateIndexServiceTests.java b/server/src/test/java/org/opensearch/cluster/metadata/MetadataCreateIndexServiceTests.java index 03237ba81f05e..e9cf7351ec0ac 100644 --- a/server/src/test/java/org/opensearch/cluster/metadata/MetadataCreateIndexServiceTests.java +++ b/server/src/test/java/org/opensearch/cluster/metadata/MetadataCreateIndexServiceTests.java @@ -198,8 +198,6 @@ public class MetadataCreateIndexServiceTests extends OpenSearchTestCase { private IndicesService indicesServices; private RepositoriesService repositoriesService; private Supplier repositoriesServiceSupplier; - private static final String segmentRepositoryNameAttributeKey = NODE_ATTRIBUTES.getKey() - + REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY; private static final String translogRepositoryNameAttributeKey = NODE_ATTRIBUTES.getKey() + REMOTE_STORE_TRANSLOG_REPOSITORY_NAME_ATTRIBUTE_KEY; diff --git a/server/src/test/java/org/opensearch/cluster/metadata/ToAndFromJsonMetadataTests.java b/server/src/test/java/org/opensearch/cluster/metadata/ToAndFromJsonMetadataTests.java index 6d8439b7b249c..61c4eb3ec8bba 100644 --- a/server/src/test/java/org/opensearch/cluster/metadata/ToAndFromJsonMetadataTests.java +++ b/server/src/test/java/org/opensearch/cluster/metadata/ToAndFromJsonMetadataTests.java @@ -206,7 +206,6 @@ public void testSimpleJsonFromAndTo() throws IOException { } private static final String MAPPING_SOURCE1 = "{\"mapping1\":{\"text1\":{\"type\":\"string\"}}}"; - private static final String MAPPING_SOURCE2 = "{\"mapping2\":{\"text2\":{\"type\":\"string\"}}}"; private static final String ALIAS_FILTER1 = "{\"field1\":\"value1\"}"; private static final String ALIAS_FILTER2 = "{\"field2\":\"value2\"}"; diff --git a/server/src/test/java/org/opensearch/cluster/node/DiscoveryNodesTests.java b/server/src/test/java/org/opensearch/cluster/node/DiscoveryNodesTests.java index ceb0c6f1c675b..919c909578076 100644 --- a/server/src/test/java/org/opensearch/cluster/node/DiscoveryNodesTests.java +++ b/server/src/test/java/org/opensearch/cluster/node/DiscoveryNodesTests.java @@ -521,18 +521,4 @@ public void testMaxMinNodeVersion() { assertEquals(Version.fromString("1.1.0"), build.getMaxNodeVersion()); assertEquals(Version.fromString("5.1.0"), build.getMinNodeVersion()); } - - private DiscoveryNode buildDiscoveryNodeFromExisting(DiscoveryNode existing, Version newVersion) { - return new DiscoveryNode( - existing.getName(), - existing.getId(), - existing.getEphemeralId(), - existing.getHostName(), - existing.getHostAddress(), - existing.getAddress(), - existing.getAttributes(), - existing.getRoles(), - newVersion - ); - } } diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/BalanceConfigurationTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/BalanceConfigurationTests.java index 11cbe89645657..77b924550821f 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/BalanceConfigurationTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/BalanceConfigurationTests.java @@ -619,29 +619,6 @@ private void verifyPerIndexPrimaryBalance(ClusterState currentState) { } } - private void verifySkewedPrimaryBalance(ClusterState clusterState, int delta) throws Exception { - assertBusy(() -> { - RoutingNodes nodes = clusterState.getRoutingNodes(); - int totalPrimaryShards = 0; - for (final IndexRoutingTable index : clusterState.getRoutingTable().indicesRouting().values()) { - totalPrimaryShards += index.primaryShardsActive(); - } - final int avgPrimaryShardsPerNode = (int) Math.ceil(totalPrimaryShards * 1f / clusterState.getRoutingNodes().size()); - int maxPrimaryShardOnNode = Integer.MIN_VALUE; - int minPrimaryShardOnNode = Integer.MAX_VALUE; - for (RoutingNode node : nodes) { - final int primaryCount = node.shardsWithState(STARTED) - .stream() - .filter(ShardRouting::primary) - .collect(Collectors.toList()) - .size(); - maxPrimaryShardOnNode = Math.max(maxPrimaryShardOnNode, primaryCount); - minPrimaryShardOnNode = Math.min(minPrimaryShardOnNode, primaryCount); - } - assertTrue(maxPrimaryShardOnNode - minPrimaryShardOnNode < delta); - }, 60, TimeUnit.SECONDS); - } - private void verifyPrimaryBalance(ClusterState clusterState, float buffer) throws Exception { assertBusy(() -> { RoutingNodes nodes = clusterState.getRoutingNodes(); diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteShardsBalancerBaseTestCase.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteShardsBalancerBaseTestCase.java index cfdaaab4e117d..2b07d711e2e9b 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteShardsBalancerBaseTestCase.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteShardsBalancerBaseTestCase.java @@ -194,14 +194,6 @@ protected ClusterState createRemoteIndex(ClusterState state, String indexName) { return ClusterState.builder(state).metadata(metadata).routingTable(routingTable).build(); } - private AllocationDeciders remoteAllocationDeciders(Settings settings, ClusterSettings clusterSettings) { - List deciders = new ArrayList<>( - ClusterModule.createAllocationDeciders(settings, clusterSettings, Collections.emptyList()) - ); - Collections.shuffle(deciders, random()); - return new AllocationDeciders(deciders); - } - public AllocationService createRemoteCapableAllocationService() { Settings settings = Settings.Builder.EMPTY_SETTINGS; return new OpenSearchAllocationTestCase.MockAllocationService( diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteShardsRebalanceShardsTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteShardsRebalanceShardsTests.java index e55a9de160114..824d15030f052 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteShardsRebalanceShardsTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteShardsRebalanceShardsTests.java @@ -95,16 +95,4 @@ private int getTotalShardCountAcrossNodes(final Map nodePrimari } return totalShardCount; } - - /** - * Asserts that the expected value is within the variance range. - *

- * Being used to assert the average number of shards per node. - * Variance is required in case of non-absolute mean values; - * for example, total number of remote capable nodes in a cluster. - */ - private void assertInRange(int actual, int expectedMean, int variance) { - assertTrue(actual >= expectedMean - variance); - assertTrue(actual <= expectedMean + variance); - } } diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteStoreMigrationAllocationDeciderTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteStoreMigrationAllocationDeciderTests.java index e6e81c94e7f32..131beda510beb 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteStoreMigrationAllocationDeciderTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/RemoteStoreMigrationAllocationDeciderTests.java @@ -583,10 +583,6 @@ private Settings getCustomSettings(String direction, String compatibilityMode, I return builder.build(); } - private String getRandomCompatibilityMode() { - return randomFrom(RemoteStoreNodeService.CompatibilityMode.STRICT.mode, RemoteStoreNodeService.CompatibilityMode.MIXED.mode); - } - private ClusterSettings getClusterSettings(Settings settings) { return new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); } diff --git a/server/src/test/java/org/opensearch/cluster/routing/remote/RemoteRoutingTableServiceTests.java b/server/src/test/java/org/opensearch/cluster/routing/remote/RemoteRoutingTableServiceTests.java index 63501f878d55d..023d9b983afc4 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/remote/RemoteRoutingTableServiceTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/remote/RemoteRoutingTableServiceTests.java @@ -35,7 +35,6 @@ import org.opensearch.core.index.Index; import org.opensearch.gateway.remote.ClusterMetadataManifest; import org.opensearch.gateway.remote.RemoteClusterStateUtils; -import org.opensearch.index.remote.RemoteStoreEnums; import org.opensearch.index.remote.RemoteStorePathStrategy; import org.opensearch.index.remote.RemoteStoreUtils; import org.opensearch.index.translog.transfer.BlobStoreTransferService; @@ -776,14 +775,6 @@ private ClusterState createClusterState(String indexName) { .build(); } - private BlobPath getPath() { - BlobPath indexRoutingPath = basePath.add(INDEX_ROUTING_TABLE); - return RemoteStoreEnums.PathType.HASHED_PREFIX.path( - RemoteStorePathStrategy.PathInput.builder().basePath(indexRoutingPath).indexUUID("uuid").build(), - RemoteStoreEnums.PathHashAlgorithm.FNV_1A_BASE64 - ); - } - public void testDeleteStaleIndexRoutingPaths() throws IOException { doNothing().when(blobContainer).deleteBlobsIgnoringIfNotExists(any()); when(blobStore.blobContainer(any())).thenReturn(blobContainer); @@ -800,9 +791,7 @@ public void testDeleteStaleIndexRoutingPathsThrowsIOException() throws IOExcepti doThrow(new IOException("test exception")).when(blobContainer).deleteBlobsIgnoringIfNotExists(Mockito.anyList()); remoteRoutingTableService.doStart(); - IOException thrown = assertThrows(IOException.class, () -> { - remoteRoutingTableService.deleteStaleIndexRoutingPaths(stalePaths); - }); + IOException thrown = assertThrows(IOException.class, () -> { remoteRoutingTableService.deleteStaleIndexRoutingPaths(stalePaths); }); assertEquals("test exception", thrown.getMessage()); verify(blobContainer).deleteBlobsIgnoringIfNotExists(stalePaths); } @@ -823,9 +812,10 @@ public void testDeleteStaleIndexRoutingDiffPathsThrowsIOException() throws IOExc doThrow(new IOException("test exception")).when(blobContainer).deleteBlobsIgnoringIfNotExists(Mockito.anyList()); remoteRoutingTableService.doStart(); - IOException thrown = assertThrows(IOException.class, () -> { - remoteRoutingTableService.deleteStaleIndexRoutingDiffPaths(stalePaths); - }); + IOException thrown = assertThrows( + IOException.class, + () -> { remoteRoutingTableService.deleteStaleIndexRoutingDiffPaths(stalePaths); } + ); assertEquals("test exception", thrown.getMessage()); verify(blobContainer).deleteBlobsIgnoringIfNotExists(stalePaths); } diff --git a/server/src/test/java/org/opensearch/common/logging/HeaderWarningTests.java b/server/src/test/java/org/opensearch/common/logging/HeaderWarningTests.java index f2f3b1be2d9a3..b89a31a046472 100644 --- a/server/src/test/java/org/opensearch/common/logging/HeaderWarningTests.java +++ b/server/src/test/java/org/opensearch/common/logging/HeaderWarningTests.java @@ -62,8 +62,6 @@ public class HeaderWarningTests extends OpenSearchTestCase { private static final RegexMatcher warningValueMatcher = matches(WARNING_HEADER_PATTERN.pattern()); - private final HeaderWarning logger = new HeaderWarning(); - @Override protected boolean enableWarningsCheck() { // this is a low level test for the deprecation logger, setup and checks are done manually diff --git a/server/src/test/java/org/opensearch/common/xcontent/BaseXContentTestCase.java b/server/src/test/java/org/opensearch/common/xcontent/BaseXContentTestCase.java index 930c3415168a7..bf1aa8d360b2f 100644 --- a/server/src/test/java/org/opensearch/common/xcontent/BaseXContentTestCase.java +++ b/server/src/test/java/org/opensearch/common/xcontent/BaseXContentTestCase.java @@ -83,7 +83,6 @@ import java.time.Year; import java.time.ZoneOffset; import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; @@ -610,8 +609,6 @@ public void testObjects() throws Exception { final String paths = Constants.WINDOWS ? "{'objects':['a\\\\b\\\\c','d\\\\e']}" : "{'objects':['a/b/c','d/e']}"; objects.put(paths, new Object[] { PathUtils.get("a", "b", "c"), PathUtils.get("d", "e") }); - - final DateTimeFormatter formatter = DateTimeFormatter.ISO_INSTANT; final Date d1 = Date.from(ZonedDateTime.of(2016, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC).toInstant()); final Date d2 = Date.from(ZonedDateTime.of(2015, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC).toInstant()); objects.put("{'objects':['2016-01-01T00:00:00.000Z','2015-01-01T00:00:00.000Z']}", new Object[] { d1, d2 }); diff --git a/server/src/test/java/org/opensearch/gateway/GatewayAllocatorTests.java b/server/src/test/java/org/opensearch/gateway/GatewayAllocatorTests.java index 7a3b5f576449c..514a989267e60 100644 --- a/server/src/test/java/org/opensearch/gateway/GatewayAllocatorTests.java +++ b/server/src/test/java/org/opensearch/gateway/GatewayAllocatorTests.java @@ -9,7 +9,6 @@ package org.opensearch.gateway; import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.opensearch.Version; import org.opensearch.action.support.nodes.BaseNodeResponse; import org.opensearch.cluster.ClusterInfo; @@ -62,8 +61,6 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo; public class GatewayAllocatorTests extends OpenSearchAllocationTestCase { - - private final Logger logger = LogManager.getLogger(GatewayAllocatorTests.class); TestShardBatchGatewayAllocator testShardsBatchGatewayAllocator = null; ClusterState clusterState = null; RoutingAllocation testAllocation = null; diff --git a/server/src/test/java/org/opensearch/gateway/PrimaryShardBatchAllocatorTests.java b/server/src/test/java/org/opensearch/gateway/PrimaryShardBatchAllocatorTests.java index 2edde8281b11a..9b91e51fab2f5 100644 --- a/server/src/test/java/org/opensearch/gateway/PrimaryShardBatchAllocatorTests.java +++ b/server/src/test/java/org/opensearch/gateway/PrimaryShardBatchAllocatorTests.java @@ -75,13 +75,6 @@ public void buildTestAllocator() { this.batchAllocator = new TestBatchAllocator(); } - private void allocateAllUnassigned(final RoutingAllocation allocation) { - final RoutingNodes.UnassignedShards.UnassignedIterator iterator = allocation.routingNodes().unassigned().iterator(); - while (iterator.hasNext()) { - batchAllocator.allocateUnassigned(iterator.next(), allocation, iterator); - } - } - private void allocateAllUnassignedBatch(final RoutingAllocation allocation) { final RoutingNodes.UnassignedShards.UnassignedIterator iterator = allocation.routingNodes().unassigned().iterator(); List shardsToBatch = new ArrayList<>(); diff --git a/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java b/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java index d9de899bed529..930cb32ba668d 100644 --- a/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java +++ b/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java @@ -3919,30 +3919,6 @@ private void mockObjectsForGettingPreviousClusterUUID( when(blobStoreRepository.getCompressor()).thenReturn(compressor); } - private ClusterMetadataManifest generateV1ClusterMetadataManifest( - String clusterUUID, - String previousClusterUUID, - String stateUUID, - List uploadedIndexMetadata, - String globalMetadataFileName, - Boolean isUUIDCommitted - ) { - return ClusterMetadataManifest.builder() - .indices(uploadedIndexMetadata) - .clusterTerm(1L) - .stateVersion(1L) - .stateUUID(stateUUID) - .clusterUUID(clusterUUID) - .nodeId("nodeA") - .opensearchVersion(VersionUtils.randomOpenSearchVersion(random())) - .previousClusterUUID(previousClusterUUID) - .committed(true) - .clusterUUIDCommitted(isUUIDCommitted) - .globalMetadataFileName(globalMetadataFileName) - .codecVersion(CODEC_V1) - .build(); - } - private ClusterMetadataManifest generateClusterMetadataManifest( String clusterUUID, String previousClusterUUID, diff --git a/server/src/test/java/org/opensearch/gateway/remote/model/RemoteClusterStateCustomsTests.java b/server/src/test/java/org/opensearch/gateway/remote/model/RemoteClusterStateCustomsTests.java index 1b020e13324a4..d3a699f3e21c6 100644 --- a/server/src/test/java/org/opensearch/gateway/remote/model/RemoteClusterStateCustomsTests.java +++ b/server/src/test/java/org/opensearch/gateway/remote/model/RemoteClusterStateCustomsTests.java @@ -53,7 +53,6 @@ public class RemoteClusterStateCustomsTests extends OpenSearchTestCase { private static final String TEST_BLOB_NAME = "/test-path/test-blob-name"; private static final String TEST_BLOB_PATH = "test-path"; private static final String TEST_BLOB_FILE_NAME = "test-blob-name"; - private static final String CUSTOM_TYPE = "test-custom"; private static final long STATE_VERSION = 3L; private String clusterUUID; private BlobStoreTransferService blobStoreTransferService; diff --git a/server/src/test/java/org/opensearch/gateway/remote/routingtable/RemoteIndexRoutingTableTests.java b/server/src/test/java/org/opensearch/gateway/remote/routingtable/RemoteIndexRoutingTableTests.java index 29d4ffa978851..bf6d5026f57bf 100644 --- a/server/src/test/java/org/opensearch/gateway/remote/routingtable/RemoteIndexRoutingTableTests.java +++ b/server/src/test/java/org/opensearch/gateway/remote/routingtable/RemoteIndexRoutingTableTests.java @@ -50,7 +50,6 @@ public class RemoteIndexRoutingTableTests extends OpenSearchTestCase { private static final String TEST_BLOB_NAME = "/test-path/test-blob-name"; private static final String TEST_BLOB_PATH = "test-path"; private static final String TEST_BLOB_FILE_NAME = "test-blob-name"; - private static final String INDEX_ROUTING_TABLE_TYPE = "test-index-routing-table"; private static final long STATE_VERSION = 3L; private static final long STATE_TERM = 2L; private String clusterUUID; diff --git a/server/src/test/java/org/opensearch/index/autoforcemerge/AutoForceMergeManagerTests.java b/server/src/test/java/org/opensearch/index/autoforcemerge/AutoForceMergeManagerTests.java index 8f33c3534423a..d8044846d73cf 100644 --- a/server/src/test/java/org/opensearch/index/autoforcemerge/AutoForceMergeManagerTests.java +++ b/server/src/test/java/org/opensearch/index/autoforcemerge/AutoForceMergeManagerTests.java @@ -179,13 +179,14 @@ public void testNodeValidatorWithHealthyResources() { when(cpu.getPercent()).thenReturn((short) 50); when(jvm.getHeapUsedPercent()).thenReturn((short) 60); ThreadPoolStats stats = new ThreadPoolStats( - Arrays.asList(new ThreadPoolStats.Stats( - ThreadPool.Names.FORCE_MERGE, 1, 0, 0, 0, 1, 0, 0 - )) + Arrays.asList(new ThreadPoolStats.Stats(ThreadPool.Names.FORCE_MERGE, 1, 0, 0, 0, 1, 0, 0)) ); when(threadPool.stats()).thenReturn(stats); - AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode(getConfiguredClusterSettings(true, true, Collections.emptyMap()), getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE))); + AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode( + getConfiguredClusterSettings(true, true, Collections.emptyMap()), + getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE)) + ); autoForceMergeManager.start(); assertTrue(autoForceMergeManager.getNodeValidator().validate().isAllowed()); autoForceMergeManager.close(); @@ -195,13 +196,14 @@ public void testNodeValidatorWithFeatureSwitch() { when(cpu.getPercent()).thenReturn((short) 50); when(jvm.getHeapUsedPercent()).thenReturn((short) 60); ThreadPoolStats stats = new ThreadPoolStats( - Arrays.asList(new ThreadPoolStats.Stats( - ThreadPool.Names.FORCE_MERGE, 1, 0, 0, 0, 1, 0, 0 - )) + Arrays.asList(new ThreadPoolStats.Stats(ThreadPool.Names.FORCE_MERGE, 1, 0, 0, 0, 1, 0, 0)) ); when(threadPool.stats()).thenReturn(stats); Settings settings = getConfiguredClusterSettings(false, false, Collections.emptyMap()); - AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode(settings, getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE))); + AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode( + settings, + getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE)) + ); autoForceMergeManager.start(); assertFalse(autoForceMergeManager.getConfigurationValidator().validate().isAllowed()); assertNotEquals(Lifecycle.State.STARTED, ResourceTrackerProvider.resourceTrackers.cpuFiveMinute.lifecycleState()); @@ -249,7 +251,10 @@ public void testNodeValidatorWithHighCPU() { public void testNodeValidatorWithHighDiskUsage() { when(cpu.getPercent()).thenReturn((short) 50); when(disk.getAvailable()).thenReturn(new ByteSizeValue(5)); - AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode(getConfiguredClusterSettings(true, true, Collections.emptyMap()), getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE))); + AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode( + getConfiguredClusterSettings(true, true, Collections.emptyMap()), + getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE)) + ); autoForceMergeManager.start(); assertFalse(autoForceMergeManager.getNodeValidator().validate().isAllowed()); autoForceMergeManager.close(); @@ -257,14 +262,17 @@ public void testNodeValidatorWithHighDiskUsage() { public void testNodeValidatorWithHighJVMUsage() { when(cpu.getPercent()).thenReturn((short) 50); - AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode(getConfiguredClusterSettings(true, true, Collections.emptyMap()), getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE))); + AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode( + getConfiguredClusterSettings(true, true, Collections.emptyMap()), + getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE)) + ); autoForceMergeManager.start(); when(jvm.getHeapUsedPercent()).thenReturn((short) 90); assertFalse(autoForceMergeManager.getNodeValidator().validate().isAllowed()); - for(int i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) ResourceTrackerProvider.resourceTrackers.jvmOneMinute.recordUsage(90); assertFalse(autoForceMergeManager.getNodeValidator().validate().isAllowed()); - for(int i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) ResourceTrackerProvider.resourceTrackers.jvmFiveMinute.recordUsage(90); assertFalse(autoForceMergeManager.getNodeValidator().validate().isAllowed()); autoForceMergeManager.close(); @@ -274,12 +282,13 @@ public void testNodeValidatorWithInsufficientForceMergeThreads() { when(cpu.getPercent()).thenReturn((short) 50); when(jvm.getHeapUsedPercent()).thenReturn((short) 50); ThreadPoolStats stats = new ThreadPoolStats( - Arrays.asList(new ThreadPoolStats.Stats( - ThreadPool.Names.FORCE_MERGE, 1, 1, 1, 0, 1, 0, -1 - )) + Arrays.asList(new ThreadPoolStats.Stats(ThreadPool.Names.FORCE_MERGE, 1, 1, 1, 0, 1, 0, -1)) ); when(threadPool.stats()).thenReturn(stats); - AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode(getConfiguredClusterSettings(true, true, Collections.emptyMap()), getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE))); + AutoForceMergeManager autoForceMergeManager = clusterSetupWithNode( + getConfiguredClusterSettings(true, true, Collections.emptyMap()), + getNodeWithRoles(DATA_NODE_1, Set.of(DiscoveryNodeRole.DATA_ROLE)) + ); autoForceMergeManager.start(); assertFalse(autoForceMergeManager.getNodeValidator().validate().isAllowed()); ThreadPoolStats emptyStats = new ThreadPoolStats(Collections.emptyList()); @@ -553,12 +562,7 @@ private AutoForceMergeManager clusterSetupWithNode(Settings settings, DiscoveryN when(clusterService.getSettings()).thenReturn(settings); when(clusterService.localNode()).thenReturn(node); - return new AutoForceMergeManager( - threadPool, - monitorService, - indicesService, - clusterService - ); + return new AutoForceMergeManager(threadPool, monitorService, indicesService, clusterService); } private IndexShard getShard(String indexName, TranslogStats translogStats, Integer segmentCount) { diff --git a/server/src/test/java/org/opensearch/index/codec/composite912/datacube/startree/StarTreeKeywordDocValuesFormatTests.java b/server/src/test/java/org/opensearch/index/codec/composite912/datacube/startree/StarTreeKeywordDocValuesFormatTests.java index 5603fe4e30f9f..9a96377b24466 100644 --- a/server/src/test/java/org/opensearch/index/codec/composite912/datacube/startree/StarTreeKeywordDocValuesFormatTests.java +++ b/server/src/test/java/org/opensearch/index/codec/composite912/datacube/startree/StarTreeKeywordDocValuesFormatTests.java @@ -451,7 +451,7 @@ public void testStarKeywordDocValuesWithMissingDocsInAllSegments() throws IOExce /** * keyword1 keyword2 | [ sum, value_count, min, max[sndv]] , doc_count [null, null] | [6.0, 4.0, 1.0, 2.0, 4.0] - + */ StarTreeDocument[] expectedStarTreeDocuments = new StarTreeDocument[1]; expectedStarTreeDocuments[0] = new StarTreeDocument(new Long[] { null, null }, new Double[] { 6.0, 4.0, 1.0, 2.0, 4.0 }); diff --git a/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/StarTreeBuilderMergeFlowTests.java b/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/StarTreeBuilderMergeFlowTests.java index d6def0b075128..8ee3b4e35d048 100644 --- a/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/StarTreeBuilderMergeFlowTests.java +++ b/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/StarTreeBuilderMergeFlowTests.java @@ -2270,7 +2270,6 @@ private StarTreeValues getStarTreeValuesWithKeywords( ) { SortedSetDocValues d1sndv = dimList; SortedSetDocValues d2sndv = dimList2; - SortedNumericDocValues m1sndv = metricsList; Map> dimDocIdSetIterators = Map.of( "field1", () -> new SortedSetStarTreeValuesIterator(d1sndv), @@ -2306,47 +2305,6 @@ private StarTreeValues getStarTreeValuesWithKeywords( return starTreeValues; } - private StarTreeValues getStarTreeValuesWithKeywords( - SortedSetDocValues dimList, - SortedSetDocValues dimList2, - SortedSetDocValues dimList4, - SortedSetDocValues dimList3, - SortedNumericDocValues metricsList, - SortedNumericDocValues metricsList1, - StarTreeField sf, - String number - ) { - Map> dimDocIdSetIterators = Map.of( - "field1_minute", - () -> new SortedSetStarTreeValuesIterator(dimList), - "field1_half-hour", - () -> new SortedSetStarTreeValuesIterator(dimList4), - "field1_hour", - () -> new SortedSetStarTreeValuesIterator(dimList2), - "field3", - () -> new SortedSetStarTreeValuesIterator(dimList3) - ); - Map> metricDocIdSetIterators = new LinkedHashMap<>(); - - metricDocIdSetIterators.put( - fullyQualifiedFieldNameForStarTreeMetricsDocValues( - sf.getName(), - "field2", - sf.getMetrics().get(0).getMetrics().get(0).getTypeName() - ), - () -> new SortedNumericStarTreeValuesIterator(metricsList) - ); - metricDocIdSetIterators.put( - fullyQualifiedFieldNameForStarTreeMetricsDocValues( - sf.getName(), - "field2", - sf.getMetrics().get(0).getMetrics().get(1).getTypeName() - ), - () -> new SortedNumericStarTreeValuesIterator(metricsList1) - ); - return new StarTreeValues(sf, null, dimDocIdSetIterators, metricDocIdSetIterators, Map.of(SEGMENT_DOCS_COUNT, number), null); - } - private StarTreeValues getStarTreeValues( List dimList1, List docsWithField1, diff --git a/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/StarTreesBuilderTests.java b/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/StarTreesBuilderTests.java index 6c75e89959348..43578c54d4709 100644 --- a/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/StarTreesBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/compositeindex/datacube/startree/builder/StarTreesBuilderTests.java @@ -104,16 +104,32 @@ public void test_buildWithNoStarTreeFields() throws IOException { public void test_getStarTreeBuilder() throws IOException { when(mapperService.getCompositeFieldTypes()).thenReturn(Set.of(starTreeFieldType)); StarTreesBuilder starTreesBuilder = new StarTreesBuilder(segmentWriteState, mapperService, new AtomicInteger()); - StarTreeBuilder starTreeBuilder = starTreesBuilder.getStarTreeBuilder(metaOut, dataOut, starTreeField, segmentWriteState, mapperService); + StarTreeBuilder starTreeBuilder = starTreesBuilder.getStarTreeBuilder( + metaOut, + dataOut, + starTreeField, + segmentWriteState, + mapperService + ); assertTrue(starTreeBuilder instanceof OnHeapStarTreeBuilder); } public void test_getStarTreeBuilder_illegalArgument() throws IOException { when(mapperService.getCompositeFieldTypes()).thenReturn(Set.of(starTreeFieldType)); - StarTreeFieldConfiguration starTreeFieldConfiguration = new StarTreeFieldConfiguration(1, new HashSet<>(), StarTreeFieldConfiguration.StarTreeBuildMode.OFF_HEAP); + StarTreeFieldConfiguration starTreeFieldConfiguration = new StarTreeFieldConfiguration( + 1, + new HashSet<>(), + StarTreeFieldConfiguration.StarTreeBuildMode.OFF_HEAP + ); StarTreeField starTreeField = new StarTreeField("star_tree", new ArrayList<>(), new ArrayList<>(), starTreeFieldConfiguration); StarTreesBuilder starTreesBuilder = new StarTreesBuilder(segmentWriteState, mapperService, new AtomicInteger()); - StarTreeBuilder starTreeBuilder = starTreesBuilder.getStarTreeBuilder(metaOut, dataOut, starTreeField, segmentWriteState, mapperService); + StarTreeBuilder starTreeBuilder = starTreesBuilder.getStarTreeBuilder( + metaOut, + dataOut, + starTreeField, + segmentWriteState, + mapperService + ); assertTrue(starTreeBuilder instanceof OffHeapStarTreeBuilder); starTreeBuilder.close(); } diff --git a/server/src/test/java/org/opensearch/index/engine/InternalEngineTests.java b/server/src/test/java/org/opensearch/index/engine/InternalEngineTests.java index fa501b155e96b..702c39900b879 100644 --- a/server/src/test/java/org/opensearch/index/engine/InternalEngineTests.java +++ b/server/src/test/java/org/opensearch/index/engine/InternalEngineTests.java @@ -662,7 +662,6 @@ public void testMergeSegmentsOnCommit() throws Exception { assertThat(segments.get(0).getDeletedDocs(), equalTo(0)); assertFalse(segments.get(0).committed); int deletes = 0; - int updates = 0; int appends = 0; int iterations = scaledRandomIntBetween(1, 50); for (int i = 0; i < iterations && liveDocsFirstSegment.isEmpty() == false; i++) { @@ -674,7 +673,6 @@ public void testMergeSegmentsOnCommit() throws Exception { deletes++; } else { engine.index(indexForDoc(doc)); - updates++; } if (randomBoolean()) { engine.index(indexForDoc(testParsedDocument(UUIDs.randomBase64UUID(), null, testDocument(), B_1, null))); @@ -1100,8 +1098,6 @@ public void testUpdateOperationForAppendOnlyIndex() throws Exception { Engine.Searcher searchResult = engine.acquireSearcher("test"); searchResult.close(); - final BiFunction searcherFactory = engine::acquireSearcher; - // create a document Document document = testDocumentWithTextField(); document.add(new Field(SourceFieldMapper.NAME, BytesReference.toBytes(B_1), SourceFieldMapper.Defaults.FIELD_TYPE)); @@ -6790,7 +6786,6 @@ public void testTrimUnsafeCommits() throws Exception { try (Store store = createStore()) { EngineConfig config = config(defaultSettings, store, createTempDir(), newMergePolicy(), null, null, globalCheckpoint::get); final List commitMaxSeqNo = new ArrayList<>(); - final long minTranslogGen; try (InternalEngine engine = createEngine(config)) { for (int i = 0; i < seqNos.size(); i++) { ParsedDocument doc = testParsedDocument(Long.toString(seqNos.get(i)), null, testDocument(), new BytesArray("{}"), null); @@ -6818,7 +6813,6 @@ public void testTrimUnsafeCommits() throws Exception { globalCheckpoint.set(randomInt(maxSeqNo)); engine.translogManager().syncTranslog(); engine.ensureOpen(); - minTranslogGen = assertAndGetInternalTranslogManager(engine.translogManager()).getTranslog().getMinFileGeneration(); } store.trimUnsafeCommits(config.getTranslogConfig().getTranslogPath()); diff --git a/server/src/test/java/org/opensearch/index/mapper/ExternalMapper.java b/server/src/test/java/org/opensearch/index/mapper/ExternalMapper.java index 49b38f828f837..2b1881673584b 100644 --- a/server/src/test/java/org/opensearch/index/mapper/ExternalMapper.java +++ b/server/src/test/java/org/opensearch/index/mapper/ExternalMapper.java @@ -79,7 +79,6 @@ public static class Builder extends ParametrizedFieldMapper.Builder { private final BooleanFieldMapper.Builder boolBuilder = new BooleanFieldMapper.Builder(Names.FIELD_BOOL); private final GeoPointFieldMapper.Builder latLonPointBuilder = new GeoPointFieldMapper.Builder(Names.FIELD_POINT); private final GeoShapeFieldMapper.Builder shapeBuilder = new GeoShapeFieldMapper.Builder(Names.FIELD_SHAPE); - private final LegacyGeoShapeFieldMapper.Builder legacyShapeBuilder = new LegacyGeoShapeFieldMapper.Builder(Names.FIELD_SHAPE); private final Mapper.Builder stringBuilder; private final String generatedValue; private final String mapperName; diff --git a/server/src/test/java/org/opensearch/index/mapper/SemanticVersionTests.java b/server/src/test/java/org/opensearch/index/mapper/SemanticVersionTests.java index f364ea6ff9dde..16a3b4f19d545 100644 --- a/server/src/test/java/org/opensearch/index/mapper/SemanticVersionTests.java +++ b/server/src/test/java/org/opensearch/index/mapper/SemanticVersionTests.java @@ -295,9 +295,7 @@ public void testPadWithZerosMethod() { SemanticVersion version4 = SemanticVersion.parse("0.0.0"); String normalized4 = version4.getNormalizedString(); assertEquals("00000000000000000000.00000000000000000000.00000000000000000000", normalized4); - // Test with a value that doesn't need padding - String str = "9999999999"; String padded = SemanticVersion.parse("1.0.0").toString(); } diff --git a/server/src/test/java/org/opensearch/index/query/MoreLikeThisQueryBuilderTests.java b/server/src/test/java/org/opensearch/index/query/MoreLikeThisQueryBuilderTests.java index 081d580dcbd1e..f2b65f48c5bae 100644 --- a/server/src/test/java/org/opensearch/index/query/MoreLikeThisQueryBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/query/MoreLikeThisQueryBuilderTests.java @@ -84,8 +84,6 @@ public class MoreLikeThisQueryBuilderTests extends AbstractQueryTestCase assertedWarnings = new HashSet<>(); - @Before public void setup() { // MLT only supports string fields, unsupported fields are tested below diff --git a/server/src/test/java/org/opensearch/index/query/TermsQueryBuilderTests.java b/server/src/test/java/org/opensearch/index/query/TermsQueryBuilderTests.java index cfe9fed3bc97c..b459cd12b3e17 100644 --- a/server/src/test/java/org/opensearch/index/query/TermsQueryBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/query/TermsQueryBuilderTests.java @@ -82,7 +82,6 @@ public class TermsQueryBuilderTests extends AbstractQueryTestCase randomTerms; private String termsPath; private boolean maybeIncludeType = true; - private Set assertedWarnings = new HashSet<>(); @Before public void randomTerms() { diff --git a/server/src/test/java/org/opensearch/index/shard/IndexShardTests.java b/server/src/test/java/org/opensearch/index/shard/IndexShardTests.java index c93c997215a55..074f639b1a9da 100644 --- a/server/src/test/java/org/opensearch/index/shard/IndexShardTests.java +++ b/server/src/test/java/org/opensearch/index/shard/IndexShardTests.java @@ -2866,13 +2866,8 @@ public void testSyncSegmentsFromGivenRemoteSegmentStore() throws IOException { indexDoc(source, "_doc", "4"); source.refresh("test"); - - long primaryTerm; - long commitGeneration; try (GatedCloseable segmentInfosGatedCloseable = source.getSegmentInfosSnapshot()) { SegmentInfos segmentInfos = segmentInfosGatedCloseable.get(); - primaryTerm = source.getOperationPrimaryTerm(); - commitGeneration = segmentInfos.getGeneration(); } Collection lastCommitedSegmentsInSource = SegmentInfos.readLatestCommit(source.store().directory()).files(false); diff --git a/server/src/test/java/org/opensearch/index/shard/RemoteStoreRefreshListenerTests.java b/server/src/test/java/org/opensearch/index/shard/RemoteStoreRefreshListenerTests.java index 94269de9349fe..f80f181f40ffe 100644 --- a/server/src/test/java/org/opensearch/index/shard/RemoteStoreRefreshListenerTests.java +++ b/server/src/test/java/org/opensearch/index/shard/RemoteStoreRefreshListenerTests.java @@ -857,7 +857,6 @@ public TestFilterDirectory(Directory in) { private void verifyUploadedSegments(RemoteSegmentStoreDirectory remoteSegmentStoreDirectory) throws IOException { Map uploadedSegments = remoteSegmentStoreDirectory .getSegmentsUploadedToRemoteStore(); - String segmentsNFilename = null; try (GatedCloseable segmentInfosGatedCloseable = indexShard.getSegmentInfosSnapshot()) { SegmentInfos segmentInfos = segmentInfosGatedCloseable.get(); for (String file : segmentInfos.files(true)) { @@ -865,7 +864,6 @@ private void verifyUploadedSegments(RemoteSegmentStoreDirectory remoteSegmentSto assertTrue(uploadedSegments.containsKey(file)); } if (file.startsWith(IndexFileNames.SEGMENTS)) { - segmentsNFilename = file; } } } diff --git a/server/src/test/java/org/opensearch/index/store/RemoteSegmentStoreDirectoryTests.java b/server/src/test/java/org/opensearch/index/store/RemoteSegmentStoreDirectoryTests.java index d673eb49be581..3f8882c8416e0 100644 --- a/server/src/test/java/org/opensearch/index/store/RemoteSegmentStoreDirectoryTests.java +++ b/server/src/test/java/org/opensearch/index/store/RemoteSegmentStoreDirectoryTests.java @@ -135,9 +135,12 @@ public void testGetPrimaryTermGenerationUuid() { } public void testInitException() throws IOException { - when(remoteMetadataDirectory.listFilesByPrefixInLexicographicOrder(RemoteSegmentStoreDirectory.MetadataFilenameUtils.METADATA_PREFIX, METADATA_FILES_TO_FETCH)).thenThrow( - new IOException("Error") - ); + when( + remoteMetadataDirectory.listFilesByPrefixInLexicographicOrder( + RemoteSegmentStoreDirectory.MetadataFilenameUtils.METADATA_PREFIX, + METADATA_FILES_TO_FETCH + ) + ).thenThrow(new IOException("Error")); assertThrows(IOException.class, () -> remoteSegmentStoreDirectory.init()); } @@ -155,9 +158,12 @@ public void testInitNoMetadataFile() throws IOException { } public void testInitMultipleMetadataFile() throws IOException { - when(remoteMetadataDirectory.listFilesByPrefixInLexicographicOrder(RemoteSegmentStoreDirectory.MetadataFilenameUtils.METADATA_PREFIX, METADATA_FILES_TO_FETCH)).thenReturn( - List.of(metadataFilename, metadataFilenameDup) - ); + when( + remoteMetadataDirectory.listFilesByPrefixInLexicographicOrder( + RemoteSegmentStoreDirectory.MetadataFilenameUtils.METADATA_PREFIX, + METADATA_FILES_TO_FETCH + ) + ).thenReturn(List.of(metadataFilename, metadataFilenameDup)); assertThrows(IllegalStateException.class, () -> remoteSegmentStoreDirectory.init()); } diff --git a/server/src/test/java/org/opensearch/index/store/RemoteSegmentStoreDirectoryWithPinnedTimestampTests.java b/server/src/test/java/org/opensearch/index/store/RemoteSegmentStoreDirectoryWithPinnedTimestampTests.java index e71023125d4cd..2531462d21d40 100644 --- a/server/src/test/java/org/opensearch/index/store/RemoteSegmentStoreDirectoryWithPinnedTimestampTests.java +++ b/server/src/test/java/org/opensearch/index/store/RemoteSegmentStoreDirectoryWithPinnedTimestampTests.java @@ -187,7 +187,8 @@ public void testDeleteStaleCommitsPinnedTimestampMdFile() throws Exception { ) ).thenReturn(List.of(metadataFilename, metadataFilename2, metadataFilename3)); - long pinnedTimestampMatchingMetadataFilename2 = RemoteSegmentStoreDirectory.MetadataFilenameUtils.getTimestamp(metadataFilename2) + 10; + long pinnedTimestampMatchingMetadataFilename2 = RemoteSegmentStoreDirectory.MetadataFilenameUtils.getTimestamp(metadataFilename2) + + 10; String blobName = "snapshot1__" + pinnedTimestampMatchingMetadataFilename2; when(blobContainer.listBlobs()).thenReturn(Map.of(blobName, new PlainBlobMetadata(blobName, 100))); diff --git a/server/src/test/java/org/opensearch/index/translog/LocalTranslogTests.java b/server/src/test/java/org/opensearch/index/translog/LocalTranslogTests.java index cae27d5b259c4..3bac9d3354843 100644 --- a/server/src/test/java/org/opensearch/index/translog/LocalTranslogTests.java +++ b/server/src/test/java/org/opensearch/index/translog/LocalTranslogTests.java @@ -821,9 +821,7 @@ public void testFullRangeSnapshotWithFailures() throws Exception { long fromSeqNo = 0L; long toSeqNo = Math.min(nextSeqNo - 1, fromSeqNo + 15); try (Translog.Snapshot snapshot = translog.newSnapshot(fromSeqNo, toSeqNo, true)) { - int totOps = 0; for (Translog.Operation op = snapshot.next(); op != null; op = snapshot.next()) { - totOps++; } fail("Should throw exception for missing operations"); } catch (MissingHistoryOperationsException e) { diff --git a/server/src/test/java/org/opensearch/index/translog/RemoteFsTranslogTests.java b/server/src/test/java/org/opensearch/index/translog/RemoteFsTranslogTests.java index 190af714d5764..05ee1c54ba7b1 100644 --- a/server/src/test/java/org/opensearch/index/translog/RemoteFsTranslogTests.java +++ b/server/src/test/java/org/opensearch/index/translog/RemoteFsTranslogTests.java @@ -979,9 +979,7 @@ public void testFullRangeSnapshotWithFailures() throws Exception { long fromSeqNo = 0L; long toSeqNo = Math.min(nextSeqNo - 1, fromSeqNo + 15); try (Translog.Snapshot snapshot = translog.newSnapshot(fromSeqNo, toSeqNo, true)) { - int totOps = 0; for (Translog.Operation op = snapshot.next(); op != null; op = snapshot.next()) { - totOps++; } fail("Should throw exception for missing operations"); } catch (MissingHistoryOperationsException e) { diff --git a/server/src/test/java/org/opensearch/indices/replication/PrimaryShardReplicationSourceTests.java b/server/src/test/java/org/opensearch/indices/replication/PrimaryShardReplicationSourceTests.java index f9b236fad5b02..53b849cc81895 100644 --- a/server/src/test/java/org/opensearch/indices/replication/PrimaryShardReplicationSourceTests.java +++ b/server/src/test/java/org/opensearch/indices/replication/PrimaryShardReplicationSourceTests.java @@ -38,7 +38,6 @@ public class PrimaryShardReplicationSourceTests extends IndexShardTestCase { private static final long PRIMARY_TERM = 1L; private static final long SEGMENTS_GEN = 2L; - private static final long SEQ_NO = 3L; private static final long VERSION = 4L; private static final long REPLICATION_ID = 123L; diff --git a/server/src/test/java/org/opensearch/indices/replication/RemoteStoreReplicationSourceTests.java b/server/src/test/java/org/opensearch/indices/replication/RemoteStoreReplicationSourceTests.java index 88c0046796ce6..45d6dadf008b3 100644 --- a/server/src/test/java/org/opensearch/indices/replication/RemoteStoreReplicationSourceTests.java +++ b/server/src/test/java/org/opensearch/indices/replication/RemoteStoreReplicationSourceTests.java @@ -181,8 +181,12 @@ private void buildIndexShardBehavior(IndexShard mockShard, IndexShard indexShard when(mockShard.getSegmentInfosSnapshot()).thenReturn(indexShard.getSegmentInfosSnapshot()); Store remoteStore = mock(Store.class); when(mockShard.remoteStore()).thenReturn(remoteStore); - RemoteSegmentStoreDirectory remoteSegmentStoreDirectory = (RemoteSegmentStoreDirectory) ((FilterDirectory) ((FilterDirectory) indexShard.remoteStore().directory()).getDelegate()).getDelegate(); - FilterDirectory remoteStoreFilterDirectory = new RemoteStoreRefreshListenerTests.TestFilterDirectory(new RemoteStoreRefreshListenerTests.TestFilterDirectory(remoteSegmentStoreDirectory)); + RemoteSegmentStoreDirectory remoteSegmentStoreDirectory = + (RemoteSegmentStoreDirectory) ((FilterDirectory) ((FilterDirectory) indexShard.remoteStore().directory()).getDelegate()) + .getDelegate(); + FilterDirectory remoteStoreFilterDirectory = new RemoteStoreRefreshListenerTests.TestFilterDirectory( + new RemoteStoreRefreshListenerTests.TestFilterDirectory(remoteSegmentStoreDirectory) + ); when(remoteStore.directory()).thenReturn(remoteStoreFilterDirectory); } } diff --git a/server/src/test/java/org/opensearch/ingest/ConditionalProcessorTests.java b/server/src/test/java/org/opensearch/ingest/ConditionalProcessorTests.java index 921ac10c02862..770fa0720f6cb 100644 --- a/server/src/test/java/org/opensearch/ingest/ConditionalProcessorTests.java +++ b/server/src/test/java/org/opensearch/ingest/ConditionalProcessorTests.java @@ -68,8 +68,6 @@ public class ConditionalProcessorTests extends OpenSearchTestCase { - private static final String scriptName = "conditionalScript"; - public void testChecksCondition() throws Exception { String conditionalField = "field1"; String scriptName = "conditionalScript"; diff --git a/server/src/test/java/org/opensearch/node/InternalSettingsPreparerTests.java b/server/src/test/java/org/opensearch/node/InternalSettingsPreparerTests.java index 5a8de1fca0d31..a68b37611d23a 100644 --- a/server/src/test/java/org/opensearch/node/InternalSettingsPreparerTests.java +++ b/server/src/test/java/org/opensearch/node/InternalSettingsPreparerTests.java @@ -55,7 +55,6 @@ import static java.util.Collections.emptyMap; public class InternalSettingsPreparerTests extends OpenSearchTestCase { - private static final Supplier DEFAULT_NODE_NAME_SHOULDNT_BE_CALLED = () -> { throw new AssertionError("shouldn't be called"); }; Path homeDir; Settings baseEnvSettings; diff --git a/server/src/test/java/org/opensearch/node/NodeTests.java b/server/src/test/java/org/opensearch/node/NodeTests.java index 999586f4f8639..a320addf4b351 100644 --- a/server/src/test/java/org/opensearch/node/NodeTests.java +++ b/server/src/test/java/org/opensearch/node/NodeTests.java @@ -178,7 +178,6 @@ public void testNodeAttributes() throws IOException { public void testServerNameNodeAttribute() throws IOException { String attr = "valid-hostname"; Settings.Builder settings = baseSettings().put(Node.NODE_ATTRIBUTES.getKey() + "server_name", attr); - int i = 0; try (Node node = new MockNode(settings.build(), basePlugins())) { final Settings nodeSettings = randomBoolean() ? node.settings() : node.getEnvironment().settings(); assertEquals(attr, Node.NODE_ATTRIBUTES.getAsMap(nodeSettings).get("server_name")); diff --git a/server/src/test/java/org/opensearch/repositories/IndexMetadataGenerationsTests.java b/server/src/test/java/org/opensearch/repositories/IndexMetadataGenerationsTests.java index 1e2d72e4a91fd..05f18e28e2186 100644 --- a/server/src/test/java/org/opensearch/repositories/IndexMetadataGenerationsTests.java +++ b/server/src/test/java/org/opensearch/repositories/IndexMetadataGenerationsTests.java @@ -65,7 +65,6 @@ public void testIndexMetaBlobIdFallback() { public void testWithAddedSnapshot() { // Construct a new snapshot SnapshotId newSnapshot = new SnapshotId("newSnapshot", "newSnapshot"); - final String newIndexMetadataPrefix = "newIndexMetadata-"; final String newBlobIdPrefix = "newBlob-"; final int numIndices = randomIntBetween(2, MAX_TEST_INDICES); Map newLookupMap = createIndexMetadataMap(2, numIndices); diff --git a/server/src/test/java/org/opensearch/rest/action/cat/RestCatSegmentReplicationActionTests.java b/server/src/test/java/org/opensearch/rest/action/cat/RestCatSegmentReplicationActionTests.java index 41ad9e8bcbb44..b3e3ad6a7ec76 100644 --- a/server/src/test/java/org/opensearch/rest/action/cat/RestCatSegmentReplicationActionTests.java +++ b/server/src/test/java/org/opensearch/rest/action/cat/RestCatSegmentReplicationActionTests.java @@ -31,7 +31,6 @@ import java.util.Date; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -183,8 +182,4 @@ private void addTestFileMetadata(ReplicationLuceneIndex index, int startIndex, i } } } - - private static String percent(float percent) { - return String.format(Locale.ROOT, "%1.1f%%", percent); - } } diff --git a/server/src/test/java/org/opensearch/search/SearchServiceStarTreeTests.java b/server/src/test/java/org/opensearch/search/SearchServiceStarTreeTests.java index ae434f1df14e6..6a6066bc876ff 100644 --- a/server/src/test/java/org/opensearch/search/SearchServiceStarTreeTests.java +++ b/server/src/test/java/org/opensearch/search/SearchServiceStarTreeTests.java @@ -284,8 +284,6 @@ public void testStarTreeNestedAggregations() throws IOException { null, null ); - - QueryBuilder baseQuery; SearchContext searchContext = createSearchContext(indexService); StarTreeFieldConfiguration starTreeFieldConfiguration = new StarTreeFieldConfiguration( 1, diff --git a/server/src/test/java/org/opensearch/search/aggregations/bucket/BucketUtilsTests.java b/server/src/test/java/org/opensearch/search/aggregations/bucket/BucketUtilsTests.java index 88e281032d678..a203996d03f07 100644 --- a/server/src/test/java/org/opensearch/search/aggregations/bucket/BucketUtilsTests.java +++ b/server/src/test/java/org/opensearch/search/aggregations/bucket/BucketUtilsTests.java @@ -67,15 +67,15 @@ public static void main(String[] args) { final int numberOfShards = 10; final double skew = 2; // parameter of the zipf distribution final int size = 100; - + double totalWeight = 0; for (int rank = 1; rank <= numberOfUniqueTerms; ++rank) { totalWeight += weight(rank, skew); } - + int[] terms = new int[totalNumberOfTerms]; int len = 0; - + final int[] actualTopFreqs = new int[size]; for (int rank = 1; len < totalNumberOfTerms; ++rank) { int freq = (int) (weight(rank, skew) / totalWeight * totalNumberOfTerms); @@ -86,9 +86,9 @@ public static void main(String[] args) { actualTopFreqs[rank-1] = freq; } } - + final int maxTerm = terms[terms.length - 1] + 1; - + // shuffle terms Random r = new Random(0); for (int i = terms.length - 1; i > 0; --i) { @@ -104,7 +104,7 @@ public static void main(String[] args) { shards[i] = Arrays.copyOfRange(terms, upTo, upTo + (terms.length - upTo) / (numberOfShards - i)); upTo += shards[i].length; } - + final int[][] topShards = new int[numberOfShards][]; final int shardSize = BucketUtils.suggestShardSideQueueSize(size, numberOfShards); for (int shard = 0; shard < numberOfShards; ++shard) { @@ -118,7 +118,7 @@ public static void main(String[] args) { termIds[i] = i; } new InPlaceMergeSorter() { - + @Override protected void swap(int i, int j) { int tmp = termIds[i]; @@ -128,16 +128,16 @@ protected void swap(int i, int j) { freqs[i] = freqs[j]; freqs[j] = tmp; } - + @Override protected int compare(int i, int j) { return freqs[j] - freqs[i]; } }.sort(0, maxTerm); - + Arrays.fill(freqs, shardSize, freqs.length, 0); new InPlaceMergeSorter() { - + @Override protected void swap(int i, int j) { int tmp = termIds[i]; @@ -147,16 +147,16 @@ protected void swap(int i, int j) { freqs[i] = freqs[j]; freqs[j] = tmp; } - + @Override protected int compare(int i, int j) { return termIds[i] - termIds[j]; } }.sort(0, maxTerm); - + topShards[shard] = freqs; } - + final int[] computedTopFreqs = new int[size]; for (int[] freqs : topShards) { for (int i = 0; i < size; ++i) { @@ -174,7 +174,7 @@ protected int compare(int i, int j) { System.out.println("Computed freqs of top terms: " + Arrays.toString(computedTopFreqs)); System.out.println("Number of errors: " + numErrors + "/" + totalFreq); } - + private static double weight(int rank, double skew) { return 1d / Math.pow(rank, skew); }*/ diff --git a/server/src/test/java/org/opensearch/search/aggregations/bucket/ShardSizeTestCase.java b/server/src/test/java/org/opensearch/search/aggregations/bucket/ShardSizeTestCase.java index 0bf23bd3e2cad..a8539e81f3233 100644 --- a/server/src/test/java/org/opensearch/search/aggregations/bucket/ShardSizeTestCase.java +++ b/server/src/test/java/org/opensearch/search/aggregations/bucket/ShardSizeTestCase.java @@ -81,8 +81,8 @@ protected void createIdx(String keyFieldMapping) { protected void indexData() throws Exception { /* - - + + || || size = 3, shard_size = 5 || shard_size = size = 3 || ||==========||==================================================||===============================================|| || shard 1: || "1" - 5 | "2" - 4 | "3" - 3 | "4" - 2 | "5" - 1 || "1" - 5 | "3" - 3 | "2" - 4 || @@ -92,8 +92,8 @@ protected void indexData() throws Exception { || reduced: || "1" - 8 | "2" - 5 | "3" - 8 | "4" - 4 | "5" - 2 || || || || || "1" - 8, "3" - 8, "2" - 4 <= WRONG || || || "1" - 8 | "3" - 8 | "2" - 5 <= CORRECT || || - - + + */ List docs = new ArrayList<>(); diff --git a/server/src/test/java/org/opensearch/search/aggregations/bucket/range/DateRangeAggregatorTests.java b/server/src/test/java/org/opensearch/search/aggregations/bucket/range/DateRangeAggregatorTests.java index 96c8be1a25cc3..ada5634c18629 100644 --- a/server/src/test/java/org/opensearch/search/aggregations/bucket/range/DateRangeAggregatorTests.java +++ b/server/src/test/java/org/opensearch/search/aggregations/bucket/range/DateRangeAggregatorTests.java @@ -66,7 +66,6 @@ public class DateRangeAggregatorTests extends AggregatorTestCase { private String NUMBER_FIELD_NAME = "number"; - private String UNMAPPED_FIELD_NAME = "field_not_appearing_in_this_index"; private String DATE_FIELD_NAME = "date"; private long milli1 = ZonedDateTime.of(2015, 11, 13, 16, 14, 34, 0, ZoneOffset.UTC).toInstant().toEpochMilli(); diff --git a/server/src/test/java/org/opensearch/search/aggregations/startree/NumericTermsAggregatorTests.java b/server/src/test/java/org/opensearch/search/aggregations/startree/NumericTermsAggregatorTests.java index 84d6ab7dc4460..1ed72a06788a2 100644 --- a/server/src/test/java/org/opensearch/search/aggregations/startree/NumericTermsAggregatorTests.java +++ b/server/src/test/java/org/opensearch/search/aggregations/startree/NumericTermsAggregatorTests.java @@ -64,7 +64,6 @@ import static org.opensearch.test.InternalAggregationTestCase.DEFAULT_MAX_BUCKETS; public class NumericTermsAggregatorTests extends AggregatorTestCase { - private static FeatureFlags.TestUtils.FlagWriteLock fflock = null; final static String STATUS = "status"; final static String SIZE = "size"; private static final MappedFieldType STATUS_FIELD_TYPE = new NumberFieldMapper.NumberFieldType( diff --git a/server/src/test/java/org/opensearch/search/aggregations/startree/StarTreeFilterTests.java b/server/src/test/java/org/opensearch/search/aggregations/startree/StarTreeFilterTests.java index caa8264f5b7a8..02b6091b525f9 100644 --- a/server/src/test/java/org/opensearch/search/aggregations/startree/StarTreeFilterTests.java +++ b/server/src/test/java/org/opensearch/search/aggregations/startree/StarTreeFilterTests.java @@ -58,7 +58,6 @@ import static org.opensearch.index.codec.composite912.datacube.startree.AbstractStarTreeDVFormatTests.topMapping; public class StarTreeFilterTests extends AggregatorTestCase { - private static FeatureFlags.TestUtils.FlagWriteLock fflock = null; private static final String FIELD_NAME = "field"; private static final String SNDV = "sndv"; diff --git a/server/src/test/java/org/opensearch/search/backpressure/trackers/HeapUsageTrackerTests.java b/server/src/test/java/org/opensearch/search/backpressure/trackers/HeapUsageTrackerTests.java index 1c46305e9fda6..e9c83baa6aba1 100644 --- a/server/src/test/java/org/opensearch/search/backpressure/trackers/HeapUsageTrackerTests.java +++ b/server/src/test/java/org/opensearch/search/backpressure/trackers/HeapUsageTrackerTests.java @@ -29,8 +29,6 @@ import static org.mockito.Mockito.when; public class HeapUsageTrackerTests extends OpenSearchTestCase { - private static final long HEAP_BYTES_THRESHOLD_SEARCH_SHARD_TASK = 100; - private static final long HEAP_BYTES_THRESHOLD_SEARCH_TASK = 50; private static final int HEAP_MOVING_AVERAGE_WINDOW_SIZE = 100; private static final SearchBackpressureSettings mockSettings = new SearchBackpressureSettings( diff --git a/server/src/test/java/org/opensearch/search/fetch/subphase/highlight/DerivedFieldFetchAndHighlightTests.java b/server/src/test/java/org/opensearch/search/fetch/subphase/highlight/DerivedFieldFetchAndHighlightTests.java index f106aaa13dc48..cb610a6139afc 100644 --- a/server/src/test/java/org/opensearch/search/fetch/subphase/highlight/DerivedFieldFetchAndHighlightTests.java +++ b/server/src/test/java/org/opensearch/search/fetch/subphase/highlight/DerivedFieldFetchAndHighlightTests.java @@ -26,13 +26,9 @@ import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.index.IndexService; import org.opensearch.index.IndexSettings; -import org.opensearch.index.mapper.ContentPath; import org.opensearch.index.mapper.DefaultDerivedFieldResolver; import org.opensearch.index.mapper.DerivedField; import org.opensearch.index.mapper.DerivedFieldResolverFactory; -import org.opensearch.index.mapper.DerivedFieldSupportedTypes; -import org.opensearch.index.mapper.DerivedFieldType; -import org.opensearch.index.mapper.Mapper; import org.opensearch.index.mapper.MapperService; import org.opensearch.index.mapper.SourceToParse; import org.opensearch.index.query.QueryShardContext; @@ -474,15 +470,4 @@ private static ScriptService getScriptService() { ScriptService scriptService = new ScriptService(Settings.EMPTY, engines, ScriptModule.CORE_CONTEXTS); return scriptService; } - - private DerivedFieldType createDerivedFieldType(String name, String type, String script) { - Mapper.BuilderContext context = mock(Mapper.BuilderContext.class); - when(context.path()).thenReturn(new ContentPath()); - return new DerivedFieldType( - new DerivedField(name, type, new Script(ScriptType.INLINE, "mockscript", script, emptyMap())), - DerivedFieldSupportedTypes.getFieldMapperFromType(type, name, context, null), - DerivedFieldSupportedTypes.getIndexableFieldGeneratorType(type, name), - null - ); - } } diff --git a/server/src/test/java/org/opensearch/search/geo/GeoShapeQueryTests.java b/server/src/test/java/org/opensearch/search/geo/GeoShapeQueryTests.java index 4f78d9166b414..ea44910bb526a 100644 --- a/server/src/test/java/org/opensearch/search/geo/GeoShapeQueryTests.java +++ b/server/src/test/java/org/opensearch/search/geo/GeoShapeQueryTests.java @@ -78,12 +78,10 @@ import static org.opensearch.test.geo.RandomShapeGenerator.xRandomRectangle; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertSearchResponse; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.not; -import static com.carrotsearch.randomizedtesting.RandomizedTest.assumeTrue; public class GeoShapeQueryTests extends GeoQueryTests { protected static final String[] PREFIX_TREES = new String[] { diff --git a/server/src/test/java/org/opensearch/search/internal/ContextIndexSearcherTests.java b/server/src/test/java/org/opensearch/search/internal/ContextIndexSearcherTests.java index e645cd6a7723f..4b2bb7561aae1 100644 --- a/server/src/test/java/org/opensearch/search/internal/ContextIndexSearcherTests.java +++ b/server/src/test/java/org/opensearch/search/internal/ContextIndexSearcherTests.java @@ -545,7 +545,6 @@ private static int computeNumDocs(LeafReader reader, BitSet roleQueryBits) { private static class CreateScorerOnceWeight extends Weight { private final Weight weight; - private final Set seenLeaves = Collections.newSetFromMap(new IdentityHashMap<>()); CreateScorerOnceWeight(Weight weight) { super(weight.getQuery()); diff --git a/server/src/test/java/org/opensearch/wlm/cancellation/WorkloadGroupTaskCancellationServiceTests.java b/server/src/test/java/org/opensearch/wlm/cancellation/WorkloadGroupTaskCancellationServiceTests.java index 9cef7f939df1d..6c28db5b75160 100644 --- a/server/src/test/java/org/opensearch/wlm/cancellation/WorkloadGroupTaskCancellationServiceTests.java +++ b/server/src/test/java/org/opensearch/wlm/cancellation/WorkloadGroupTaskCancellationServiceTests.java @@ -179,7 +179,6 @@ public void testGetCancellableTasksFrom_returnsNoTasksWhenNotBreachingThreshold( public void testGetCancellableTasksFrom_filtersWorkloadGroupCorrectly() { ResourceType resourceType = ResourceType.CPU; - double usage = 0.02; Double threshold = 0.01; WorkloadGroup workloadGroup1 = new WorkloadGroup( @@ -512,7 +511,6 @@ public void testGetAllCancellableTasks_ReturnsTasksWhenBreachingThresholds() { public void testGetCancellableTasksFrom_doesNotReturnTasksWhenWorkloadGroupIdNotFound() { ResourceType resourceType = ResourceType.CPU; - double usage = 0.11; Double threshold = 0.01; WorkloadGroup workloadGroup1 = new WorkloadGroup( diff --git a/test/framework/src/main/java/org/opensearch/cluster/OpenSearchAllocationWithConstraintsTestCase.java b/test/framework/src/main/java/org/opensearch/cluster/OpenSearchAllocationWithConstraintsTestCase.java index 0c08de252e4cd..758722ea4072a 100644 --- a/test/framework/src/main/java/org/opensearch/cluster/OpenSearchAllocationWithConstraintsTestCase.java +++ b/test/framework/src/main/java/org/opensearch/cluster/OpenSearchAllocationWithConstraintsTestCase.java @@ -215,7 +215,7 @@ public int allocateAndCheckIndexShardHotSpots(boolean expected, int nodes, Strin SameShardAllocationDecider, causing it to breach allocation constraint on another node. We need to differentiate between such hot spots v/s actual hot spots. - + A simple check could be to ensure there is no node with shards less than allocation limit, that can accept current shard. However, in current allocation algorithm, when nodes get throttled, shards are added to @@ -224,7 +224,7 @@ ModelNodes without adding them to actual cluster (RoutingNodes). As a result, weight function in balancer. RoutingNodes with {@link count} < {@link limit} may not have had the same count in the corresponding ModelNode seen by weight function. We hence use the following alternate check -- - + Given the way {@link limit} is defined, we should not have hot spots if *all* nodes are eligible to accept the shard. A hot spot is acceptable, if either all peer nodes have {@link count} > {@link limit}, or if even one node is diff --git a/test/framework/src/main/java/org/opensearch/index/replication/OpenSearchIndexLevelReplicationTestCase.java b/test/framework/src/main/java/org/opensearch/index/replication/OpenSearchIndexLevelReplicationTestCase.java index bcc4f8d77e72b..8422dfdec8519 100644 --- a/test/framework/src/main/java/org/opensearch/index/replication/OpenSearchIndexLevelReplicationTestCase.java +++ b/test/framework/src/main/java/org/opensearch/index/replication/OpenSearchIndexLevelReplicationTestCase.java @@ -76,7 +76,6 @@ import org.opensearch.common.io.stream.BytesStreamOutput; import org.opensearch.common.lease.Releasable; import org.opensearch.common.lease.Releasables; -import org.opensearch.common.settings.ClusterSettings; import org.opensearch.common.settings.Settings; import org.opensearch.common.unit.TimeValue; import org.opensearch.core.action.ActionListener; @@ -220,7 +219,6 @@ protected class ReplicationGroup implements AutoCloseable, Iterable private final AtomicInteger docId = new AtomicInteger(); boolean closed = false; private volatile ReplicationTargets replicationTargets; - private final ClusterSettings clusterSettings = new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); private final PrimaryReplicaSyncer primaryReplicaSyncer = new PrimaryReplicaSyncer( new TaskManager(Settings.EMPTY, threadPool, Collections.emptySet()), diff --git a/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java b/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java index d42a212d5e5ac..970766046e336 100644 --- a/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java +++ b/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java @@ -212,8 +212,6 @@ public abstract class IndexShardTestCase extends OpenSearchTestCase { private static final AtomicBoolean failOnShardFailures = new AtomicBoolean(true); - private RecoveryTarget recoveryTarget; - private static final Consumer DEFAULT_SHARD_FAILURE_HANDLER = failure -> { if (failOnShardFailures.get()) { throw new AssertionError(failure.reason, failure.cause); diff --git a/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java b/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java index 027b1bef84e7f..69d7b9f511bfd 100644 --- a/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java +++ b/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java @@ -59,14 +59,12 @@ import org.opensearch.core.xcontent.MediaTypeRegistry; import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.core.xcontent.XContentParser; -import org.opensearch.index.IndexModule; import org.opensearch.repositories.IndexId; import org.opensearch.repositories.RepositoriesService; import org.opensearch.repositories.RepositoryData; import org.opensearch.repositories.ShardGenerations; import org.opensearch.snapshots.SnapshotId; import org.opensearch.snapshots.SnapshotInfo; -import org.opensearch.snapshots.SnapshotMissingException; import org.opensearch.test.InternalTestCluster; import org.opensearch.threadpool.ThreadPool; @@ -470,24 +468,4 @@ private static ClusterService mockClusterService(ClusterState initialState) { when(clusterService.getClusterSettings()).thenReturn(clusterSettings); return clusterService; } - - private static boolean isRemoteSnapshot(BlobStoreRepository repository, RepositoryData repositoryData, IndexId indexId) - throws IOException { - final Collection snapshotIds = repositoryData.getSnapshotIds(); - for (SnapshotId snapshotId : snapshotIds) { - try { - if (isRemoteSnapshot(repository.getSnapshotIndexMetaData(repositoryData, snapshotId, indexId))) { - return true; - } - } catch (SnapshotMissingException e) { - // Index does not exist in this snapshot so continue looping - } - } - return false; - } - - private static boolean isRemoteSnapshot(IndexMetadata metadata) { - final String storeType = metadata.getSettings().get(IndexModule.INDEX_STORE_TYPE_SETTING.getKey()); - return storeType != null && storeType.equals(IndexModule.Type.REMOTE_SNAPSHOT.getSettingsKey()); - } } diff --git a/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java b/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java index fc92065391fd4..9a37e3e3a393f 100644 --- a/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java +++ b/test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java @@ -191,7 +191,6 @@ public abstract class AggregatorTestCase extends OpenSearchTestCase { private static final String NESTEDFIELD_PREFIX = "nested_"; private List releasables = new ArrayList<>(); - private static final String TYPE_NAME = "type"; protected ValuesSourceRegistry valuesSourceRegistry; // A list of field types that should not be tested, or are not currently supported diff --git a/test/framework/src/main/java/org/opensearch/test/rest/OpenSearchRestTestCase.java b/test/framework/src/main/java/org/opensearch/test/rest/OpenSearchRestTestCase.java index 8c612d258f183..f03678ca4ca58 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/OpenSearchRestTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/OpenSearchRestTestCase.java @@ -722,30 +722,6 @@ protected void refreshAllIndices() throws IOException { client().performRequest(refreshRequest); } - private static void deleteAllSLMPolicies() throws IOException { - Map policies; - - try { - Response response = adminClient().performRequest(new Request("GET", "/_slm/policy")); - policies = entityAsMap(response); - } catch (ResponseException e) { - if (RestStatus.METHOD_NOT_ALLOWED.getStatus() == e.getResponse().getStatusLine().getStatusCode() - || RestStatus.BAD_REQUEST.getStatus() == e.getResponse().getStatusLine().getStatusCode()) { - // If bad request returned, SLM is not enabled. - return; - } - throw e; - } - - if (policies == null || policies.isEmpty()) { - return; - } - - for (String policyName : policies.keySet()) { - adminClient().performRequest(new Request("DELETE", "/_slm/policy/" + policyName)); - } - } - /** * Logs a message if there are still running tasks. The reasoning is that any tasks still running are state the is trying to bleed into * other tests.