belliottsmith commented on code in PR #3664:
URL: https://github.com/apache/cassandra/pull/3664#discussion_r1837693442
##########
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:
Technically it has visibility due to the semantics of the
`getOrCreateEpochState` - monitor entry has the semantics of a global read
barrier. But this isn't important to optimise, and it's fine to make 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]