Page 160 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 160

Unit 9: Transaction Management




          Because recoverability is essential, such a modification must be used for the timestamp protocol  Notes
          to be practical. Given the added overheads  this entails,  on top  of the  (considerable) cost of
          maintaining read and write timestamps,  timestamp concurrency  control is  unlikely to beat
          lock-based protocols in centralized systems. Indeed, it has mainly been studied in the context of
          distributed database systems.



              Task       If  any  transaction  encounter  unexpected  situation  then  transaction
                         complete of incomplete.

          9.7 Implementation of Isolation

          Users  are responsible  for ensuring transaction consistency. That is, the user  who submits  a
          transaction must ensure that when run to completion by itself against a ‘consistent’ database
          instance, the transaction will leave the database in a ‘consistent’ state. For example, the user may
          (naturally!) have the consistency criterion that fund transfers between bank accounts should not
          change the total amount of money in  the accounts. To transfer money from  one account to
          another, a transaction must debit one account, temporarily leaving the database inconsistent in
          a global sense, even though the new account balance may satisfy any integrity constraints with
          respect to the range of acceptable account balances. The user’s notion of a consistent database is
          preserved when the second account is credited with the transferred amount. If a faulty transfer
          program always credits the second account with one dollar less than the amount debited from
          the first account, the DBMS cannot be expected to detect inconsistencies due to such errors in the
          user program’s logic.
          The isolation property is ensured by guaranteeing that even though actions of several transactions
          might be interleaved, the net effect is identical to executing all transactions one after the other in
          some serial order. For example, if two transactions T  and T  are executed concurrently, the net
                                                    1     2
          effect is guaranteed to be equivalent to executing (all of) T  followed by executing T  or executing
                                                        1                   2
          T  followed by executing T . (The DBMS provides no guarantees about which of these orders is
           2                    1
          effectively chosen.) If each transaction maps a consistent database instance to another consistent
          database instance,  executing several transactions one  after the  other (on a consistent  initial
          database instance) will also result in a consistent final database instance.
          Database consistency is the property that every transaction sees a consistent database instance.
          Database consistency follows from transaction atomicity, isolation, and transaction consistency.

          9.8 Testing for Serializability



                 Example:    The schedule shown in the following figure is serializable.
                                 T1                           T2
                   R(A)
                   W(A)
                                                  R(A)
                                                  W(A)
                   R(B)
                   W(B)
                                                  R(B)
                                                  W(B)
                                                  Commit
                   Commit




                                           LOVELY PROFESSIONAL UNIVERSITY                                   153
   155   156   157   158   159   160   161   162   163   164   165