Slide 58
Slide 58 text
58
Failure modes and recovery
● All changes are committed, nothing to do!
Recovery: no-op!
Recovery
1. Retrieve Kafka txn state from DB, if any (represents
latest recorded 2PC decision)
2. KafkaProducer#initTransactions(true) to keep
previous txn if there is prepared state. Otherwise
finish recovery
3. KafkaProducer#completeTransaction to roll
forward previous Kafka txn(s) if retrieved state
matches what is in Kafka cluster(s); otherwise roll
back
Coordinated dual-write to Kafka and DB:
1. Start new Kafka and DB txns, write application data
2. 2PC voting phase:
a. KafkaProducer#prepareTransaction, get
PreparedTxnState
b. Write PreparedTxnState to the database
3. Commit database txn
4. Commit Kafka txn