aweisberg commented on code in PR #91:
URL: https://github.com/apache/cassandra-accord/pull/91#discussion_r1608690681
##########
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:
If you have a table that isn't written to frequently won't it only take
minutes for everything to be truncated so there are empty deps? I was just
thinking of making repair a little faster, but yeah I could see that the usage
is infrequent enough we don't even really care.
I reduced constructor visibility to go with the `==` but yeah I'll make it a
method.
--
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]