Transaction management

Exercise 1

Match the following descriptions with each one of the ACID properties they refer to:

  1. 1.The effect of concurrently executing a set of transaction is the same as if they had executed concurrently;

  2. 2.A transaction should either complete or have no effect at all;

  3. 3.A transaction should correctly transform the database state to reflect the effect of a real world event;

  4. 4.Once a transaction changes the database and the changes are committed, these changes cannot be lost because of subsequent failure;

  5. 5.It is the only ACID property that can be enforced manually;

  6. 6.A transaction is an atomic unit of processing;

Exercise 2

A programmer is given the assignment of implementing a deposit transaction for a bank. The specification for that transaction states that the arguments for that transaction are to be the AccountId of the account and the amount of the deposit.

The transaction is supposed to increment the amount of the balance in that account by the amount of the deposit. Instead the programmer implements a transaction that does absolutely nothing. It ignores its arguments, and as soon as it is called, the transaction commits.

State which of the ACID properties the execution of that transaction satisfies.

Lectures:
Tue: 14.00 to 15.00 (LIFS-LT3) 
Thu: 10.00 to 11.00 (SHER-LT1) 
Fri:   15.00 to 16.00 (SHER-LT1)
Labs:
One session per week in Lab 4, G. Holt Building, starting from week 3 (Week starting on October 10th).
Check your slot on Spider!
Lab timetable:
Mon: 12.00 - 13.00; 13.00 - 14.00 
Tue: 10.00 - 11.00
Thu: 13.00 - 14.00; 15.00 - 16.00; 16.00 -17.00
Fri: 12.00 - 13.00; 13.00 - 14.00
Surgeries:
Tue: 15.00 to 16.00
Thu: 11.00 to 12.00
Assignments:
Assignment 1 (Deadline XX/XX/XX);
Assignment 2 (Deadline XX/XX/XX);
Assessment weightings:
80% multiple choice exam;
10% Practical Assignment 1;
10% Practical Assignment 2.

Exercise 3

Consider the following transactions:


Let us assume the initial value of X is 7. What is the value of X after the execution of both transactions? Is this value correct? If not, what type of problem affects the transactions?

Exercise 4

A schedule is recoverable when no transaction needs to be rolled back.

Given the following schedules, determine if they are recoverable, and motivate your answer:

  1. a.Sa = r1(X); w1(X); r2(X); r1(Y); w2(X); c2; a1;

  2. b.Sb = r1(X); w1(X); r2(X); r1(Y); w2(X); w1(Y); c1; c2;

  3. c.Sc = r1(X); w1(X); r2(X); w2(X); r1(Y); a1;


Exercise 5

Consider the following two transactions T1  and T2.


Let us assumes that when the transactions start balX = 100. What is the value of balX at the end of the execution of the two transactions? Do the transactions produce the correct value for balX? If not, characterise the problem and propose a solution.