Try
↑ ↓ move↵ openesc close

Interview prep / Two-phase commit

Mid · Two-phase commit · System design interview question

What is cooperative termination, and when does it help?

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

A strong answer

A prepared participant that has timed out asks the other participants what they know. If any of them heard the decision, or never voted yes and therefore aborted, the asker learns the outcome and can finish.

It helps when the coordinator crashed after telling some participants but not all. It does not help when every participant is prepared and none heard anything. They are all in doubt, and any choice could contradict the coordinator's log.

So it shortens many blocks, but cannot remove them. Say that it needs the participants to know each other.

Sources

Learn it by running it

The two-phase commit 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