Docsity

Serializability Examples - Buisness Management - Lecture Slides, Slides of Business Administration

Partial preview of the text

Download Serializability Examples - Buisness Management - Lecture Slides and more Slides Business Administration in PDF only on Docsity!

Serializability Examples (cont’d)

  • Client must control the relative order of transactions, using handshakes (wait for T 1 to commit before submitting T 2 ).
  • Some more serializable executions: r 1 [x] r 2 [y] w 2 [y] w 1 [x] ≡ T 1 T 2 ≡ T 2 T (^1)

r 1 [y] r 2 [y] w 2 [y] w 1 [x] ≡ T 1 T 2 ≡ T 2 T (^1)

r 1 [x] r 2 [y] w 2 [y] w 1 [y] ≡ T 2 T 1 ≡ T 1 T (^2)

  • Serializability says the execution is equivalent to some serial order, not necessarily to all serial orders

Docsity.com

Non-Serializable Examples

  • r 1 [x] r 2 [x] w 2 [x] w 1 [x] ( race condition )
    • e.g. T 1 and T 2 are each adding 100 to x
  • r 1 [x] r 2 [y] w 2 [x] w 1 [y]
    • e.g. each transaction is trying to make x = y, but the interleaved effect is a swap
  • r 1 [x] r 1 [y] w 1 [x] r 2 [x] r 2 [y] c 2 w 1 [y] c (^1) ( inconsistent retrieval ) - e.g. T 1 is moving $100 from x to y. - T 2 sees only half of the result of T (^1)
  • Compare to the OS view of synchronization

Docsity.com

Outline

1. The Basics

2. ACID Properties

3. Atomicity and Two-Phase Commit

4. Performance

5. Styles of System

Docsity.com

1.3 Atomicity and Two-Phase Commit

  • Distributed systems make atomicity harder
  • Suppose a transaction updates data managed by two DB systems.
  • One DB system could commit the transaction, but a failure could prevent the other system from committing.
  • The solution is the two-phase commit protocol.
  • Abstract “DB system” by resource manager (could be a SQL DBMS, message mgr, queue mgr, OO DBMS, etc.) Docsity.com

Two-Phase Commit

System Architecture

Resource Manager

Transaction Manager (TM)

Application Program

Other Transaction Managers

  1. Start transaction returns a unique transaction identifier
  2. Resource accesses include the transaction identifier. For each transaction, RM registers with TM
  3. When application asks TM to commit, the TM runs two-phase commit.

Start Commit, Abort

Read, Write

Docsity.com

Outline

1. The Basics

2. ACID Properties

3. Atomicity and Two-Phase Commit

4. Performance

5. Styles of System

Docsity.com

TPC-A/B — Bank Tellers

Start Read message from terminal (100 bytes) Read+write account record (random access) Write history record (sequential access) Read+write teller record (random access) Read+write branch record (random access) Write message to terminal (200 bytes) Commit

  • End of history and branch records are bottlenecks
    • Obsolete (a retired standard), but interesting
    • Input is 100 byte message requesting deposit/withdrawal
    • Database tables = {Accounts, Tellers, Branches, History}

Docsity.com

The TPC-C Order-Entry Benchmark

  • TPC-C uses heavier weight transactions

Table Rows/Whse Bytes/row Warehouse 1 89 District 10 95 Customer 30K 655 History 30K 46 Order 30K 24 New-Order 9K 8 OrderLine 300K 54 Stock 100K 306 Item 100K 82

Docsity.com