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


##########
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 personally prefer the separation... we support the following yaml 
`accord.enabled: false`, so we won't create `Topology` when disabled, but if we 
link in TCM we would and would need to also handle that in the 
`ClusterMetadata`?



-- 
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