dcapwell commented on code in PR #38:
URL: https://github.com/apache/cassandra-accord/pull/38#discussion_r1176987996
##########
accord-core/src/main/java/accord/local/CommandStores.java:
##########
@@ -65,19 +67,23 @@ CommandStores<?> create(NodeTimeService time,
private final DataStore store;
private final ProgressLog.Factory progressLogFactory;
private final CommandStore.Factory shardFactory;
+ private final RandomSource random;
- Supplier(NodeTimeService time, Agent agent, DataStore store,
ProgressLog.Factory progressLogFactory, CommandStore.Factory shardFactory)
+ Supplier(NodeTimeService time, Agent agent, DataStore store,
RandomSource random, ProgressLog.Factory progressLogFactory,
CommandStore.Factory shardFactory)
{
this.time = time;
this.agent = agent;
this.store = store;
+ this.random = random;
this.progressLogFactory = progressLogFactory;
this.shardFactory = shardFactory;
}
CommandStore create(int id, RangesForEpochHolder rangesForEpoch)
{
- return shardFactory.create(id, time, agent, store,
progressLogFactory, rangesForEpoch);
+ CommandStore store = shardFactory.create(id, time, agent,
this.store, progressLogFactory, rangesForEpoch);
+ store.execute(() -> CommandStore.register(store));
Review Comment:
it could be, but then causes duplication of logic. As executors are
expected to be ordered, this makes sure that the first action is to register
and we avoid having to handle in each store uniquely
The `Synchronized` has to redo all this logic as the register makes no sense
in that case, rest are all thread based so avoids duplication.
Now, if we have `AccordCommandStore` extend `SingleThread` this would lower
the amount of duplication as there are only 2 real implementations in this
case... I don't remember why those classes were split.
--
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]