Questions / Quant development, Streaming market data

Recover a prepared sink transaction

Challenge, about 10 minutes. Question D312.

A toy sink writes output into transaction T and durably checkpoints T’s identity plus the input cursor before acknowledging checkpoint completion. It then crashes before learning whether commit(T) succeeded. What property is needed for safe recovery?

  1. AOpen a new transaction for the same output.
  2. BCreate fresh output when commit status is unknown.
  3. CTreat the lost acknowledgment as an abort, then re-emit.
  4. DResolve transaction T and retry its commit idempotently.

Answer it in the app It's free. You get hints, a second try if you miss, and a follow-up question.

Show the answer and worked solution

Answer: D. Resolve transaction T and retry its commit idempotently.

  1. The durable checkpoint links an input cursor to transaction T.
  2. After the crash, T may already be committed even though the client did not learn that fact.
  3. Query or retry the same transaction identity so recovery converges on one output commit.

Interview shortcut. Two-phase sink: resolve T and commit idempotently.

Takeaway. Ambiguous commit outcomes require stable transaction identities.

Why the other choices fail

  • Open a new transaction for the same output. A new transaction can duplicate T if T already committed.
  • Create fresh output when commit status is unknown. A fresh transaction can duplicate output if T already committed.
  • Treat the lost acknowledgment as an abort, then re-emit. An absent acknowledgment does not establish an absent remote commit.

In the app this has a follow-up where one thing about the setup changes. Try the follow-up.

More streaming market data questions