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


##########
src/java/org/apache/cassandra/service/accord/AccordConfigurationService.java:
##########
@@ -614,28 +636,32 @@ public static EpochSnapshot notStarted(long epoch)
     }
 
     @VisibleForTesting
-    public synchronized EpochSnapshot getEpochSnapshot(long epoch)
+    public EpochSnapshot getEpochSnapshot(long epoch)
     {
         if (epoch < epochs.minEpoch() || epoch > epochs.maxEpoch())
             return null;
 
-        return new EpochSnapshot(getOrCreateEpochState(epoch));
+        // lock for read visibility to syncStatus
+        synchronized (this)
+        {
+            return new EpochSnapshot(getOrCreateEpochState(epoch));

Review Comment:
   called `getOrCreateEpochState` outside the lock
   
   > What visibility are we looking for her
   
   Most call paths of 
`org.apache.cassandra.service.accord.AccordConfigurationService.EpochState#syncStatus`
 already hold the accord lock, so need this here else it can be stale (unless 
we make it volatile)



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