From d61477f64d367681666ef2e2e309f518656811d2 Mon Sep 17 00:00:00 2001 From: Aman Khare Date: Mon, 8 Apr 2024 14:00:52 +0530 Subject: [PATCH] Save non empty response in else condition Signed-off-by: Aman Khare --- .../main/java/org/opensearch/gateway/AsyncShardBatchFetch.java | 3 ++- .../src/main/java/org/opensearch/gateway/AsyncShardFetch.java | 2 +- .../gateway/TransportNodesListGatewayStartedShardsBatch.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/opensearch/gateway/AsyncShardBatchFetch.java b/server/src/main/java/org/opensearch/gateway/AsyncShardBatchFetch.java index 41cf0da434c4c..8a292e0925686 100644 --- a/server/src/main/java/org/opensearch/gateway/AsyncShardBatchFetch.java +++ b/server/src/main/java/org/opensearch/gateway/AsyncShardBatchFetch.java @@ -228,8 +228,9 @@ private void fillShardData(Map shardDataFromNode, Map, N protected final String type; protected final Map shardAttributesMap; private final Lister, T> action; - protected AsyncShardFetchCache cache; + protected final AsyncShardFetchCache cache; private final AtomicLong round = new AtomicLong(); private boolean closed; final String reroutingKey; diff --git a/server/src/main/java/org/opensearch/gateway/TransportNodesListGatewayStartedShardsBatch.java b/server/src/main/java/org/opensearch/gateway/TransportNodesListGatewayStartedShardsBatch.java index 9886e8472422c..89362988b4d85 100644 --- a/server/src/main/java/org/opensearch/gateway/TransportNodesListGatewayStartedShardsBatch.java +++ b/server/src/main/java/org/opensearch/gateway/TransportNodesListGatewayStartedShardsBatch.java @@ -156,7 +156,7 @@ protected NodeGatewayStartedShardsBatch nodeOperation(NodeRequest request) { ); } catch (Exception e) { // should return null in case of known exceptions being returned from getShardInfoOnLocalNode method. - if (e instanceof IllegalStateException || e.getMessage().contains(INDEX_NOT_FOUND)) { + if (e instanceof IllegalStateException || e.getMessage().contains(INDEX_NOT_FOUND) || e instanceof IOException) { shardsOnNode.put(shardId, null); } else { // return actual exception as it is for unknown exceptions