belliottsmith commented on code in PR #1951:
URL: https://github.com/apache/cassandra/pull/1951#discussion_r1014512548
##########
src/java/org/apache/cassandra/service/accord/AccordCommand.java:
##########
@@ -633,40 +652,42 @@ private Future<Void> applyWithCorrectScope()
return promise;
}
- private Future<Void> apply(boolean canReschedule)
+ private Future<Void> apply(SafeCommandStore safeStore, boolean
canReschedule)
{
- Future<Void> future = cache().getWriteFuture(txnId);
+ AccordStateCache.Instance<TxnId, AccordCommand> cache =
((AccordCommandStore) safeStore).commandCache();
+ Future<Void> future = cache.getWriteFuture(txnId);
if (future != null)
return future;
// this can be called via a listener callback, in which case we won't
// have the appropriate commandsForKey in scope, so start a new
operation
// with the correct scope and notify the caller when that completes
- if (!canApplyWithCurrentScope())
+ if (!canApplyWithCurrentScope(safeStore))
{
Preconditions.checkArgument(canReschedule);
- return applyWithCorrectScope();
+ return applyWithCorrectScope(safeStore.commandStore());
}
- future = super.apply();
- cache().setWriteFuture(txnId, future);
+ future = super.apply(safeStore);
+ cache.setWriteFuture(txnId, future);
return future;
}
@Override
- public Future<Void> apply()
+ public Future<Void> apply(SafeCommandStore safeStore)
{
- return apply(true);
+ return apply(safeStore, true);
}
@Override
- public Future<Data> read(Keys scope)
+ public Future<Data> read(SafeCommandStore safeStore)
{
- ReadFuture future = cache().getReadFuture(txnId);
+ AccordStateCache.Instance<TxnId, AccordCommand> cache =
((AccordCommandStore) safeStore).commandCache();
+ Future<Data> future = cache.getReadFuture(txnId);
if (future != null)
- return future.scope.equals(scope) ? future : super.read(scope);
- future = new ReadFuture(scope, super.read(scope));
- cache().setReadFuture(txnId, future);
+ return future;
Review Comment:
We always read the same scope, so I don't believe the check was ever
necessary. However, this is more explicit now, as we read only the transactions
associated with the transaction on disk for this store.
--
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]