Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public class AllocationBenchmark {
public int clusterConcurrentRecoveries;

private AllocationService initialClusterStrategy;
private AllocationService clusterExcludeStrategy;
private AllocationService clusterZoneAwareExcludeStrategy;
private ClusterState initialClusterState;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends ZipArchiveEntry> entries = zipFile.getEntries();
ZipArchiveEntry entry;
byte[] buffer = new byte[8192];
while (entries.hasMoreElements()) {
entry = entries.nextElement();
if (entry.getName().startsWith("opensearch/")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Path> stream = Files.newDirectoryStream(binDir)) {
for (Path file : stream) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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=3
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 \
Expand Down
1 change: 1 addition & 0 deletions gradle/code-convention.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ allprojects {
exclusions.add("**AbstractBenchmark.java")
exclusions.add("**ScriptClassPathResolutionContext.java")
exclusions.add("**StarTreeMapper.java")
exclusions.add("**SearchAfterIT.java")
failOnDryRunResults = true
}
repositories {
Expand Down
7 changes: 4 additions & 3 deletions gradle/code-convention.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ 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.text.EndOfLineAtEndOfFile
# - org.openrewrite.staticanalysis.EmptyBlock
# - org.openrewrite.java.OrderImports
# - 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
# - org.openrewrite.text.EndOfLineAtEndOfFile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1858,8 +1858,6 @@ public void testGetPutAndInvalidateWithDiskCacheDisabled() throws Exception {
for (int iter = 0; iter < numOfItems2; iter++) {
ICacheKey<String> key = getICacheKey(UUID.randomUUID().toString());
int keySegment = tieredSpilloverCache.getSegmentNumber(key);
TieredSpilloverCache.TieredSpilloverCacheSegment<String, String> segment =
tieredSpilloverCache.tieredSpilloverCacheSegments[keySegment];
LoadAwareCacheLoader<ICacheKey<String>, String> loadAwareCacheLoader = getLoadAwareCacheLoader();
tieredSpilloverCache.computeIfAbsent(key, loadAwareCacheLoader);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
public class ForEachProcessorFactoryTests extends OpenSearchTestCase {

private final ScriptService scriptService = mock(ScriptService.class);
private final Consumer<Runnable> genericExecutor = Runnable::run;

public void testCreate() throws Exception {
Processor processor = new TestProcessor(ingestDocument -> {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -2467,7 +2466,6 @@ private NoncondexpressionContext noncondexpression(int _p) throws RecognitionExc
{
_localctx = new SingleContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;

setState(266);
unary();
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public void testMultipleSources() throws Exception {
Map<String, List<IndexRequestBuilder>> 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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<BlobPath> indexRoutingPaths;
AtomicInteger indexRoutingFiles = new AtomicInteger();
private final RemoteStoreEnums.PathType pathType = RemoteStoreEnums.PathType.HASHED_PREFIX;

@Before
public void setup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public void testFailResizeIndexWhileDocRepToRemoteStoreMigration() throws Except

ResizeType resizeType;
int resizeShardsNum;
String cause;
switch (randomIntBetween(0, 2)) {
case 0:
resizeType = ResizeType.SHRINK;
Expand Down Expand Up @@ -172,7 +171,6 @@ public void testFailResizeIndexWhileRemoteStoreToDocRepMigration() throws Except

ResizeType resizeType;
int resizeShardsNum;
String cause;
switch (randomIntBetween(0, 2)) {
case 0:
resizeType = ResizeType.SHRINK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Loading
Loading