dcapwell commented on code in PR #3416:
URL: https://github.com/apache/cassandra/pull/3416#discussion_r1674899322


##########
src/java/org/apache/cassandra/service/accord/AccordTopology.java:
##########
@@ -134,22 +138,34 @@ private static KeyspaceShard forRange(KeyspaceMetadata 
keyspace, Range<Token> ra
                                                  .map(directory::peerId)
                                                  
.map(AccordTopology::tcmIdToAccord)
                                                  .collect(Collectors.toSet());
+            Set<Node.Id> leaving = allLeaving.isEmpty() ?
+                                   Collections.emptySet() :
+                                   allLeaving.stream()
+                                             .filter(e -> 
writeEndpoints.contains(e))
+                                             .map(directory::peerId)
+                                             
.map(AccordTopology::tcmIdToAccord)
+                                             .collect(Collectors.toSet());
 
-            return new KeyspaceShard(keyspace, range, nodes, pending);
+            return new KeyspaceShard(keyspace, range, nodes, pending, leaving);
         }
 
-        public static List<KeyspaceShard> forKeyspace(KeyspaceMetadata 
keyspace, DataPlacements placements, Directory directory, ShardLookup lookup)
+        public static List<KeyspaceShard> forKeyspace(KeyspaceMetadata 
keyspace,
+                                                      
Function<KeyspaceMetadata, DataPlacement> placements,
+                                                      
Function<KeyspaceMetadata, DataPlacement> settledPlacements,
+                                                      Directory directory, 
ShardLookup lookup)
         {
-            ReplicationParams replication = keyspace.params.replication;
-            DataPlacement placement = placements.get(replication);
+//            ReplicationParams replication = keyspace.params.replication;
+            DataPlacement placement = placements.apply(keyspace);
+            DataPlacement settled = settledPlacements.apply(keyspace);
+            Set<InetAddressAndPort> leaving = 
Sets.difference(placement.writes.byEndpoint().keySet(), 
settled.writes.byEndpoint().keySet());

Review Comment:
   I should cleanup this logic, we are already using the `KeyspaceMetadata` so 
we really don't need functions, we can just pass in the 2



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to