belliottsmith commented on code in PR #91:
URL: https://github.com/apache/cassandra-accord/pull/91#discussion_r1608692927
##########
accord-core/src/main/java/accord/coordinate/CoordinationAdapter.java:
##########
@@ -261,21 +260,50 @@ public void execute(Node node, Topologies all,
FullRoute<?> route, ExecutePath p
}
}
- public static class InclusiveSyncPointAdapter<S extends Seekables<?,
?>> extends AbstractSyncPointAdapter<S>
+ private static class AbstractInclusiveSyncPointAdapter<S extends
Seekables<?, ?>> extends AbstractSyncPointAdapter<S>
{
- private static final InclusiveSyncPointAdapter INSTANCE = new
InclusiveSyncPointAdapter();
- }
- public static class InclusiveSyncPointBlockingAdapter<S extends
Seekables<?, ?>> extends AbstractSyncPointAdapter<S>
- {
- private static final InclusiveSyncPointBlockingAdapter INSTANCE =
new InclusiveSyncPointBlockingAdapter();
+ protected AbstractInclusiveSyncPointAdapter()
+ {
+ super();
+ }
@Override
public void execute(Node node, Topologies all, FullRoute<?> route,
ExecutePath path, TxnId txnId, Txn txn, Timestamp executeAt, Deps deps,
BiConsumer<? super SyncPoint<S>, Throwable> callback)
{
ExecuteBlocking<S> execute = ExecuteBlocking.atQuorum(node,
all, new SyncPoint<>(txnId, deps, (S)txn.keys(), route), executeAt);
- execute.addCallback(callback);
execute.start();
+ // If there are no deps to wait on then everything is already
applied
+ // If this is the async adapter then we want to invoke the
callback immediately
+ // and the caller can wait on the txn locally if they want
+ if (deps.isEmpty() || this ==
AsyncInclusiveSyncPointAdapter.INSTANCE)
Review Comment:
It's never empty, it will always have some exclusive sync point that
represents the point in time of truncation to ensure no stale replica serves
the request.
Perhaps we can issue entirely empty deps if we know no such replica exists,
but I am not sure it is a sensible optimisation given the potential additional
surface area for bugs.
--
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]