belliottsmith commented on code in PR #3432:
URL: https://github.com/apache/cassandra/pull/3432#discussion_r1693585807
##########
src/java/org/apache/cassandra/service/accord/async/AsyncOperation.java:
##########
@@ -301,6 +300,13 @@ public void start(BiConsumer<? super R, Throwable>
callback)
{
Invariants.checkState(this.callback == null);
this.callback = callback;
+ if (commandStore.inStore())
Review Comment:
This was a necessary change to ensure the `CommandsForKey` pruned key
loading works as intended - we don't intend to ever write to disk if we are
fetching data from disk to update the `CommandsForKey`, so this change permits
us to immediately take a reference to the data we will use, preventing it from
being evicted before we first run and despatch any reads. It has the advantage
of also being much more efficient, avoiding a whole additional queue delay and
additional work saving and loading.
The logic is different to running however - we do not want to `run` because
we haven't finished running the `AsyncOperation` we're already executing, and
stopping part way to run another `AsyncOperation` (if everything is already
loaded) is not only tricky book-keeping wise, but also logically confusing for
the caller that expects this to run after the current operation completes.
--
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]