CS338 Lecture Notes - Lecture 16: Database Server, Perseveration, Readwrite
Document Summary
Two transactions updating the same data item but both read the same original value before update. R1(x); ; r2(x); ;w1(x); w2(x) R2(x); ; r1(x); ;w1(x); w2(x) If x is 80, final outcome should be 90. However, transaction took value of x after x+5 but before abort. Occurs when one transaction updates a database item, which is read by another transaction but then the first transaction fails. W1(x); ; r2(x); ; t1 rolled back. Transactions should read consistent values for isolated state of db. X = <80, 15, 25>; t1 = x1 +5, x3 + 5; t2 sum terms. Sum should either be 120 before t1 or 130 after t1. Reality: t2 starts summing terms before t1 increases the term values, resulting in a sum of 125. X = 80; t1 = x-5; t2 = y= f(x), z = f2(x,y) Z ends up depending on different values of x.