News for hackers. Stuff that matters.
Re:Saga Pattern Made Easy by lorendsr on Tuesday May 30, 2023 @03:45PM (#36129643)
Sagas are for when you can't do an update in an ACID transaction, for example when updating state across different types of data stores.

If you're asking whether the catch clause in a Temporal Workflow saga is guaranteed to execute, the answer is yes. The way it's able to guarantee this is by persisting each step the code takes and recovering program state if a process crashes, server loses power, etc. For an explanation of how this works, see: https://temporal.io/blog/building-reliable-distributed-syste...

Re:Saga Pattern Made Easy by agumonkey on Tuesday May 30, 2023 @03:52PM (#36129735)
Seems like a distributed stack unwind
Re:Saga Pattern Made Easy by lorendsr on Tuesday May 30, 2023 @05:05PM (#36130787)
If I'm getting your point right, I agree! If you have the workflow / durable execution primitive to depend on (a durable function is guaranteed to complete executing), then there are a lot of pieces of distributed systems stacks that you no longer need to use. Your durable code is automatically backed by the event sourcing, timers, task queues, transfer queues, etc that Temporal internally uses to provide the guarantee, so that you don't need to build them yourself.
Re:Saga Pattern Made Easy by fortunaTemporal on Tuesday May 30, 2023 @05:07PM (#36130807)
Author of the article here. Yeah, @agumonkey I like that analogy a lot!

Generally, that's a good way of thinking about it. The one additional bit of nuance is it's like a "safe" stack unwind while other processes could be still modifying databases at the same time, so it's not a complete "rollback" of the whole world if that makes sense.

Re:Saga Pattern Made Easy by agumonkey on Tuesday May 30, 2023 @06:40PM (#36132083)
Thanks, you're probably right, there's more to it. It's a thrilling topic, are there any other patterns, or abstractions into controlling "distributed state" (apologies if i'm twisting things too much again) between agents to keep things in a correct order ?
Re:Saga Pattern Made Easy by fortunaTemporal on Wednesday May 31, 2023 @02:05PM (#36141546)
One pattern is having a Workflow that runs as long as the lifetime of a domain object and holds a conceptual lock on that object—it receives requests to modify the object, and makes sure to only perform one operation at a time. (like the state pattern on a particular agent)

Also related: Signals are events that you can send to Workflows and between Workflows, and they’re always delivered in the order they’re received.

More generally, for a handy reference of Distributed Systems patterns, check out https://microservices.io/patterns/data/saga.html (though I personally find his diagrams a bit...overwhelming) and the MSN writeups: https://learn.microsoft.com/en-us/azure/architecture/pattern...

Re:Saga Pattern Made Easy by agumonkey on Wednesday May 31, 2023 @05:09PM (#36144363)
oh that's cool, thanks a lot