【正文】
iately after the read ? If T8 should abort, T9 would have read (and possibly shown to the user) an inconsistent database state. Hence database must ensure that schedules are recoverable. Need to address the effect of transaction failures on concurrently running transactions. 169。Silberschatz, Korth and Sudarshan, Bo Zhou Database System Concepts Recoverability (Cont.) ? Cascading rollback – a single transaction failure leads to a series of transaction rollbacks. Consider the following schedule where none of the transactions has yet mitted (so the schedule is recoverable) If T10 fails, T11 and T12 must also be rolled back. ? Can lead to the undoing of a significant amount of work ? Theoretically, it is not mandatory to avoid cascading rollback. 169。Silberschatz, Korth and Sudarshan, Bo Zhou Database System Concepts Recoverability (Cont.) ? Cascadeless schedules — cascading rollbacks cannot occur。 for each pair of transactions Ti and Tj such that Tj reads a data item previously written by Ti, the mit operation of Ti appears before the read operation of Tj. ? Every cascadeless schedule is recoverable ? It is desirable to restrict the schedules to those that are cascadeless 169。Silberschatz, Korth and Sudarshan, Bo Zhou Database System Concepts Transaction Definition in SQL ? Data manipulation language must include a construct for specifying the set of actions that prise a transaction. ? In SQL, a transaction begins implicitly. ? Some mercial DBMS support BEGIN TRANSACTION。 ? Auto Commit property ? A transaction in SQL ends by: ? Commit work mits current transaction and begins a new one. ? Rollback work causes current transaction to abort. ? Levels of consistency specified by SQL92: ? Serializable — default ? Repeatable read ? Read mitted ? Read unmitted 169。Silberschatz, Korth and Sudarshan, Bo Zhou Database System Concepts Levels of Consistency in SQL92 ? Serializable — default ? Repeatable read — only mitted records to be read, repeated reads of same record must return same value. However, a transaction may not be serializable – it may find some records inserted by a transaction but not find others. ? The phantom Phenomenon ? Read mitted — only mitted records can be read, but successive reads of record may return different (but mitted) values. ? Read unmitted — even unmitted records may be read. Lower degrees of consistency useful for gathering approximate information about the database, ., statistics for query optimizer. 169。Silberschatz, Korth and Sudarshan, Bo Zhou Database System Concepts How to use different level of Consistency ? Different level of consistency presents: ? Different level of correctness of data been retrieved. ? Different cost of query execution. ? What the meaning of ―data correctness‖? ? Can we have lower degree of transaction consistency level to improve the performance, and keep the database consistency? ? Need further understanding of the mechanism of concurrency control of DBMS. End of Chapte