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


##########
src/java/org/apache/cassandra/service/accord/AccordService.java:
##########
@@ -379,25 +373,48 @@ public synchronized void startup()
         node.commandStores().restoreShardStateUnsafe(topology -> 
configService.reportTopology(topology, true, true));
         configService.start();
 
-        long minEpoch = fetchMinEpoch();
-        if (minEpoch >= 0)
+        try
         {
-            for (long epoch = minEpoch; epoch <= metadata.epoch.getEpoch(); 
epoch++)
-                node.configService().fetchTopologyForEpoch(epoch);
+            // Fetch topologies up to current
+            List<Topology> topologies = fetchTopologies(null, metadata);
+            for (Topology topology : topologies)
+                configService.reportTopology(topology);
 
-            try
-            {
-                
epochReady(metadata.epoch).get(DatabaseDescriptor.getTransactionTimeout(MILLISECONDS),
 MILLISECONDS);
-            }
-            catch (InterruptedException e)
+            
ClusterMetadataService.instance().log().addListener(configService.listener);
+            ClusterMetadata next = ClusterMetadata.current();
+
+            // if metadata was updated before we were able to add a listener, 
fetch remaining topologies
+            if (next.epoch.isAfter(metadata.epoch))
             {
-                throw new UncheckedInterruptedException(e);
+                topologies = fetchTopologies(metadata.epoch.getEpoch() + 1, 
next);
+                for (Topology topology : topologies)
+                    configService.reportTopology(topology);
             }
-            catch (ExecutionException | TimeoutException e)
+
+            int attempt = 0;
+            int waitSeconds = 5;
+            while (true)
             {
-                throw new RuntimeException(e);
+                try
+                {
+                    epochReady(metadata.epoch).get(5, SECONDS);

Review Comment:
   ```suggestion
                       epochReady(metadata.epoch).get(waitSeconds, SECONDS);
   ```



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to