CS FundamentalsHardGATE CS (PYQ pattern)

A two-phase commit has 1 coordinator and 5 participants and uses the read-only optimisation. All 5 receive PREPARE. Three vote YES, one votes READ-ONLY (it did no updates, releases its locks and drops out of phase 2) and one votes NO (and aborts at once). The coordinator sends the decision to every participant still in doubt and each of them acknowledges. How many messages are exchanged in total?

  1. A. 20
  2. B. 18
  3. C. 16
  4. D. 14

Correct answer: C. 16

Phase 1: 5 PREPAREs + 5 votes = 10. The decision is ABORT; it goes only to the 3 YES voters (the NO voter already aborted, the read-only one left), and they send 3 ACKs: 10 + 3 + 3 = 16. Sending the decision and getting ACKs from all 5 gives 20; from 4 gives 18.

More DBMS and SQL questions

Exams that ask this topic