Try
↑ ↓ move↵ openesc close

Interview prep / Sagas

Junior · Sagas · System design interview question

How is a compensating action different from a rollback?

Sketch your own answer first, then compare it with the one below.

A strong answer

A rollback erases a change as if it never happened. No one saw it. A compensation is a new, committed change that cancels the effect of an old one. A refund does not remove the charge. It adds a credit.

So the earlier change was visible, and anything that reacted to it may have done so. Some actions cannot be compensated at all, such as sending an email. Put those at the end, after the steps that can fail.

Sources

Learn it by running it

The sagas and compensation lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms