Challenge: 6c add a short note about how to abort transactions to demo G1a

Just add in the bottom of the Challenge #6c: Totally-Available, Read Committed Transactions · Fly Docs that the way to abort transactions is to reply with:

{"type":        "error",
 "in_reply_to": 5,
 "code":        30, // txn-conflict
 "text":        "The requested transaction has been aborted because of a conflict with another transaction. Servers need not return this error on every conflict: they may choose to retry automatically instead."

that can be generated in the following way:

return n.Reply(msg, map[string]any{"type": "error", "code": maelstrom.ErrorCode(err), "text": err.Error()})

where err = maelstrom.NewRPCError(maelstrom.TxnConflict, "txn abort").

Then it’s trivial to show g1a in uncommitted.

For more information on the protocol see maelstrom/ at main · jepsen-io/maelstrom · GitHub.

@benbjohnson ^^

Thanks, @johnkoepi. I pushed an update with that info and it should be on the web site shortly.

FYI, even though I succeeded in showing G1a with this, Maelstrom/Elle generally is not happy to see an aborted transaction and will consider it a reduced availability. If my solution is correct this means at the moment it is impossible to keep aborts in the solution (because it affects total availability). But they are fine though to demonstrate the desirable effect.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.