aweisberg commented on code in PR #50:
URL: https://github.com/apache/cassandra-accord/pull/50#discussion_r1280964632
##########
accord-core/src/main/java/accord/local/CommandStores.java:
##########
@@ -87,44 +88,30 @@ private static class StoreSupplier
this.shardFactory = shardFactory;
}
- CommandStore create(int id, RangesForEpochHolder rangesForEpoch)
+ CommandStore create(int id, EpochUpdateHolder rangesForEpoch)
{
return shardFactory.create(id, time, agent, this.store,
progressLogFactory, rangesForEpoch);
}
}
- public static class RangesForEpochHolder
- {
- // no need for safe publication; RangesForEpoch members are final, and
will be guarded by other synchronization actions
- protected RangesForEpoch current;
-
- /**
- * This is updated asynchronously, so should only be fetched between
executing tasks;
- * otherwise the contents may differ between invocations for the same
task.
- * @return the current RangesForEpoch
- */
- public RangesForEpoch get() { return current; }
- }
-
static class ShardHolder
{
final CommandStore store;
- final RangesForEpochHolder ranges;
+ RangesForEpoch ranges;
Review Comment:
The concern is that the values may not be current not that they will be
invalid (since `RangesForEpoch` is all final fields)?
While the values can be a little stale there is a synchronizing action I
believe in the form of the volatile read of the `current` field which does
updated every time we also update a `RangesForEpoch`.
I believe that might be a sufficient, but we are getting into the fancier
stuff.
So what might happen is not so much that you read a stale value, but for a
given `Shard` you could end up reading a newer value than matches the rest of
the `Snapshot`.
--
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]