dcapwell commented on code in PR #57:
URL: https://github.com/apache/cassandra-accord/pull/57#discussion_r1302234206
##########
accord-core/src/test/java/accord/impl/list/ListRequest.java:
##########
@@ -110,49 +122,84 @@ public void accept(Result success, Throwable fail)
// TODO (desired, testing): error handling
if (success != null)
{
+ ((NodeSink) node.messageSink()).debugClient(id, success,
NodeSink.ClientAction.SUCCESS);
node.reply(client, replyContext, (ListResult) success);
}
else if (fail instanceof CoordinationFailed)
{
+ ((NodeSink) node.messageSink()).debugClient(id, fail,
NodeSink.ClientAction.FAILURE);
RoutingKey homeKey = ((CoordinationFailed) fail).homeKey();
TxnId txnId = ((CoordinationFailed) fail).txnId();
if (fail instanceof Invalidated)
{
- node.reply(client, replyContext, new ListResult(client,
((Packet) replyContext).requestId, txnId, null, null, null, null));
+ node.reply(client, replyContext,
ListResult.invalidated(client, ((Packet)replyContext).requestId, txnId));
return;
}
- node.reply(client, replyContext, new ListResult(client,
((Packet)replyContext).requestId, txnId, null, null, new int[0][], null));
- ((Cluster)node.scheduler()).onDone(() -> {
- node.commandStores()
- .select(homeKey)
- .execute(() -> CheckOnResult.checkOnResult(node,
txnId, homeKey, (s, f) -> {
- if (f != null)
- {
- node.reply(client, replyContext, new
ListResult(client, ((Packet) replyContext).requestId, txnId, null, null, f
instanceof Truncated ? new int[2][] : new int[3][], null));
- return;
- }
- switch (s)
- {
- case Truncated:
- node.reply(client, replyContext, new
ListResult(client, ((Packet) replyContext).requestId, txnId, null, null, new
int[2][], null));
- break;
- case Invalidated:
- node.reply(client, replyContext, new
ListResult(client, ((Packet) replyContext).requestId, txnId, null, null, null,
null));
- break;
- case Lost:
- node.reply(client, replyContext, new
ListResult(client, ((Packet) replyContext).requestId, txnId, null, null, new
int[1][], null));
- break;
- case Other:
- // currently caught elsewhere in response
tracking, but might help to throw an exception here
- }
- }));
- });
+ node.reply(client, replyContext, ListResult.heartBeat(client,
((Packet)replyContext).requestId, txnId));
+ ((Cluster) node.scheduler()).onDone(() ->
checkOnResult(homeKey, txnId, 0, null));
+ }
+ else if (fail instanceof SimulatedFault)
+ {
+ ((NodeSink) node.messageSink()).debugClient(id, fail,
NodeSink.ClientAction.FAILURE);
+ node.reply(client, replyContext, ListResult.heartBeat(client,
((Packet)replyContext).requestId, id));
+ ((Cluster) node.scheduler()).onDone(() -> checkOnResult(null,
id, 0, null));
+ }
+ else
+ {
+ ((NodeSink) node.messageSink()).debugClient(id, fail,
NodeSink.ClientAction.FAILURE);
+ node.agent().onUncaughtException(fail);
+ }
+ }
+
+ private void checkOnResult(@Nullable RoutingKey homeKey, TxnId txnId,
int attempt, Throwable t) {
+ if (attempt == 42)
Review Comment:
I think I used to have 3 or something, `42` was to see if the issue was
ephemeral or not (the issue was not); I can lower the retry limit
--
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]