You get a bonus - 1 coin for daily activity. Now you have 1 coin

12.3. Recovery after a mild failure

Lecture



The main problems in recovering from a mild failure include the fact that one logical database modification operation can modify several physical blocks of the database, for example, a data page and several index pages. Database pages are buffered in RAM and popped independently. Despite the use of the WAL protocol, after a soft failure, the set of pages in the external memory of the database may be inconsistent, i.e. part of the pages of external memory corresponds to the object before the change, part - after the change. The logical level operations are not applicable to this state of the object.

The state of external database memory is called physically consistent if the page sets of all objects are consistent, i.e. correspond to the state of the object either after its change, or before the change.

We assume that the log contains points of physical consistency of the database - the points in time in which the external memory contains consistent results of operations that completed before the corresponding point in time, and there are no results of operations that did not complete, and the log buffer is pushed out into external memory. A little later, we will look at how physical consistency can be achieved. We call these points tpc (time of physical consistency).

Then, at the time of the soft failure, the following transaction states are possible:

  12.3.  Recovery after a mild failure

Suppose that in some way we managed to restore the external memory of the database to the state at the time tlpc (as it can be done a little later). Then:

  • For transaction T1 no action is required. It ended until tlpc, and all its results are reflected in the external memory of the database.
  • For transaction T2, the rest of the operations (redo) must be re-executed. Indeed, in the external memory, there are no traces of operations that were performed in the T2 transaction after the tlpc time. Therefore, repeated direct interpretation of T2 operations is correct and will lead to a logically consistent state of the database (since transaction T2 was successfully completed before the moment of a soft failure, the log contains records of all changes made by this transaction).
  • For transaction T3, the first part of the operation (undo) must be performed in the opposite direction. Indeed, in the external memory of the database there are completely no results of T3 operations that were performed after the time tlpc. On the other hand, the external memory is guaranteed to contain the results of T3 operations that were performed before the time tlpc. Consequently, the inverse interpretation of T3 operations is correct and will lead to a consistent state of the database (since T3 transaction was not completed by the time of a soft failure, during recovery it is necessary to eliminate all the consequences of its execution).
  • For transaction T4, which managed to start after the tlpc time and end before the time of the soft failure, you need to perform a full re-direct interpretation of the operations (redo).
  • Finally, for a tlpc that began after the time tlpc and did not have time to complete by the time the T5 transaction has a soft failure, no action is required. The results of operations of this transaction are completely absent in the external memory of the database.

Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Databases IBM System R - relational DBMS

Terms: Databases IBM System R - relational DBMS