Lecture: Lecture 19 - Distributed Database Management Systems
Related: Distributed Transaction Classification and Two-Phase Commit · Distributed Architectures Fragmentation Allocation and Transparency
X-Open-DTP: Heterogeneous 2PC standard (Slides 61–64, 69)
X-Open-DTP (Distributed Transaction Processing) is a standard protocol that guarantees interoperability of distributed transactions across heterogeneous DBMSs—that is, different DBMS products from different vendors cooperating inside one transaction (Slide 62).
Architecture and interfaces (Slides 62–64, 69)
The model consists of one client, one Transaction Manager (TM) (implemented by specialized middleware such as BEA Tuxedo), and several Resource Managers (RMs) (provided by the DBMS servers). RMs are passive: they only respond to remote procedure calls initiated by the TM, which holds full control of the protocol (Slides 63–64).
Two standard interfaces separate the layers (Slide 63):
TMinterface (Client ↔ TM):TM.Init(),TM.Open(),TM.Begin(),TM.Commit(),TM.Term(),TM.Exit().XAinterface (TM ↔ RM):XA.Open(),XA.Start(),XA.Precom()(prepare),XA.Commit()/XA.Abort(),XA.End(),XA.Close().
Client TM (TM Interface) RM (XA Interface)
│ ── TM.Init() ─────────► │ │
│ ── TM.Open ───────────► │ ── XA.Open() ──────────────► │
│ ── TM.Begin() ────────► │ ── XA.Start() ─────────────► │ ┐
│ ... │ │ │ Transaction
│ ── TM.Commit() ───────► │ ── XA.Precom() ────────────► │ │ scope
│ │ ── XA.Commit() / Abort() ──► │ │
│ │ ── XA.End() ───────────────► │ ┘
│ ── TM.Term() ─────────► │ ── XA.Close() ─────────────► │
│ ── TM.Exit() ─────────► │ │Two 2PC optimizations in X-Open-DTP (Slides 64–66)
Standard 2PC requires expensive synchronous disk writes and full two-phase messaging for every participant. X-Open-DTP adds two optimizations:
1. Presumed Abort (Slide 65)
- Rule: When an RM sends a remote recovery request asking for a transaction’s outcome and the TM finds no information about that transaction in its log, the TM answers
Abort. - Performance gain: Eliminates several synchronous log writes!
Prepare,Global abort, andCompletein the TM log do not need to be synchronous. - What MUST remain synchronous:
Global commitin the TM log.ReadyandCommitin the RM log.
- Why
Global commitcannot be asynchronous: IfGlobal commitwere written asynchronously, the TM could sendGlobal committo RM₁, crash beforeGlobal commitreached disk, reboot with no record in its log, and then answerAbortto RM₂ under Presumed Abort—leaving RM₁ committed and RM₂ aborted (breaking atomicity!). By contrast, losingPrepareorGlobal abortmakes the TM presumeAbort, which matches the intended outcome.
2. Read Only (Slide 66)
- Rule: Exploited by any RM that did not modify its database during the transaction (only performed reads).
- Behavior:
- The RM answers
Read onlyto thePreparerequest. - It does not write anything to its log.
- It locally terminates the protocol immediately (releasing its read locks).
- The TM ignores that RM during Phase II (sends no
Global decisionand waits for noACK).
- The RM answers
Heuristic decision: breaking a TM-failure block (Slides 67–68)
If the TM crashes while an RM is inside the uncertainty window, the RM’s locked resources remain blocked until the TM recovers (Slide 67). To keep critical operations moving, X-Open-DTP allows a heuristic decision:
- A human operator forces the blocked local transaction to end (typically by rollback, rarely commit) so locked resources are released. It is called heuristic because the RM does not know the TM’s true global outcome.
- When the TM eventually recovers, the RM’s heuristic decision is compared against the TM’s actual decision (Slide 68):
- If they disagree (e.g., operator rolled back locally while TM globally committed), atomicity is lost.
- The protocol guarantees that the inconsistency is notified to the client process, and resolving the inconsistency is up to user applications.
Parallel DBMS (Slides 70–73 — Supporting)
Parallel DBMSs use multiprocessor systems or computer clusters to boost efficiency by executing work concurrently (Slide 71)—for example, scanning a fragmented table across multiple disks in parallel or running GROUP BY on partitioned subsets and merging the results.
| Dimension | Inter-query parallelism (Slide 72) | Intra-query parallelism (Slide 73) |
|---|---|---|
| How it works | Different queries are scheduled on different processors (load balancing across the CPU pool). | Subparts of the same query execute concurrently on different processors (plus pipelining). |
| Workload profile | OLTP systems: simple, short transactions with high transaction load (100–1000 tps). | OLAP systems: complex queries with reduced query load. |
| Typical operations | Independent concurrent transactions | Partitioned subqueries (GROUP BY and JOIN parallelize easily) |
DBMS benchmarks: TPC (Slides 74–76 — Familiarity Only)
Benchmarks define standardized conditions to measure and compare DBMS performance, standardized by the TPC (Transaction Processing Council) (Slide 75). Each benchmark specifies four elements: transaction load (arrival-time distribution), database size and content (randomized data generation), transaction code, and measurement/certification techniques.
| Benchmark | Workload / Domain | Notes |
|---|---|---|
| TPC-C (newer: TPC-E) | OLTP (order-entry transactions) | Simulates high-concurrency operational systems |
| TPC-H (also TPC-DI, TPC-DS) | OLAP (decision support) | Mix of complex analytical queries |
| TPCx-HS | Big data management | Assesses Hadoop cluster implementations |
Common confusions
- Thinking Presumed Abort makes ALL TM log writes asynchronous:
Prepare,Global abort, andCompletebecome asynchronous, butGlobal commitin the TM log MUST stay synchronous (alongsideReadyandCommitin RM logs). - Confusing Inter-query vs. Intra-query parallelism: Inter-query runs multiple separate queries in parallel (OLTP); Intra-query splits one single heavy query across processors (OLAP).
- Assuming Heuristic Decision preserves atomicity: A heuristic rollback unblocks stuck locks during a TM outage, at the risk of losing atomicity if the TM later recovers with
Global commit.
Retrieval questions with answers
1. Under Presumed Abort, why must Global commit in the TM log still be written synchronously even though Prepare, Global abort, and Complete can be asynchronous?
Because under Presumed Abort, if the TM crashes and finds no record for a transaction on reboot, it answers Abort to any RM recovery request. If Global commit were asynchronous and lost in a crash after being sent to one RM, the rebooted TM would wrongly tell other RMs to Abort, breaking global atomicity.
2. What happens to an RM that only executed SELECT statements during a distributed transaction when Prepare arrives under X-Open-DTP?
It uses the Read Only optimization: it replies Read only to the TM, writes no log record, locally terminates the transaction, and is ignored by the TM in Phase II.
3. An analytics company runs complex multi-table GROUP BY and JOIN queries over a multi-terabyte warehouse, while a bank runs 600 short account transfers per second. Which parallel DBMS strategy and which TPC benchmark match each workload?
The analytics warehouse suits Intra-query parallelism (splitting each complex OLAP query across processors) and TPC-H (or TPC-DI/TPC-DS). The bank suits Inter-query parallelism (load-balancing many short OLTP transactions) and TPC-C (or TPC-E).