Skip to content

Commit

Permalink
Removing skipIndexResolver param
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Garg <[email protected]>
  • Loading branch information
Harsh Garg committed Dec 11, 2024
1 parent f4fb43d commit 790b8c0
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ public void onResponse(ClusterStateResponse clusterStateResponse) {
indicesStatsRequest.setShouldCancelOnTimeout(true);
indicesStatsRequest.all();
indicesStatsRequest.indices(indices);
// Since the indices for paginated query are already concrete and have been filtered to
// only consider OPEN indices, invoking IndexNameExpressionResolver should be avoided.
if (paginationStrategy != null) {
indicesStatsRequest.skipIndexNameResolver(true);
}
indicesStatsRequest.setParentTask(client.getLocalNodeId(), parentTask.getId());
client.admin().indices().stats(indicesStatsRequest, new ActionListener<IndicesStatsResponse>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

package org.opensearch.action.admin.indices.stats;

import org.opensearch.Version;
import org.opensearch.action.support.broadcast.BroadcastRequest;
import org.opensearch.common.annotation.PublicApi;
import org.opensearch.core.common.io.stream.StreamInput;
Expand All @@ -58,7 +57,6 @@
public class IndicesStatsRequest extends BroadcastRequest<IndicesStatsRequest> {

private CommonStatsFlags flags = new CommonStatsFlags();
private boolean skipIndexNameResolver = false;

public IndicesStatsRequest() {
super((String[]) null);
Expand All @@ -67,9 +65,6 @@ public IndicesStatsRequest() {
public IndicesStatsRequest(StreamInput in) throws IOException {
super(in);
flags = new CommonStatsFlags(in);
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
skipIndexNameResolver = in.readBoolean();
}
}

/**
Expand Down Expand Up @@ -306,22 +301,10 @@ public IndicesStatsRequest includeUnloadedSegments(boolean includeUnloadedSegmen
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
flags.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
out.writeBoolean(skipIndexNameResolver);
}
}

@Override
public boolean includeDataStreams() {
return true;
}

public boolean skipIndexNameResolver() {
return skipIndexNameResolver;
}

public IndicesStatsRequest skipIndexNameResolver(boolean skipIndexNameResolver) {
this.skipIndexNameResolver = skipIndexNameResolver;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import org.opensearch.transport.TransportService;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -154,15 +153,4 @@ protected ShardStats shardOperation(IndicesStatsRequest request, ShardRouting sh
}
return new ShardStats(indexShard.routingEntry(), indexShard.shardPath(), commonStats, commitStats, seqNoStats, retentionLeaseStats);
}

@Override
protected String[] resolveConcreteIndexNames(ClusterState clusterState, IndicesStatsRequest request) {
if (request.skipIndexNameResolver()) {
// filter out all the indices which might not be present in the local clusterState
return Arrays.stream(request.indices())
.filter(index -> clusterState.metadata().indices().containsKey(index))
.toArray(String[]::new);
}
return super.resolveConcreteIndexNames(clusterState, request);
}
}

0 comments on commit 790b8c0

Please sign in to comment.