Fixed - empty partitions shouldn't be skipped in cluster topology scan. #6061

pull/6077/head
Nikita Koksharov 7 months ago
parent 10c1d6165b
commit 7d9b899fa1

@ -503,7 +503,8 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
.thenCompose(newPartitions -> checkSlaveNodesChange(newPartitions)) .thenCompose(newPartitions -> checkSlaveNodesChange(newPartitions))
.thenCompose(r -> newPartitionsFuture) .thenCompose(r -> newPartitionsFuture)
.whenComplete((newPartitions, ex) -> { .whenComplete((newPartitions, ex) -> {
if (newPartitions != null) { if (newPartitions != null
&& !newPartitions.isEmpty()) {
try { try {
checkSlotsMigration(newPartitions); checkSlotsMigration(newPartitions);
checkSlotsChange(newPartitions); checkSlotsChange(newPartitions);
@ -755,16 +756,16 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
// https://github.com/redisson/redisson/issues/3635 // https://github.com/redisson/redisson/issues/3635
Map<String, MasterSlaveEntry> nodeEntries = clusterLastPartitions.stream() Map<String, MasterSlaveEntry> nodeEntries = clusterLastPartitions.stream()
.filter(e -> getEntry(e.getSlotRanges().iterator().next().getStartSlot()) != null) // .filter(e -> getEntry(e.getSlotRanges().iterator().next().getStartSlot()) != null)
.collect(Collectors.toMap(p -> p.getNodeId(), .collect(Collectors.toMap(p -> p.getNodeId(),
p -> getEntry(p.getSlotRanges().iterator().next().getStartSlot()))); p -> getEntry(p.getSlotRanges().iterator().next().getStartSlot())));
Set<Integer> changedSlots = new HashSet<>(); Set<Integer> changedSlots = new HashSet<>();
for (ClusterPartition currentPartition : clusterLastPartitions) { for (ClusterPartition currentPartition : clusterLastPartitions) {
String nodeId = currentPartition.getNodeId(); String nodeId = currentPartition.getNodeId();
if (!nodeEntries.containsKey(nodeId)) { // if (!nodeEntries.containsKey(nodeId)) {
continue; // continue;
} // }
for (ClusterPartition newPartition : newPartitions) { for (ClusterPartition newPartition : newPartitions) {
if (!Objects.equals(nodeId, newPartition.getNodeId()) if (!Objects.equals(nodeId, newPartition.getNodeId())

Loading…
Cancel
Save