Fixed - ClusterConnectionManager.checkSlotsMigration() method throws NPE #6048

pull/6077/head
Nikita Koksharov 8 months ago
parent 0ea8764858
commit 10c1d6165b

@ -754,12 +754,18 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
Collection<ClusterPartition> clusterLastPartitions = getLastPartitions();
// https://github.com/redisson/redisson/issues/3635
Map<String, MasterSlaveEntry> nodeEntries = clusterLastPartitions.stream().collect(Collectors.toMap(p -> p.getNodeId(),
Map<String, MasterSlaveEntry> nodeEntries = clusterLastPartitions.stream()
.filter(e -> getEntry(e.getSlotRanges().iterator().next().getStartSlot()) != null)
.collect(Collectors.toMap(p -> p.getNodeId(),
p -> getEntry(p.getSlotRanges().iterator().next().getStartSlot())));
Set<Integer> changedSlots = new HashSet<>();
for (ClusterPartition currentPartition : clusterLastPartitions) {
String nodeId = currentPartition.getNodeId();
if (!nodeEntries.containsKey(nodeId)) {
continue;
}
for (ClusterPartition newPartition : newPartitions) {
if (!Objects.equals(nodeId, newPartition.getNodeId())
|| newPartition.getSlotRanges().equals(currentPartition.getSlotRanges())) {

Loading…
Cancel
Save