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


##########
src/java/org/apache/cassandra/service/accord/AccordConfigurationService.java:
##########
@@ -407,7 +407,11 @@ void maybeReportMetadata(ClusterMetadata metadata)
         long epoch = metadata.epoch.getEpoch();
         synchronized (epochs)
         {
-            if (epochs.maxEpoch() == 0)
+            long maxEpoch = epochs.maxEpoch();
+            if (maxEpoch >= epoch)

Review Comment:
   Good point.
   
   I think this was also an edge-case. If I remember it correctly: if you're a 
second node to be brought up, querying other nodes for min epochs will yield 
epoch 4, which you will instantiate with a fetched topology.
   
   But then if you race with a TCM callback, you will create  epoch - 1 epoch, 
which no-one has ever heard about.
   I should have fixed it differently, maybe this way:
   
   ```
           // Create a -1 epoch iif we know this epoch may actually exist
           if (metadata.epoch.getEpoch() > minEpoch())
               getOrCreateEpochState(epoch - 1).acknowledged().addCallback(() 
-> reportMetadata(metadata));
   ```



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