Re:Show HN: Restate – low-latency durable workflows for Java...
by johtso on Wednesday June 12, 2024 @12:28PM
(#40659938)
Doesn't anything involving requests to other services inherently have to be idempotent because there's still a chance of a communication error resulting in an unknown outcome of the action? You don't know if the "widget order" was successfully placed or not, and therefore there's no way to know if that action can safely be tried again.
[ Parent
| on HN ]
Re:Show HN: Restate – low-latency durable workflows for Java...
by sewen on Wednesday June 12, 2024 @12:53PM
(#40660263)
That is true, individual steps should be idempotent or undo-able.
But really only each individual one needs to be idempotent, rather than the full sequence, and that makes many situations much easier.
For example, you create a new permissions role and assign it to the user (two steps). If you safely memoize the result from the first step (let's say role uid) then any retries just assign the same role to the user again (which would not make a difference). Without memoizing the step, you might retry the whole process, assign two roles, or create a lot of code to try and figure out what was created before and reconnect the pieces.
You can also use this to memoize generated ids, dry-run-before change, ensure undos run to completion (sagas style), even implement 2PC patterns if you want to.
Re:Show HN: Restate – low-latency durable workflows for Java...
by p10jkle on Wednesday June 12, 2024 @12:33PM
(#40660005)
https://news.ycombinator.com/item?id=40659968
Absolutely, sorry if im not tight enough with my language. Maybe should be described as 'operation idempotency' vs 'handler idempotency'. IMO, an entire handler re-executing is much harder to reason about and test for than a particular operation re-executing individually, with nothing else changing between executions
Re:Show HN: Restate – low-latency durable workflows for Java...
by stsffap on Wednesday June 12, 2024 @12:40PM
(#40660109)
A special case is if the operation is calling another Restate service. In this case, Restate will make sure that the callee will be executed exactly once and there is no need for the user to pass an idempotency key or something similar. Only when interacting with the external world from a Restate service, the operation needs to be idempotent.