From ecc503756577b0ea0c5eb9b98bbb79f51398c5c8 Mon Sep 17 00:00:00 2001 From: Anurag Rai Date: Tue, 12 Aug 2025 19:56:47 +0530 Subject: [PATCH 1/6] return IllegalArgumentException when scroll ID has a node no longer part of the cluster Signed-off-by: Anurag Rai --- .../org/opensearch/action/search/SearchScrollAsyncAction.java | 2 +- .../opensearch/action/search/SearchScrollAsyncActionTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java b/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java index 7329a03f7e281..da8e6a586e260 100644 --- a/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java +++ b/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java @@ -159,7 +159,7 @@ private void run(BiFunction clusterNodeLookup, fi try { DiscoveryNode node = clusterNodeLookup.apply(target.getClusterAlias(), target.getNode()); if (node == null) { - throw new IllegalStateException("node [" + target.getNode() + "] is not available"); + throw new IllegalArgumentException("scroll ID points to a node [" + target.getNode() + "] no longer available"); } connection = getConnection(target.getClusterAlias(), node); } catch (Exception ex) { diff --git a/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java b/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java index 3653f05936cf1..491573ada60e1 100644 --- a/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java +++ b/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java @@ -298,7 +298,7 @@ protected void onFirstPhaseResult(int shardId, SearchAsyncActionTests.TestSearch latch.await(); ShardSearchFailure[] shardSearchFailures = action.buildShardFailures(); assertEquals(1, shardSearchFailures.length); - assertEquals("IllegalStateException[node [node2] is not available]", shardSearchFailures[0].reason()); + assertEquals("IllegalArgumentException[scroll ID points to a node [node2] no longer available]", shardSearchFailures[0].reason()); SearchContextIdForNode[] context = scrollId.getContext(); for (int i = 0; i < results.length(); i++) { From 272f9284e57aedd4decd2b90e659f01296d8c09d Mon Sep 17 00:00:00 2001 From: Anurag Rai Date: Tue, 12 Aug 2025 20:06:51 +0530 Subject: [PATCH 2/6] changelog Signed-off-by: Anurag Rai --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f44c1d9e7354..5d661d3b822c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Add temporal routing processors for time-based document routing ([#18920](https://github.com/opensearch-project/OpenSearch/issues/18920)) ### Changed +- IllegalArgumentException when scroll ID has a node no longer part of the Cluster ([#19031](https://github.com/opensearch-project/OpenSearch/pull/19031)) ### Fixed - Fix unnecessary refreshes on update preparation failures ([#15261](https://github.com/opensearch-project/OpenSearch/issues/15261)) From 40d41949464044a645a40e8fcd3df28bd654a692 Mon Sep 17 00:00:00 2001 From: Anurag Rai Date: Wed, 13 Aug 2025 09:22:13 +0530 Subject: [PATCH 3/6] fix exception wording Signed-off-by: Anurag Rai --- .../org/opensearch/action/search/SearchScrollAsyncAction.java | 2 +- .../opensearch/action/search/SearchScrollAsyncActionTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java b/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java index da8e6a586e260..040bbbf205b14 100644 --- a/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java +++ b/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java @@ -159,7 +159,7 @@ private void run(BiFunction clusterNodeLookup, fi try { DiscoveryNode node = clusterNodeLookup.apply(target.getClusterAlias(), target.getNode()); if (node == null) { - throw new IllegalArgumentException("scroll ID points to a node [" + target.getNode() + "] no longer available"); + throw new IllegalArgumentException("scroll_id references node [" + target.getNode() + "] which was not found in the cluster"); } connection = getConnection(target.getClusterAlias(), node); } catch (Exception ex) { diff --git a/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java b/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java index 491573ada60e1..4c20f5b9f32e4 100644 --- a/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java +++ b/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java @@ -298,7 +298,7 @@ protected void onFirstPhaseResult(int shardId, SearchAsyncActionTests.TestSearch latch.await(); ShardSearchFailure[] shardSearchFailures = action.buildShardFailures(); assertEquals(1, shardSearchFailures.length); - assertEquals("IllegalArgumentException[scroll ID points to a node [node2] no longer available]", shardSearchFailures[0].reason()); + assertEquals("IllegalArgumentException[scroll_id references node [node2] which was not found in the cluster]", shardSearchFailures[0].reason()); SearchContextIdForNode[] context = scrollId.getContext(); for (int i = 0; i < results.length(); i++) { From 2ea1b67a22d5c9115fca2b222d56896c036415de Mon Sep 17 00:00:00 2001 From: Anurag Rai Date: Wed, 13 Aug 2025 11:50:54 +0530 Subject: [PATCH 4/6] spotless Signed-off-by: Anurag Rai --- .../opensearch/action/search/SearchScrollAsyncAction.java | 4 +++- .../action/search/SearchScrollAsyncActionTests.java | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java b/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java index 040bbbf205b14..b974fa839fcd4 100644 --- a/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java +++ b/server/src/main/java/org/opensearch/action/search/SearchScrollAsyncAction.java @@ -159,7 +159,9 @@ private void run(BiFunction clusterNodeLookup, fi try { DiscoveryNode node = clusterNodeLookup.apply(target.getClusterAlias(), target.getNode()); if (node == null) { - throw new IllegalArgumentException("scroll_id references node [" + target.getNode() + "] which was not found in the cluster"); + throw new IllegalArgumentException( + "scroll_id references node [" + target.getNode() + "] which was not found in the cluster" + ); } connection = getConnection(target.getClusterAlias(), node); } catch (Exception ex) { diff --git a/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java b/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java index 4c20f5b9f32e4..12ab735c4d324 100644 --- a/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java +++ b/server/src/test/java/org/opensearch/action/search/SearchScrollAsyncActionTests.java @@ -298,7 +298,10 @@ protected void onFirstPhaseResult(int shardId, SearchAsyncActionTests.TestSearch latch.await(); ShardSearchFailure[] shardSearchFailures = action.buildShardFailures(); assertEquals(1, shardSearchFailures.length); - assertEquals("IllegalArgumentException[scroll_id references node [node2] which was not found in the cluster]", shardSearchFailures[0].reason()); + assertEquals( + "IllegalArgumentException[scroll_id references node [node2] which was not found in the cluster]", + shardSearchFailures[0].reason() + ); SearchContextIdForNode[] context = scrollId.getContext(); for (int i = 0; i < results.length(); i++) { From fb1c91b98dae2d364230c6de7ff59bd9b2861363 Mon Sep 17 00:00:00 2001 From: Anurag Rai Date: Wed, 13 Aug 2025 23:42:04 +0530 Subject: [PATCH 5/6] fix changelog wording Signed-off-by: Anurag Rai --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c58b4b6b5a7e5..402c4905d1ba0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed - Add CompletionStage variants to methods in the Client Interface and default to ActionListener impl ([#18998](https://github.com/opensearch-project/OpenSearch/pull/18998)) - IllegalArgumentException when scroll ID has a node no longer part of the Cluster ([#19031](https://github.com/opensearch-project/OpenSearch/pull/19031)) +- IllegalArgumentException when scroll ID references a node not found in Cluster ([#19031](https://github.com/opensearch-project/OpenSearch/pull/19031)) ### Fixed - Fix unnecessary refreshes on update preparation failures ([#15261](https://github.com/opensearch-project/OpenSearch/issues/15261)) From 45c6f765e2e266ba1df3b9d1a30b7fc3b1044fa7 Mon Sep 17 00:00:00 2001 From: Anurag Rai Date: Wed, 13 Aug 2025 23:43:17 +0530 Subject: [PATCH 6/6] fix changelog wording Signed-off-by: Anurag Rai --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 402c4905d1ba0..3b0bf6d0df5f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed - Add CompletionStage variants to methods in the Client Interface and default to ActionListener impl ([#18998](https://github.com/opensearch-project/OpenSearch/pull/18998)) -- IllegalArgumentException when scroll ID has a node no longer part of the Cluster ([#19031](https://github.com/opensearch-project/OpenSearch/pull/19031)) - IllegalArgumentException when scroll ID references a node not found in Cluster ([#19031](https://github.com/opensearch-project/OpenSearch/pull/19031)) ### Fixed