Distributed Commits and Locking




CS157b

Chris Pollett

May 1, 2023

Outline

Introduction

Distributed Commit

What Might Go Wrong

Two Phase Commit (Lampson Sturgis 1976) - Prerequisites

Two Phase Commit - Phase 1

Two Phase Commit - Phase 2

Two Phase Commit - Recovery

Quiz

Which of the following statements is true?

  1. In wound-wait deadlock handling, if T is older than U and needs a lock held by U, then T is allowed to wait. On the other hand, if U is older than T, then T is rolled back.
  2. A saga typically involves several transactions, each of which has a well-defined inverse.
  3. We showed that it is impossible for a Map Reduce job to do certain group by aggregations involving sums and counts.

Distributed Locking

Centralized Locking (Garcia-Molina 1979)

Using a Lock Coordinator

Locking with Replication -- the Problem

Primary-Copy Locking (Gray 1981)

Distributed Deadlocks