Skip to content
drkitty edited this page Oct 23, 2014 · 4 revisions

(derived from http://people.mozilla.org/~juber/public/t1_t2_scenario.txt)

Assume REPEATABLE-READ or READ-COMMITTED

T1 = Transaction 1 in Session 1
T2 = Transaction 2 in Session 2

Time       T1                            T2

---        ---
 |          |
 |          |
 |          |
 |          | Select for B             <---- B doesn't exist
 |          | if B doesn't exist:
 |          |    Create  A               ---
 |          | else:                       |
 |          |    Error("Msg to the user") |
 |          |                             |
 |          |                             | Select for A:   <--- T1 hasn't been committed yet, so A doesn't exist
 |          |                             | if A doesn't exist:
 |          |                             |     Create B
 |          |                             | else:
 |          |                             |     Error("Msg to user")
 |          |                             |
 |          |                             |
 |         --- Commit()                   |
 |                                        |
 |                                        |
 |                                        |
 |                                       --- Commit()
 |
---