1: Transaction Processing Flashcards
What is a transaction ?
An action, or series of actions, carried out by a single user or application program, which reads or updates the contents of the database.
What is a logical unit of work ?
It’s a transaction. That transforms the database from one consistent state to another.
What other units are transactions?
Unit of :
- Concurrency
- Recovery
- Work
What are the 4 ACID properties?
- Atomicity
- Consistency
- Isolation
- Durability
How are transactions reliable and consistent, and to what mechanisms do they relate to ?
The are due to the “ACIDity” properties of transactions.
They relate to the concurrency control and recovery mechanisms:
What are the 3 types of schedules ?
- Schedule: preserves the order of the operations
- Serial schedule: executed consecutively without interleaved operations from other transactions
- Nonserial schedule: concurrent transactions are interleaved
When/how is a schedule conflict serialisable ?
If it is (conflict) equivalent to some serial schedule.
Any conflicting operations are ordered in the same way as some serial schedule.
Give the type of schedule:
Sa: read(T1, X); read(T2, X); write(T1, X); write(T2, X); commit(T1); commit(T2);
- Not conflict serializable – there is a cycle in the precedence graph because read(T2,X) conflicts with write(T1, X) and Write(T1, X) conflicts with write(T2, X)
T1 T2
- Recoverable – because T1 is the first to write item X and it commits before T2 commits
- Avoids cascading abort (cascadeless) – because T1, having written item X before T2 writes item X, commits first
Give the type of schedule:
Sb: read(T1, X); read(T2, Y); read(T3, X); write(T3, X); read(T2, X); read(T1, Y); abort(T3); commit(T1); commit(T2);
- Conflict serializable – no cycle (gives T1 >T3 >T2)
- Recoverable - T3 is the first to write X and then T2 reads X, so T3 should commit first. However, T3 aborts so there is no effect on the item
- Cascading abort - T3 abort means T2 would also have to abort as it has read the value of an aborted transaction
Give the type of schedule:
Sc: read(T1, X); read(T2, X); write(T1, X); read(T1, Y); write(T2, X); commit(T2); write(T1, X); commit(T1);
- Not Conflict serializable
- Recoverable – T1 is the first to write X so it should commit first. However, T2 does not read X after the T1 write
- Avoids cascading abort (cascadeless) – no aborted transactions