dcapwell commented on code in PR #65:
URL: https://github.com/apache/cassandra-accord/pull/65#discussion_r1323351402


##########
accord-core/src/main/java/accord/impl/InMemoryCommandStore.java:
##########
@@ -92,6 +94,11 @@ public abstract class InMemoryCommandStore extends 
CommandStore
 
     private final TreeMap<TxnId, RangeCommand> rangeCommands = new TreeMap<>();
     private final TreeMap<TxnId, Ranges> historicalRangeCommands = new 
TreeMap<>();
+    /**
+     * Since this cache is fully in-memory the store does not hit states that 
most stores will; that data is not in-memory!
+     * To simulate such behaviors, a "cache" is used to state what is 
in-memory vs what needs to be loaded.
+     */
+    private final Set<Object> cache = new LinkedHashSet<>();

Review Comment:
   We have a lot of places that try to access data outside of the 
`PreLoadContext` and acts on the global cache.
   
   `accord.impl.InMemoryCommandStore#ifPresent(accord.primitives.TxnId)`
   
`accord.impl.InMemoryCommandStore.InMemorySafeStore#getIfLoaded(accord.primitives.TxnId)`
   `accord.impl.AbstractSafeCommandStore#getInternalIfLoadedAndInitialised`
   `accord.local.SafeCommandStore#ifLoadedAndInitialised`
   `accord.local.Commands.NotifyWaitingOn#accept`
   
   ```
   SafeCommand curSafe = ifLoadedAndInitialised(safeStore, depth);
                   Command cur = curSafe != null ? curSafe.current() : null;
                   if (cur == null)
                   {
                       // need to load; schedule execution for later
                       safeStore.commandStore().execute(this, 
this).begin(safeStore.agent());
                       return;
                   }
   ```
   
   Cases like this would be 100% cache hit in BurnTest, so the non-cache hit 
case was never tested.
   
   



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