Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remaining ImmutableOpen maps from shard stores response #86427

Merged
merged 3 commits into from
May 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.readList(StoreStatus::new))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to have a method to read immutable list as well if possible

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #86433

);
failures = Collections.unmodifiableList(in.readList(Failure::readFailure));
}

Expand Down