Skip to content

Commit c435246

Browse files
Fix Expected Exception Check in BlobstoreCacheService (elastic#63474) (elastic#64134)
The `NodeNotConnectedException` exception can be nested as well in the fairly unlikley case of the disconnect occuring between the connected check and actually sending the request in the transport service. Closes elastic#63233
1 parent bbb515d commit c435246

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/blobstore/cache/BlobStoreCacheService.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,13 @@ public void onFailure(Exception e) {
254254
}
255255

256256
private static boolean isExpectedCacheGetException(Exception e) {
257-
return TransportActions.isShardNotAvailableException(e)
257+
if (TransportActions.isShardNotAvailableException(e)
258258
|| e instanceof ConnectTransportException
259-
|| e instanceof ClusterBlockException
260-
|| ExceptionsHelper.unwrapCause(e) instanceof NodeClosedException;
259+
|| e instanceof ClusterBlockException) {
260+
return true;
261+
}
262+
final Throwable cause = ExceptionsHelper.unwrapCause(e);
263+
return cause instanceof NodeClosedException || cause instanceof ConnectTransportException;
261264
}
262265

263266
public void putAsync(String repository, String name, String path, long offset, BytesReference content, ActionListener<Void> listener) {

0 commit comments

Comments
 (0)