Skip to content

Commit ea1b44e

Browse files
SwethaGupthaSwetha Guptha
andcommitted
Reset discovery nodes in most transport node actions request. (opensearch-project#15131)
Signed-off-by: Swetha Guptha <gupthasg@amazon.com> Co-authored-by: Swetha Guptha <gupthasg@amazon.com> Signed-off-by: Swetha Guptha <gupthasg@amazon.com>
1 parent 3b8a741 commit ea1b44e

24 files changed

+86
-112
lines changed

server/src/main/java/org/opensearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public NodesHotThreadsRequest(StreamInput in) throws IOException {
7070
* threads for all nodes is used.
7171
*/
7272
public NodesHotThreadsRequest(String... nodesIds) {
73-
super(nodesIds);
73+
super(false, nodesIds);
7474
}
7575

7676
public int threads() {

server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public NodesInfoRequest(StreamInput in) throws IOException {
8888
* for all nodes will be returned.
8989
*/
9090
public NodesInfoRequest(String... nodesIds) {
91-
super(nodesIds);
91+
super(false, nodesIds);
9292
all();
9393
}
9494

server/src/main/java/org/opensearch/action/admin/cluster/node/stats/NodesStatsRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class NodesStatsRequest extends BaseNodesRequest<NodesStatsRequest> {
5959
private final Set<String> requestedMetrics = new HashSet<>();
6060

6161
public NodesStatsRequest() {
62-
super((String[]) null);
62+
super(false, (String[]) null);
6363
}
6464

6565
public NodesStatsRequest(StreamInput in) throws IOException {
@@ -90,7 +90,7 @@ public NodesStatsRequest(StreamInput in) throws IOException {
9090
* for all nodes will be returned.
9191
*/
9292
public NodesStatsRequest(String... nodesIds) {
93-
super(nodesIds);
93+
super(false, nodesIds);
9494
}
9595

9696
/**

server/src/main/java/org/opensearch/action/admin/cluster/node/usage/NodesUsageRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public NodesUsageRequest(StreamInput in) throws IOException {
6464
* passed, usage for all nodes will be returned.
6565
*/
6666
public NodesUsageRequest(String... nodesIds) {
67-
super(nodesIds);
67+
super(false, nodesIds);
6868
}
6969

7070
/**

server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportNodesSnapshotsStatus.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public Request(StreamInput in) throws IOException {
161161
}
162162

163163
public Request(String[] nodesIds) {
164-
super(nodesIds);
164+
super(false, nodesIds);
165165
}
166166

167167
public Request snapshots(Snapshot[] snapshots) {

server/src/main/java/org/opensearch/action/admin/cluster/stats/ClusterStatsRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public ClusterStatsRequest(StreamInput in) throws IOException {
6262
* based on all nodes will be returned.
6363
*/
6464
public ClusterStatsRequest(String... nodesIds) {
65-
super(nodesIds);
65+
super(false, nodesIds);
6666
}
6767

6868
public boolean useAggregatedNodeLevelResponses() {

server/src/main/java/org/opensearch/action/admin/indices/dangling/find/FindDanglingIndexRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public FindDanglingIndexRequest(StreamInput in) throws IOException {
5353
}
5454

5555
public FindDanglingIndexRequest(String indexUUID) {
56-
super(Strings.EMPTY_ARRAY);
56+
super(false, Strings.EMPTY_ARRAY);
5757
this.indexUUID = indexUUID;
5858
}
5959

server/src/main/java/org/opensearch/action/admin/indices/dangling/list/ListDanglingIndicesRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public ListDanglingIndicesRequest(StreamInput in) throws IOException {
5858
}
5959

6060
public ListDanglingIndicesRequest() {
61-
super(Strings.EMPTY_ARRAY);
61+
super(false, Strings.EMPTY_ARRAY);
6262
this.indexUUID = null;
6363
}
6464

6565
public ListDanglingIndicesRequest(String indexUUID) {
66-
super(Strings.EMPTY_ARRAY);
66+
super(false, Strings.EMPTY_ARRAY);
6767
this.indexUUID = indexUUID;
6868
}
6969

server/src/main/java/org/opensearch/action/search/GetAllPitNodesRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class GetAllPitNodesRequest extends BaseNodesRequest<GetAllPitNodesReques
2727

2828
@Inject
2929
public GetAllPitNodesRequest(DiscoveryNode... concreteNodes) {
30-
super(concreteNodes);
30+
super(false, concreteNodes);
3131
}
3232

3333
public GetAllPitNodesRequest(StreamInput in) throws IOException {

server/src/main/java/org/opensearch/action/support/nodes/BaseNodesRequest.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public abstract class BaseNodesRequest<Request extends BaseNodesRequest<Request>
7373
* Setting default behavior as `true` but can be explicitly changed in requests that do not require.
7474
*/
7575
private boolean includeDiscoveryNodes = true;
76+
7677
private final TimeValue DEFAULT_TIMEOUT_SECS = TimeValue.timeValueSeconds(30);
7778

7879
private TimeValue timeout;
@@ -88,11 +89,22 @@ protected BaseNodesRequest(String... nodesIds) {
8889
this.nodesIds = nodesIds;
8990
}
9091

92+
protected BaseNodesRequest(boolean includeDiscoveryNodes, String... nodesIds) {
93+
this.nodesIds = nodesIds;
94+
this.includeDiscoveryNodes = includeDiscoveryNodes;
95+
}
96+
9197
protected BaseNodesRequest(DiscoveryNode... concreteNodes) {
9298
this.nodesIds = null;
9399
this.concreteNodes = concreteNodes;
94100
}
95101

102+
protected BaseNodesRequest(boolean includeDiscoveryNodes, DiscoveryNode... concreteNodes) {
103+
this.nodesIds = null;
104+
this.concreteNodes = concreteNodes;
105+
this.includeDiscoveryNodes = includeDiscoveryNodes;
106+
}
107+
96108
public final String[] nodesIds() {
97109
return nodesIds;
98110
}
@@ -127,10 +139,6 @@ public void setConcreteNodes(DiscoveryNode[] concreteNodes) {
127139
this.concreteNodes = concreteNodes;
128140
}
129141

130-
public void setIncludeDiscoveryNodes(boolean value) {
131-
includeDiscoveryNodes = value;
132-
}
133-
134142
public boolean getIncludeDiscoveryNodes() {
135143
return includeDiscoveryNodes;
136144
}

0 commit comments

Comments
 (0)