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


##########
src/java/org/apache/cassandra/service/accord/AccordConfigurationService.java:
##########
@@ -293,27 +303,54 @@ synchronized void updateMapping(ClusterMetadata metadata)
 
     private void reportMetadata(ClusterMetadata metadata)
     {
-        Stage.MISC.submit(() -> {
-            synchronized (AccordConfigurationService.this)
+        Stage.MISC.submit(() -> reportMetadataInternal(metadata));
+    }
+
+    synchronized void reportMetadataInternal(ClusterMetadata metadata)
+    {
+        updateMapping(metadata);
+        Topology topology = AccordTopology.createAccordTopology(metadata);
+        if (Invariants.isParanoid())
+        {
+            for (Node.Id node : topology.nodes())
             {
-                updateMapping(metadata);
-                Topology topology = 
AccordTopology.createAccordTopology(metadata);
-                Topology current = isEmpty() ? Topology.EMPTY : 
currentTopology();
-                reportTopology(topology);
-                Sets.SetView<Node.Id> removedNodes = 
Sets.difference(current.nodes(), topology.nodes());
-                if (!removedNodes.isEmpty())
-                    onNodesRemoved(topology.epoch(), removedNodes);
+                if (mapping.mappedEndpointOrNull(node) == null)
+                    throw new IllegalStateException("Epoch " + 
topology.epoch() + " has node " + node + " but mapping does not!");
             }
-        });
+        }
+        Topology current = isEmpty() ? Topology.EMPTY : currentTopology();
+        reportTopology(topology);
+        // for all nodes removed, or pending removal, mark them as removed so 
we don't wait on their replies
+        Sets.SetView<Node.Id> removedNodes = Sets.difference(current.nodes(), 
topology.nodes());
+        if (!removedNodes.isEmpty())
+        {
+            onNodesRemoved(topology.epoch(), removedNodes);
+            for (Node.Id node : removedNodes)

Review Comment:
   add comment that this is a hack...



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