Skip to content

Commit

Permalink
Remove remaining ImmutableOpen maps from shard stores response (#86427)
Browse files Browse the repository at this point in the history
The IndicesShardStoresResponse had ImmutableOpenInt map removed, but its
use accidentally remained in serialization. Thankfully the format for
immutable open maps are interchangable with read java Map. This commit
switches to using the new readImmutableMap to read the store statuses.

relates #86239
  • Loading branch information
rjernst authored May 4, 2022
1 parent 2e74205 commit f049611
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.collect.ImmutableOpenIntMap;
import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
Expand Down Expand Up @@ -241,19 +239,15 @@ public IndicesShardStoresResponse(Map<String, Map<Integer, List<StoreStatus>>> s
}

IndicesShardStoresResponse() {
this(ImmutableOpenMap.of(), Collections.emptyList());
this(Map.of(), Collections.emptyList());
}

public IndicesShardStoresResponse(StreamInput in) throws IOException {
super(in);
storeStatuses = in.readImmutableOpenMap(StreamInput::readString, i -> {
int indexEntries = i.readVInt();
ImmutableOpenIntMap.Builder<List<StoreStatus>> shardEntries = ImmutableOpenIntMap.builder();
for (int shardCount = 0; shardCount < indexEntries; shardCount++) {
shardEntries.put(i.readInt(), i.readList(StoreStatus::new));
}
return shardEntries.build();
});
storeStatuses = in.readImmutableMap(
StreamInput::readString,
i -> i.readImmutableMap(StreamInput::readInt, j -> j.readImmutableList(StoreStatus::new))
);
failures = Collections.unmodifiableList(in.readList(Failure::readFailure));
}

Expand Down

0 comments on commit f049611

Please sign in to comment.