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


##########
src/java/org/apache/cassandra/service/accord/AccordService.java:
##########
@@ -387,10 +412,48 @@ public synchronized void startup()
         if (state != State.INIT)
             return;
         journal.start(node);
-        configService.start();
+        ClusterMetadataService cms = ClusterMetadataService.instance();
+        class Ref { List<ClusterMetadata> historic = Collections.emptyList();}
+        Ref ref = new Ref();
+        configService.start((optMaxEpoch -> {
+            // when max epoch isn't know, this means the node started for the 
first time; check cluster's min epoch
+            // when max epoch is known, then there is no reason to discover 
min epoch (we already did it)
+            if (optMaxEpoch.isPresent()) return;
+            List<ClusterMetadata> historic = ref.historic = 
discoverHistoric(node, cms);
+            for (ClusterMetadata m : historic)
+                configService.reportMetadataInternal(m);
+        }));
+        ClusterMetadata current = cms.metadata();
+        if (!ref.historic.isEmpty())
+        {
+            List<ClusterMetadata> historic = ref.historic;
+            long lastHistoric = ref.historic.get(historic.size() - 
1).epoch.getEpoch();
+            // new epochs added while loading... load the deltas
+            for (ClusterMetadata metadata : 
ClusterMetadataService.instance().processor().reconstructFull(Epoch.create(lastHistoric
 + 1), Epoch.create(current.epoch.getEpoch() - 1)))
+            {
+                historic.add(metadata);
+                configService.reportMetadataInternal(metadata);
+            }

Review Comment:
   this might be a bug, we already are listening and new epochs would have 
us... so my parania to block bugs maybe added a bug.



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