Page 194 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 194

Unit 11: Recovery System




          If log on stable storage at the time of crash as per (a) (b) and (c) then in:         Notes
          (a)  No redo action needs to be performed.
          (b)  redo(T ) must be performed since <T  commit> is present
                    1                        1
          (c)  redo(T ) must be performed followed by redo(T ) since
                    2                                 2
               <T  commit> and <T  commit> are present.
                 1              2



             Notes  This sequence of redo operation as suggested in (c) any number of times, it will still
             bring the value of X, Y, Z to consistent redo values. This property of the redo operation is
             called idempotent.

          Immediate Database Modification

          The immediate database modification scheme allows database updates on the stored database
          even of an uncommitted transaction. These updates are made as the writes are issued (since
          undoing may be needed, update logs must have both the old value as well as the new value).
          Updated log records must be written before database item is written (assume that the log record
          is output directly to a stable storage and can be extended to postpone log record output, as long
          as prior to execution of an output (Y) operation for a data block Y all log records corresponding
          to items Y must be flushed to stable storage).
          Output of updated blocks can take place at any time before or after transaction commit. Order in
          which blocks are output can be different from the order in which they are written.


                 Example:
             Log                  Write operation            Output
             <T  start>
               1
             <T , X, 10000, 9000>
               1
             T , Y, 8000, 9000
              1
                                  X = 9000                   Output Block of X
                                  Y = 9000                   Output Block of Y
             <T  commit>
               1
             <T  start>
               2
             <T , Z, 20,000, 19,000>
               2
                                  Z= 19000                   Output Block of Z
             <T  commit>
               2
          The recovery procedure in such has two operations instead of one:
          1.   undo(T ) restores the value of all data items updated by  T  to their old values, moving
                     i                                         i
               backwards from the last log record for T  ,
                                                i
          2.   redo(T ) sets the value of all data items updated by T  to the new values, moving forward
                    i                                    i
               from the first log record for T .
                                       i
          Both operations are idempotent, that is, even if the operation is executed  multiple times  the
          effect is the same as it is executed once. (This is necessary because operations may have to be re-
          executed during recovery).








                                           LOVELY PROFESSIONAL UNIVERSITY                                   187
   189   190   191   192   193   194   195   196   197   198   199