From 23cb615d67bad4bb92187d69479ebe25e730ddf8 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Sat, 14 Aug 2021 20:38:45 +0200 Subject: [PATCH] Fix Deeply Nesting UnmodifableSet Wrappers in UnassignedInfo The linked issue is pretty fringe, but even during normal operation we keep nesting these wrappers a bunch of closes #76490 --- .../java/org/elasticsearch/cluster/routing/UnassignedInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java b/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java index f8e201e1f2361..7ef47eee9e7de 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java @@ -241,7 +241,7 @@ public UnassignedInfo(Reason reason, @Nullable String message, @Nullable Excepti this.failure = failure; this.failedAllocations = failedAllocations; this.lastAllocationStatus = Objects.requireNonNull(lastAllocationStatus); - this.failedNodeIds = Collections.unmodifiableSet(failedNodeIds); + this.failedNodeIds = Set.copyOf(failedNodeIds); assert (failedAllocations > 0) == (reason == Reason.ALLOCATION_FAILED) : "failedAllocations: " + failedAllocations + " for reason " + reason; assert (message == null && failure != null) == false : "provide a message if a failure exception is provided";