belliottsmith commented on code in PR #4668:
URL: https://github.com/apache/cassandra/pull/4668#discussion_r2987842085


##########
src/java/org/apache/cassandra/tcm/sequences/Move.java:
##########
@@ -203,6 +214,49 @@ public SequenceState executeNext()
                 try
                 {
                     ClusterMetadata metadata = ClusterMetadata.current();
+                    TopologyManager.RegainingEpochRange regainingEpochRange = 
AccordService.instance().topology().epochAndRangeToBeRetired(AccordService.instance().topology().current(),
 AccordTopology.createAccordTopology(applyTo(metadata).success().metadata));
+                    if (regainingEpochRange != null)
+                    {
+                        Condition condition = newOneTimeCondition();
+
+                        class waitForEpochAndRangeRetirement implements 
TopologyListener
+                        {
+                            final Condition condition;
+                            final long waitingForEpoch;
+                            final Ranges waitingForRange;
+
+                            public waitForEpochAndRangeRetirement(Condition 
condition, long waitingForEpoch, Ranges waitingForRange)
+                            {
+                                this.condition = condition;
+                                this.waitingForEpoch = waitingForEpoch;
+                                this.waitingForRange = waitingForRange;
+                            }
+
+                            @Override
+                            public void onEpochRetired(Ranges ranges, long 
epoch, @Nullable Topology topology)
+                            {
+                                try
+                                {
+                                    if (epoch >= waitingForEpoch && 
AccordService.instance().topology().active().get(waitingForEpoch).retired().containsAll(waitingForRange))

Review Comment:
   I would make `waitingForRange` non-final, and subtract from it the ranges we 
witness that supersede the epoch we're waiting on, so we don't need to 
continually consult global state



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