Skip to content

Commit 61e5c83

Browse files
anuragrai16atris
authored andcommitted
IllegalArgumentException when scroll ID has a node no longer part of the Cluster (opensearch-project#19031)
--------- Signed-off-by: Anurag Rai <anurag.rai@uber.com> Signed-off-by: Anurag Rai <91844619+anuragrai16@users.noreply.github.com>
1 parent 2fab9f6 commit 61e5c83

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1212

1313
### Changed
1414
- Add CompletionStage variants to methods in the Client Interface and default to ActionListener impl ([#18998](https://github.com/opensearch-project/OpenSearch/pull/18998))
15+
- IllegalArgumentException when scroll ID references a node not found in Cluster ([#19031](https://github.com/opensearch-project/OpenSearch/pull/19031))
1516

1617
### Fixed
1718
- Fix unnecessary refreshes on update preparation failures ([#15261](https://github.com/opensearch-project/OpenSearch/issues/15261))

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ private void run(BiFunction<String, String, DiscoveryNode> clusterNodeLookup, fi
159159
try {
160160
DiscoveryNode node = clusterNodeLookup.apply(target.getClusterAlias(), target.getNode());
161161
if (node == null) {
162-
throw new IllegalStateException("node [" + target.getNode() + "] is not available");
162+
throw new IllegalArgumentException(
163+
"scroll_id references node [" + target.getNode() + "] which was not found in the cluster"
164+
);
163165
}
164166
connection = getConnection(target.getClusterAlias(), node);
165167
} catch (Exception ex) {

server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ protected void onFirstPhaseResult(int shardId, SearchAsyncActionTests.TestSearch
298298
latch.await();
299299
ShardSearchFailure[] shardSearchFailures = action.buildShardFailures();
300300
assertEquals(1, shardSearchFailures.length);
301-
assertEquals("IllegalStateException[node [node2] is not available]", shardSearchFailures[0].reason());
301+
assertEquals(
302+
"IllegalArgumentException[scroll_id references node [node2] which was not found in the cluster]",
303+
shardSearchFailures[0].reason()
304+
);
302305

303306
SearchContextIdForNode[] context = scrollId.getContext();
304307
for (int i = 0; i < results.length(); i++) {

0 commit comments

Comments
 (0)