From 7d9b899fa139053134057cca7d18be741bb36b01 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Sat, 27 Jul 2024 15:06:51 +0300 Subject: [PATCH] Fixed - empty partitions shouldn't be skipped in cluster topology scan. #6061 --- .../redisson/cluster/ClusterConnectionManager.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/redisson/src/main/java/org/redisson/cluster/ClusterConnectionManager.java b/redisson/src/main/java/org/redisson/cluster/ClusterConnectionManager.java index 6e3ad573e..a3d87f03f 100644 --- a/redisson/src/main/java/org/redisson/cluster/ClusterConnectionManager.java +++ b/redisson/src/main/java/org/redisson/cluster/ClusterConnectionManager.java @@ -503,7 +503,8 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager { .thenCompose(newPartitions -> checkSlaveNodesChange(newPartitions)) .thenCompose(r -> newPartitionsFuture) .whenComplete((newPartitions, ex) -> { - if (newPartitions != null) { + if (newPartitions != null + && !newPartitions.isEmpty()) { try { checkSlotsMigration(newPartitions); checkSlotsChange(newPartitions); @@ -755,16 +756,16 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager { // https://github.com/redisson/redisson/issues/3635 Map 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(), p -> getEntry(p.getSlotRanges().iterator().next().getStartSlot()))); Set changedSlots = new HashSet<>(); for (ClusterPartition currentPartition : clusterLastPartitions) { String nodeId = currentPartition.getNodeId(); - if (!nodeEntries.containsKey(nodeId)) { - continue; - } +// if (!nodeEntries.containsKey(nodeId)) { +// continue; +// } for (ClusterPartition newPartition : newPartitions) { if (!Objects.equals(nodeId, newPartition.getNodeId())