SlideShare une entreprise Scribd logo
1  sur  81
Chapter 17: Recovery System




           Database System Concepts, 1st Ed.
   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
          See www.vnsispl.com for conditions on re-use
Chapter 17: Recovery System
            s Failure Classification
            s Storage Structure
            s Recovery and Atomicity
            s Log-Based Recovery
            s Shadow Paging
            s Recovery With Concurrent Transactions
            s Buffer Management
            s Failure with Loss of Nonvolatile Storage
            s Advanced Recovery Techniques
            s ARIES Recovery Algorithm
            s Remote Backup Systems




Database System Concepts, 1st Ed.              17.2      ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Failure Classification
            s Transaction failure :
                   q    Logical errors: transaction cannot complete due to some
                        internal error condition
                   q    System errors: the database system must terminate an active
                        transaction due to an error condition (e.g., deadlock)
            s System crash: a power failure or other hardware or software failure
                  causes the system to crash.
                   q    Fail-stop assumption: non-volatile storage contents are
                        assumed to not be corrupted by system crash
                             Database systems have numerous integrity checks to prevent
                              corruption of disk data
            s Disk failure: a head crash or similar disk failure destroys all or part
                  of disk storage
                   q    Destruction is assumed to be detectable: disk drives use
                        checksums to detect failures


Database System Concepts, 1st Ed.                     17.3   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Recovery Algorithms
            s     Recovery algorithms are techniques to ensure database consistency
                  and transaction atomicity and durability despite failures
                   q     Focus of this chapter
            s     Recovery algorithms have two parts
                   1.    Actions taken during normal transaction processing to ensure
                         enough information exists to recover from failures
                   2.    Actions taken after a failure to recover the database contents to a
                         state that ensures atomicity, consistency and durability




Database System Concepts, 1st Ed.                     17.4   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Storage Structure
            s Volatile storage:
                   q    does not survive system crashes
                   q    examples: main memory, cache memory
            s Nonvolatile storage:
                   q    survives system crashes
                   q    examples: disk, tape, flash memory,
                                  non-volatile (battery backed up) RAM
            s Stable storage:
                   q    a mythical form of storage that survives all failures
                   q    approximated by maintaining multiple copies on distinct nonvolatile
                        media




Database System Concepts, 1st Ed.                     17.5    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Stable-Storage Implementation
            s Maintain multiple copies of each block on separate disks
                   q     copies can be at remote sites to protect against disasters such as
                         fire or flooding.
            s Failure during data transfer can still result in inconsistent copies: Block
                  transfer can result in
                   q     Successful completion
                   q     Partial failure: destination block has incorrect information
                   q     Total failure: destination block was never updated
            s Protecting storage media from failure during data transfer (one
                  solution):
                   q     Execute output operation as follows (assuming two copies of each
                         block):
                          1.   Write the information onto the first physical block.
                          2.   When the first write successfully completes, write the same
                               information onto the second physical block.
                          3.   The output is completed only after the second write
                               successfully completes.

Database System Concepts, 1st Ed.                        17.6   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Stable-Storage Implementation
                                  (Cont.)

            s      Protecting storage media from failure during data transfer (cont.):
            s      Copies of a block may differ due to failure during output operation. To
                   recover from failure:
                    1.    First find inconsistent blocks:
                                Expensive solution: Compare the two copies of every disk block.
                                Better solution:
                                q   Record in-progress disk writes on non-volatile storage (Non-
                                    volatile RAM or special area of disk).
                                q    Use this information during recovery to find blocks that may be
                                    inconsistent, and only compare copies of these.
                                q   Used in hardware RAID systems
                    2.    If either copy of an inconsistent block is detected to have an error (bad
                          checksum), overwrite it by the other copy. If both have no error, but are
                          different, overwrite the second block by the first block.



Database System Concepts, 1st Ed.                       17.7    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Data Access
            s Physical blocks are those blocks residing on the disk.
            s Buffer blocks are the blocks residing temporarily in main memory.
            s Block movements between disk and main memory are initiated
                  through the following two operations:
                   q    input(B) transfers the physical block B to main memory.
                   q    output(B) transfers the buffer block B to the disk, and replaces
                        the appropriate physical block there.
            s Each transaction Ti has its private work-area in which local copies of
                  all data items accessed and updated by it are kept.
                   q     Ti's local copy of a data item X is called xi.
            s We assume, for simplicity, that each data item fits in, and is stored
                  inside, a single block.




Database System Concepts, 1st Ed.                       17.8    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Data Access (Cont.)
            s Transaction transfers data items between system buffer blocks and its
                  private work-area using the following operations :
                   q    read(X) assigns the value of data item X to the local variable xi.

                   q    write(X) assigns the value of local variable xi to data item {X} in
                        the buffer block.
                   q    both these commands may necessitate the issue of an input(BX)
                        instruction before the assignment, if the block BX in which X
                        resides is not already in memory.
            s Transactions
                   q    Perform read(X) while accessing X for the first time;
                   q    All subsequent accesses are to the local copy.
                   q    After last access, transaction executes write(X).
            s output(BX) need not immediately follow write(X). System can
                  perform the output operation when it deems fit.

Database System Concepts, 1st Ed.                     17.9    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Example of Data Access
                                                 buffer
                        Buffer Block A                           input(A)
                                                   X                                               A
                        Buffer Block B             Y                                                B
                                                                output(B)
                                       read(X)
                                                   write(Y)

                                                       x2
                                         x1
                                         y1

                                       work area       work area
                                       of T1           of T2

                                                    memory                                  disk

Database System Concepts, 1st Ed.                      17.10   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Recovery and Atomicity
            s Modifying the database without ensuring that the transaction will commit
                   may leave the database in an inconsistent state.
            s Consider transaction Ti that transfers $50 from account A to account B;
                  goal is either to perform all database modifications made by Ti or none
                  at all.
            s Several output operations may be required for Ti (to output A and B). A
                  failure may occur after one of these modifications have been made but
                  before all of them are made.




Database System Concepts, 1st Ed.                 17.11   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Recovery and Atomicity (Cont.)
            s To ensure atomicity despite failures, we first output information
                  describing the modifications to stable storage without modifying the
                  database itself.
            s We study two approaches:
                   q    log-based recovery, and
                   q    shadow-paging
            s We assume (initially) that transactions run serially, that is, one after
                  the other.




Database System Concepts, 1st Ed.                  17.12   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Log-Based Recovery
            s A log is kept on stable storage.
                    q
                The log is a sequence of log records, and maintains a record of
                update activities on the database.
            s When transaction Ti starts, it registers itself by writing a
                 <Ti start>log record
            s Before Ti executes write(X), a log record <Ti, X, V1, V2> is written,
                  where V1 is the value of X before the write, and V2 is the value to be
                  written to X.
                   q Log record notes that Ti has performed a write on data item Xj Xj
                       had value V1 before the write, and will have value V2 after the write.
            s When Ti finishes it last statement, the log record <Ti commit> is
                  written.
            s We assume for now that log records are written directly to stable
                  storage (that is, they are not buffered)
            s Two approaches using logs
                    q    Deferred database modification
                    q    Immediate database modification
Database System Concepts, 1st Ed.                   17.13    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Deferred Database Modification
            s The deferred database modification scheme records all
                  modifications to the log, but defers all the writes to after partial
                  commit.
            s Assume that transactions execute serially
            s Transaction starts by writing <Ti start> record to log.

            s A write(X) operation results in a log record <Ti, X, V> being written,
                  where V is the new value for X
                    q    Note: old value is not needed for this scheme
            s The write is not performed on X at this time, but is deferred.
            s When Ti partially commits, <Ti commit> is written to the log
            s Finally, the log records are read and used to actually execute the
                  previously deferred writes.




Database System Concepts, 1st Ed.                    17.14   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Deferred Database Modification
                                (Cont.)
            s During recovery after a crash, a transaction needs to be redone if and
                  only if both <Ti start> and<Ti commit> are there in the log.
            s Redoing a transaction Ti ( redoTi) sets the value of all data items
                  updated by the transaction to the new values.
            s Crashes can occur while
                    q    the transaction is executing the original updates, or
                    q    while recovery action is being taken
            s example transactions T0 and T1 (T0 executes before T1):

                  T0: read (A)                                     T1 : read (C)
                            A: - A - 50                                   C:- C- 100
                            Write (A)                                       write (C)
                            read (B)
                            B:- B + 50
                            write (B)

Database System Concepts, 1st Ed.                     17.15     ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Deferred Database Modification
                                (Cont.)
            s Below we show the log as it appears at three instances of time.




            s If log on stable storage at time of crash is as in case:
              (a) No redo actions need to be taken
              (b) redo(T0) must be performed since <T0 commit> is present
                  (c) redo(T0) must be performed followed by redo(T1) since
                        <T0 commit> and <Ti commit> are present




Database System Concepts, 1st Ed.                    17.16   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Immediate Database Modification
            s The immediate database modification scheme allows database
                  updates of an uncommitted transaction to be made as the writes are
                  issued
                   q    since undoing may be needed, update logs must have both old
                        value and new value
            s Update log record must be written before database item is written
                   q    We assume that the log record is output directly to stable storage
                   q    Can be extended to postpone log record output, so long as prior to
                        execution of an output(B) operation for a data block B, all log
                        records corresponding to items B must be flushed to stable
                        storage
            s Output of updated blocks can take place at any time before or after
                  transaction commit
            s Order in which blocks are output can be different from the order in
                  which they are written.



Database System Concepts, 1st Ed.                    17.17   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Immediate Database Modification
                                  Example
            Log                                Write                                      Output

            <T0 start>
            <T0, A, 1000, 950>
            To, B, 2000, 2050
                                    A = 950
                                    B = 2050
            <T0 commit>
            <T1 start>
            <T1, C, 700,x600>
                         1


                                     C = 600
                                                                 BB, BC
            <T1 commit>
                                                                 BA
            s     Note: BX denotes block containing X.




Database System Concepts, 1st Ed.                        17.18        ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Immediate Database Modification
                             (Cont.)
            s Recovery procedure has two operations instead of one:
                    q     undo(Ti) restores the value of all data items updated by Ti to their
                         old values, going backwards from the last log record for Ti
                    q    redo(Ti) sets the value of all data items updated by Ti to the new
                         values, going forward from the first log record for Ti
            s Both operations must be idempotent
                    q    That is, even if the operation is executed multiple times the effect is
                         the same as if it is executed once
                              Needed since operations may get re-executed during recovery
            s When recovering after failure:
                    q    Transaction Ti needs to be undone if the log contains the record
                         <Ti start>, but does not contain the record <Ti commit>.
                    q    Transaction Ti needs to be redone if the log contains both the record
                         <Ti start> and the record <Ti commit>.
            s Undo operations are performed first, then redo operations.



Database System Concepts, 1st Ed.                     17.19    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Immediate DB Modification Recovery
                         Example
              Below we show the log as it appears at three instances of time.




            Recovery actions in each case above are:
            (a) undo (T0): B is restored to 2000 and A to 1000.
            (b) undo (T1) and redo (T0): C is restored to 700, and then A and B are
                 set to 950 and 2050 respectively.
            (c) redo (T0) and redo (T1): A and B are set to 950 and 2050
                   respectively. Then C is set to 600




Database System Concepts, 1st Ed.                       17.20   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Checkpoints
            s     Problems in recovery procedure as discussed earlier :
                   1.    searching the entire log is time-consuming
                   2.    we might unnecessarily redo transactions which have already
                   3.    output their updates to the database.
            s     Streamline recovery procedure by periodically performing
                  checkpointing
                   q     Output all log records currently residing in main memory onto
                         stable storage.
                   q     Output all modified buffer blocks to the disk.
                   q     Write a log record < checkpoint> onto stable storage.




Database System Concepts, 1st Ed.                     17.21   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Checkpoints (Cont.)
            s     During recovery we need to consider only the most recent transaction
                  Ti that started before the checkpoint, and transactions that started
                  after Ti.
                   q     Scan backwards from end of log to find the most recent
                         <checkpoint> record
                   q     Continue scanning backwards till a record <Ti start> is found.
                   q     Need only consider the part of log following above start record.
                         Earlier part of log can be ignored during recovery, and can be
                         erased whenever desired.
                   q     For all transactions (starting from Ti or later) with no <Ti
                         commit>, execute undo(Ti). (Done only in case of immediate
                         modification.)
                   q     Scanning forward in the log, for all transactions starting
                         from Ti or later with a <Ti commit>, execute redo(Ti).




Database System Concepts, 1st Ed.                     17.22   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Example of Checkpoints

                                       Tc                             Tf
                               T1
                                        T2
                                                 T3
                                                                T4


                                    checkpoint                system failure
             s T1 can be ignored (updates already output to disk due to checkpoint)
             s T2 and T3 redone.

             s T4 undone




Database System Concepts, 1st Ed.                     17.23    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Recovery With Concurrent
                                     Transactions
            s We modify the log-based recovery schemes to allow multiple
                  transactions to execute concurrently.
                    q    All transactions share a single disk buffer and a single log
                    q    A buffer block can have data items updated by one or more
                         transactions
            s We assume concurrency control using strict two-phase locking;
                    q    i.e. the updates of uncommitted transactions should not be visible to
                         other transactions
                              Otherwise how to perform undo if T1 updates A, then T2 updates
                               A and commits, and finally T1 has to abort?
            s Logging is done as described earlier.
                    q    Log records of different transactions may be interspersed in the log.
            s The checkpointing technique and actions taken on recovery have to be
                  changed
                    q    since several transactions may be active when a checkpoint is
                         performed.


Database System Concepts, 1st Ed.                     17.24   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Recovery With Concurrent Transactions
                                 (Cont.)
            s      Checkpoints are performed as before, except that the checkpoint log record
                   is now of the form
                        < checkpoint L>
                   where L is the list of transactions active at the time of the checkpoint
                    q     We assume no updates are in progress while the checkpoint is carried
                          out (will relax this later)
            s      When the system recovers from a crash, it first does the following:
                    q     Initialize undo-list and redo-list to empty
                    q     Scan the log backwards from the end, stopping when the first
                          <checkpoint L> record is found.
                          For each record found during the backward scan:
                          5 if the record is <Ti commit>, add Ti to redo-list

                          if the record is <Ti start>, then if Ti is not in redo-list, add Ti to
                           5
                          undo-list
                    q For every Ti in L, if Ti is not in redo-list, add Ti to undo-list




Database System Concepts, 1st Ed.                      17.25   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Recovery With Concurrent Transactions
                               (Cont.)

            s     At this point undo-list consists of incomplete transactions which must
                  be undone, and redo-list consists of finished transactions that must be
                  redone.
            s     Recovery now continues as follows:
                   q     Scan log backwards from most recent record, stopping when
                         <Ti start> records have been encountered for every Ti in undo-
                         list.
                          s     During the scan, perform undo for each log record that
                                belongs to a transaction in undo-list.
                   q     Locate the most recent <checkpoint L> record.
                   q     Scan log forwards from the <checkpoint L> record till the end of
                         the log.
                          s     During the scan, perform redo for each log record that
                                belongs to a transaction on redo-list




Database System Concepts, 1st Ed.                      17.26   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Example of Recovery
            s Go over the steps of the recovery algorithm on the following log:
                                    <T0 start>
                                    <T0, A, 0, 10>
                                    <T0 commit>
                                    <T1 start>        /* Scan at step 1 comes up to here */
                                    <T1, B, 0, 10>
                                    <T2 start>
                                    <T2, C, 0, 10>
                                    <T2, C, 10, 20>
                                    <checkpoint {T1, T2}>
                                    <T3 start>
                                    <T3, A, 10, 20>
                                    <T3, D, 0, 10>
                                    <T3 commit>

Database System Concepts, 1st Ed.                         17.27   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Log Record Buffering
            s Log record buffering: log records are buffered in main memory,
                  instead of of being output directly to stable storage.
                    q    Log records are output to stable storage when a block of log records
                         in the buffer is full, or a log force operation is executed.
            s Log force is performed to commit a transaction by forcing all its log
                  records (including the commit record) to stable storage.
            s Several log records can thus be output using a single output operation,
                  reducing the I/O cost.




Database System Concepts, 1st Ed.                    17.28   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Log Record Buffering (Cont.)
            s The rules below must be followed if log records are buffered:
                   q    Log records are output to stable storage in the order in which they
                        are created.
                   q    Transaction Ti enters the commit state only when the log record
                        <Ti commit> has been output to stable storage.
                   q    Before a block of data in main memory is output to the database,
                        all log records pertaining to data in that block must have been
                        output to stable storage.
                             This rule is called the write-ahead logging or WAL rule
                                – Strictly speaking WAL only requires undo information to be
                                  output




Database System Concepts, 1st Ed.                      17.29   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Database Buffering
            s Database maintains an in-memory buffer of data blocks
                    q    When a new block is needed, if buffer is full an existing block needs to
                         be removed from buffer
                    q    If the block chosen for removal has been updated, it must be output to
                         disk
            s If a block with uncommitted updates is output to disk, log records with undo
                  information for the updates are output to the log on stable storage first
                    q    (Write ahead logging)
            s No updates should be in progress on a block when it is output to disk. Can
                  be ensured as follows.
                    q    Before writing a data item, transaction acquires exclusive lock on block
                         containing the data item
                    q    Lock can be released once the write is completed.
                              Such locks held for short duration are called latches.
                    q    Before a block is output to disk, the system acquires an exclusive latch
                         on the block
                              Ensures no update can be in progress on the block

Database System Concepts, 1st Ed.                       17.30   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Buffer Management (Cont.)
            s Database buffer can be implemented either
                   q    in an area of real main-memory reserved for the database, or
                   q    in virtual memory
            s Implementing buffer in reserved main-memory has drawbacks:
                   q    Memory is partitioned before-hand between database buffer and
                        applications, limiting flexibility.
                   q    Needs may change, and although operating system knows best
                        how memory should be divided up at any time, it cannot change
                        the partitioning of memory.




Database System Concepts, 1st Ed.                   17.31   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Buffer Management (Cont.)
            s Database buffers are generally implemented in virtual memory in spite
                  of some drawbacks:
                    q     When operating system needs to evict a page that has been
                          modified, the page is written to swap space on disk.
                    q     When database decides to write buffer page to disk, buffer page
                          may be in swap space, and may have to be read from swap space
                          on disk and output to the database on disk, resulting in extra I/O!
                               Known as dual paging problem.
                    q     Ideally when OS needs to evict a page from the buffer, it should
                          pass control to database, which in turn should
                           1.   Output the page to database instead of to swap space (making
                                sure to output log records first), if it is modified
                           2.   Release the page from the buffer, for the OS to use
                           Dual paging can thus be avoided, but common operating systems
                             do not support such functionality.




Database System Concepts, 1st Ed.                      17.32   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Failure with Loss of Nonvolatile
                                 Storage
            s So far we assumed no loss of non-volatile storage
            s Technique similar to checkpointing used to deal with loss of non-
                  volatile storage
                    q    Periodically dump the entire content of the database to stable
                         storage
                    q    No transaction may be active during the dump procedure; a
                         procedure similar to checkpointing must take place
                            Output   all log records currently residing in main memory onto
                              stable storage.
                            Output   all buffer blocks onto the disk.
                            Copy   the contents of the database to stable storage.
                            Output   a record <dump> to log on stable storage.




Database System Concepts, 1st Ed.                      17.33   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Recovering from Failure of Non-Volatile
                                 Storage
            s To recover from disk failure
                   q    restore database from most recent dump.
                   q    Consult the log and redo all transactions that committed after
                        the dump
            s Can be extended to allow transactions to be active during dump;
                  known as fuzzy dump or online dump
                   q    Will study fuzzy checkpointing later




Database System Concepts, 1st Ed.                  17.34   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery Algorithm




            Database System Concepts, 1st Ed.
    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
           See www.vnsispl.com for conditions on re-use
Advanced Recovery: Key Features
            s Support for high-concurrency locking techniques, such as those used
                  for B+-tree concurrency control, which release locks early
                   q    Supports “logical undo”
            s Recovery based on “repeating history”, whereby recovery executes
                  exactly the same actions as normal processing
                   q    including redo of log records of incomplete transactions, followed
                        by subsequent undo
                   q    Key benefits
                             supports logical undo
                             easier to understand/show correctness




Database System Concepts, 1st Ed.                     17.36   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Logical Undo
                                   Logging

            s Operations like B+-tree insertions and deletions release locks early.
                    q    They cannot be undone by restoring old values (physical undo),
                         since once a lock is released, other transactions may have updated
                         the B+-tree.
                    q    Instead, insertions (resp. deletions) are undone by executing a
                         deletion (resp. insertion) operation (known as logical undo).
            s For such operations, undo log records should contain the undo operation
                  to be executed
                    q    Such logging is called logical undo logging, in contrast to
                         physical undo logging
                              Operations are called logical operations
                    q    Other examples:
                              delete of tuple, to undo insert of tuple
                                – allows early lock release on space allocation information
                              subtract amount deposited, to undo deposit
                                – allows early lock release on bank balance


Database System Concepts, 1st Ed.                       17.37   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Physical Redo
            s Redo information is logged physically (that is, new value for each
                  write) even for operations with logical undo
                   q    Logical redo is very complicated since database state on disk may
                        not be “operation consistent” when recovery starts
                   q    Physical redo logging does not conflict with early lock release




Database System Concepts, 1st Ed.                    17.38   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Operation
                                Logging
            s Operation logging is done as follows:
                    q    When operation starts, log <Ti, Oj, operation-begin>. Here Oj is a
                         unique identifier of the operation instance.
                    q    While operation is executing, normal log records with physical redo
                         and physical undo information are logged.
                    q    When operation completes, <Ti, Oj, operation-end, U> is logged,
                         where U contains information needed to perform a logical undo
                         information.
            Example: insert of (key, record-id) pair (K5, RID7) into index I9
                                    <T1, O1, operation-begin>
                                    ….
                                    <T1, X, 10, K5>        Physical redo of steps in insert
                                    <T1, Y, 45, RID7>
                                    <T1, O1, operation-end, (delete I9, K5, RID7)>



Database System Concepts, 1st Ed.                           17.39    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Operation Logging
                                (Cont.)

            s If crash/rollback occurs before operation completes:
                   q    the operation-end log record is not found, and
                   q    the physical undo information is used to undo operation.
            s If crash/rollback occurs after the operation completes:
                   q    the operation-end log record is found, and in this case
                   q    logical undo is performed using U; the physical undo information
                        for the operation is ignored.
            s Redo of operation (after crash) still uses physical redo information.




Database System Concepts, 1st Ed.                   17.40   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Txn Rollback
            Rollback of transaction Ti is done as follows:
            s      Scan the log backwards
                    q     If a log record <Ti, X, V1, V2> is found, perform the undo and log a
                          special redo-only log record <Ti, X, V1>.
                    q     If a <Ti, Oj, operation-end, U> record is found
                               Rollback the operation logically using the undo information U.
                                – Updates performed during roll back are logged just like
                                  during normal operation execution.
                                – At the end of the operation rollback, instead of logging an
                                  operation-end record, generate a record
                                      <Ti, Oj, operation-abort>.
                               Skip all preceding log records for Ti until the record
                                <Ti, Oj operation-begin> is found



Database System Concepts, 1st Ed.                        17.41   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Txn Rollback (Cont.)

            s     Scan the log backwards (cont.):
                   q     If a redo-only record is found ignore it
                   q     If a <Ti, Oj, operation-abort> record is found:
                          5     skip all preceding log records for Ti until the record
                                <Ti, Oj, operation-begin> is found.
                   q     Stop the scan when the record <Ti, start> is found
                   q     Add a <Ti, abort> record to the log
            Some points to note:
            s     Cases 3 and 4 above can occur only if the database crashes while a
                  transaction is being rolled back.
            s     Skipping of log records as in case 4 is important to prevent multiple
                  rollback of the same operation.




Database System Concepts, 1st Ed.                        17.42   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Txn Rollback
                                   Example

            s Example with a complete and an incomplete operation

               <T1, start>
               <T1, O1, operation-begin>
               ….
               <T1, X, 10, K5>
               <T1, Y, 45, RID7>
               <T1, O1, operation-end, (delete I9, K5, RID7)>
               <T1, O2, operation-begin>
               <T1, Z, 45, 70>
                              T1 Rollback begins here
               <T1, Z, 45>           redo-only log record during physical undo (of incomplete O2)
               <T1, Y, .., ..>  Normal redo records for logical undo of O1
                    …
               <T1, O1, operation-abort>  What if crash occurred immediately after this?
               <T1, abort>
Database System Concepts, 1st Ed.                          17.43   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Crash
                                    Recovery
            The following actions are taken when recovering from system crash
            s     (Redo phase): Scan log forward from last < checkpoint L> record
                  till end of log
                   q     Repeat history by physically redoing all updates of all
                         transactions,
                   q     Create an undo-list during the scan as follows
                               undo-list is set to L initially
                               Whenever <Ti start> is found Ti is added to undo-list
                               Whenever <Ti commit> or <Ti abort> is found, Ti is deleted
                                from undo-list
                  This brings database to state as of crash, with committed as well as
                  uncommitted transactions having been redone.
                  Now undo-list contains transactions that are incomplete, that is,
                  have neither committed nor been fully rolled back.



Database System Concepts, 1st Ed.                           17.44   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Crash Recovery
                                (Cont.)

            Recovery from system crash (cont.)
            s      (Undo phase): Scan log backwards, performing undo on log records
                   of transactions found in undo-list.
                    q     Log records of transactions being rolled back are processed as
                          described earlier, as they are found
                               Single shared scan for all transactions being undone
                    q     When <Ti start> is found for a transaction Ti in undo-list, write a
                          <Ti abort> log record.
                    q     Stop scan when <Ti start> records have been found for all Ti in
                          undo-list
            s      This undoes the effects of incomplete transactions (those with neither
                   commit nor abort log records). Recovery is now complete.




Database System Concepts, 1st Ed.                      17.45   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Checkpointing
            s     Checkpointing is done as follows:
                   q     Output all log records in memory to stable storage
                   q     Output to disk all modified buffer blocks
                   q     Output to log on stable storage a < checkpoint L> record.
                  Transactions are not allowed to perform any actions while
                  checkpointing is in progress.
            s     Fuzzy checkpointing allows transactions to progress while the most
                  time consuming parts of checkpointing are in progress
                   q     Performed as described on next slide




Database System Concepts, 1st Ed.                     17.46   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Recovery: Fuzzy Checkpointing

            s      Fuzzy checkpointing is done as follows:
                    q     Temporarily stop all updates by transactions
                    q     Write a <checkpoint L> log record and force log to stable storage
                    q     Note list M of modified buffer blocks
                    q     Now permit transactions to proceed with their actions
                    q     Output to disk all modified buffer blocks in list M
                           5    blocks should not be updated while being output
                           5    Follow WAL: all log records pertaining to a block must be output
                                before the block is output
                    q     Store a pointer to the checkpoint record in a fixed position
                          last_checkpoint on disk
                                                                   ……
                                                               <checkpoint L>
                                                                    …..
                                                               <checkpoint L>
                   last_checkpoint
                                                                    …..

                                                                    Log
Database System Concepts, 1st Ed.                      17.47   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Advanced Rec: Fuzzy Checkpointing
                                  (Cont.)

            s When recovering using a fuzzy checkpoint, start scan from the
                  checkpoint record pointed to by last_checkpoint
                   q    Log records before last_checkpoint have their updates
                        reflected in database on disk, and need not be redone.
                   q    Incomplete checkpoints, where system had crashed while
                        performing checkpoint, are handled safely




Database System Concepts, 1st Ed.                 17.48   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Recovery Algorithm




          Database System Concepts, 1st Ed.
  ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
         See www.vnsispl.com for conditions on re-use
ARIES
            s     ARIES is a state of the art recovery method
                   q     Incorporates numerous optimizations to reduce overheads during
                         normal processing and to speed up recovery
                   q     The “advanced recovery algorithm” we studied earlier is modeled
                         after ARIES, but greatly simplified by removing optimizations
            s     Unlike the advanced recovery algorithm, ARIES
                   q     Uses log sequence number (LSN) to identify log records
                               Stores LSNs in pages to identify what updates have already
                                been applied to a database page
                   2.    Physiological redo
                   3.    Dirty page table to avoid unnecessary redos during recovery
                   4.    Fuzzy checkpointing that only records information about dirty
                         pages, and does not require dirty pages to be written out at
                         checkpoint time
                               More coming up on each of the above …



Database System Concepts, 1st Ed.                      17.50   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Optimizations
            s      Physiological redo
                    q     Affected page is physically identified, action within page can be
                          logical
                               Used to reduce logging overheads
                                – e.g. when a record is deleted and all other records have to be
                                   moved to fill hole
                                    »   Physiological redo can log just the record deletion
                                    »   Physical redo would require logging of old and new values
                                        for much of the page
                               Requires page to be output to disk atomically
                                – Easy to achieve with hardware RAID, also supported by some
                                  disk systems
                                – Incomplete page output can be detected by checksum
                                  techniques,
                                    »   But extra actions are required for recovery
                                    »   Treated as a media failure


Database System Concepts, 1st Ed.                        17.51   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Data Structures
            s ARIES uses several data structures
                    q    Log sequence number (LSN) identifies each log record
                              Must be sequentially increasing
                              Typically an offset from beginning of log file to allow fast access
                                – Easily extended to handle multiple log files
                    q    Page LSN
                    q    Log records of several different types
                    q    Dirty page table




Database System Concepts, 1st Ed.                        17.52   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Data Structures: Page LSN
            s Each page contains a PageLSN which is the LSN of the last log
                  record whose effects are reflected on the page
                   q    To update a page:
                             X-latch the page, and write the log record
                             Update the page
                             Record the LSN of the log record in PageLSN
                             Unlock page
                   q    To flush page to disk, must first S-latch page
                             Thus page state on disk is operation consistent
                                – Required to support physiological redo
                   q    PageLSN is used during recovery to prevent repeated redo
                             Thus ensuring idempotence




Database System Concepts, 1st Ed.                      17.53   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Data Structures: Log Record
     s Each log record contains LSN of previous log record of the same transaction

                             LSN TransID PrevLSN RedoInfo                UndoInfo
            q    LSN in log record may be implicit
     s Special redo-only log record called compensation log record (CLR)
          used to log actions taken during recovery that never need to be undone
            q    Serves the role of operation-abort log records used in advanced recovery
                 algorithm
            q    Has a field UndoNextLSN to note next (earlier) record to be undone
                      Records in between would have already been undone
                      Required to avoid repeated undo of already undone actions

                                    LSN TransID UndoNextLSN RedoInfo

                           1         2    3    4     4'      3'
                                                                               2'        1'

Database System Concepts, 1st Ed.                  17.54   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Data Structures: DirtyPage
                            Table
             s DirtyPageTable
                    q    List of pages in the buffer that have been updated
                    q    Contains, for each such page
                              PageLSN of the page
                              RecLSN is an LSN such that log records before this LSN have
                               already been applied to the page version on disk
                                – Set to current end of log when a page is inserted into dirty
                                  page table (just before being updated)
    Page LSNs
    on disk                     – Recorded in checkpoints, helps to minimize redo work

                                    P1        P6            P23
        P1 16                                                                              Page PLSN RLSN
                                    25        16            19
        …                                                                                  P1    25 17
        P6 12                                                                              P6    16 15
        ..
                                                                                           P23 19 18
        P15 9                       P15
        ..
                                    9
        P23 11                                      Buffer Pool                              DirtyPage Table

Database System Concepts, 1st Ed.                       17.55     ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Data Structures: Checkpoint
                            Log
            s Checkpoint log record
                   q    Contains:
                             DirtyPageTable and list of active transactions
                             For each active transaction, LastLSN, the LSN of the last log
                              record written by the transaction
                   q    Fixed position on disk notes LSN of last completed
                        checkpoint log record
            s Dirty pages are not written out at checkpoint time
                             Instead, they are flushed out continuously, in the background
            s Checkpoint is thus very low overhead
                   q    can be done frequently




Database System Concepts, 1st Ed.                      17.56   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Recovery Algorithm
            ARIES recovery involves three passes
            s Analysis pass: Determines
                    q    Which transactions to undo
                    q    Which pages were dirty (disk version not up to date) at time of crash
                    q    RedoLSN: LSN from which redo should start
            s Redo pass:
                    q    Repeats history, redoing all actions from RedoLSN
                              RecLSN and PageLSNs are used to avoid redoing actions already
                               reflected on page
            s Undo pass:
                    q    Rolls back all incomplete transactions
                              Transactions whose abort was complete earlier are not undone
                                – Key idea: no need to undo these transactions: earlier undo
                                  actions were logged, and are redone as required


Database System Concepts, 1st Ed.                      17.57   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Aries Recovery: 3 Passes
            s Analysis, redo and undo passes
            s Analysis determines where redo should start
            s Undo has to go back till start of earliest incomplete transaction




                                                        Last checkpoint                       End of Log
                                                                                                              Time


        Log                                                                 Analysis pass
                                            Redo pass

                                                                  Undo pass




Database System Concepts, 1st Ed.               17.58       ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Recovery: Analysis

          Analysis pass
          s Starts from last complete checkpoint log record
                 q    Reads DirtyPageTable from log record
                 q    Sets RedoLSN = min of RecLSNs of all pages in DirtyPageTable
                           In case no pages are dirty, RedoLSN = checkpoint record’s
                            LSN
                 q    Sets undo-list = list of transactions in checkpoint log record
                 q    Reads LSN of last log record for each transaction in undo-list from
                      checkpoint log record
          s Scans forward from checkpoint
          s .. Cont. on next page …




Database System Concepts, 1st Ed.                    17.59   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Recovery: Analysis (Cont.)
            Analysis pass (cont.)
            s Scans forward from checkpoint
                    q    If any log record found for transaction not in undo-list, adds
                         transaction to undo-list
                    q    Whenever an update log record is found
                              If page is not in DirtyPageTable, it is added with RecLSN set to
                               LSN of the update log record
                    q    If transaction end log record found, delete transaction from undo-list
                    q    Keeps track of last log record for each transaction in undo-list
                              May be needed for later undo
            s At end of analysis pass:
                    q    RedoLSN determines where to start redo pass
                    q    RecLSN for each page in DirtyPageTable used to minimize redo work
                    q    All transactions in undo-list need to be rolled back


Database System Concepts, 1st Ed.                       17.60   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Redo Pass
            Redo Pass: Repeats history by replaying every action not already
              reflected in the page on disk, as follows:
            s     Scans forward from RedoLSN. Whenever an update log record is
                  found:
                   1.    If the page is not in DirtyPageTable or the LSN of the log record is
                         less than the RecLSN of the page in DirtyPageTable, then skip
                         the log record
                   2.    Otherwise fetch the page from disk. If the PageLSN of the page
                         fetched from disk is less than the LSN of the log record, redo the
                         log record
                   NOTE: if either test is negative the effects of the log record have
                     already appeared on the page. First test avoids even fetching the
                     page from disk!




Database System Concepts, 1st Ed.                    17.61   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES Undo Actions
            s When an undo is performed for an update log record
                    q    Generate a CLR containing the undo action performed (actions
                         performed during undo are logged physicaly or physiologically).
                              CLR for record n noted as n’ in figure below
                    q    Set UndoNextLSN of the CLR to the PrevLSN value of the update log
                         record
                              Arrows indicate UndoNextLSN value
            s ARIES supports partial rollback
                    q    Used e.g. to handle deadlocks by rolling back just enough to release
                         reqd. locks
                    q    Figure indicates forward actions after partial rollbacks
                              records 3 and 4 initially, later 5 and 6, then full rollback
       1          2          3        4       4'       3'           5         6           6'           5' 2'                1'



Database System Concepts, 1st Ed.                           17.62       ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
ARIES: Undo Pass
            Undo pass:
            s Performs backward scan on log undoing all transaction in undo-list
                    q    Backward scan optimized by skipping unneeded log records as follows:
                              Next LSN to be undone for each transaction set to LSN of last log
                               record for transaction found by analysis pass.
                              At each step pick largest of these LSNs to undo, skip back to it and
                               undo it
                              After undoing a log record
                                – For ordinary log records, set next LSN to be undone for
                                  transaction to PrevLSN noted in the log record
                                – For compensation log records (CLRs) set next LSN to be undo to
                                  UndoNextLSN noted in the log record
                                    »   All intervening records are skipped since they would have
                                        been undone already
            s Undos performed as described earlier


Database System Concepts, 1st Ed.                         17.63   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Other ARIES Features
            s Recovery Independence
                    q   Pages can be recovered independently of others
                             E.g. if some disk pages fail they can be recovered from a backup
                              while other pages are being used
            s Savepoints:
                    q   Transactions can record savepoints and roll back to a savepoint
                             Useful for complex transactions
                             Also used to rollback just enough to release locks on deadlock




Database System Concepts, 1st Ed.                      17.64    ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Other ARIES Features (Cont.)
            s Fine-grained locking:
                   q    Index concurrency algorithms that permit tuple level locking on
                        indices can be used
                             These require logical undo, rather than physical undo, as in
                              advanced recovery algorithm
            s Recovery optimizations: For example:
                   q    Dirty page table can be used to prefetch pages during redo
                   q    Out of order redo is possible:
                              redo can be postponed on a page being fetched from disk,
                              and
                               performed when page is fetched.
                             Meanwhile other log records can continue to be processed




Database System Concepts, 1st Ed.                      17.65   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Remote Backup Systems




         Database System Concepts, 1st Ed.
 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
        See www.vnsispl.com for conditions on re-use
Remote Backup Systems
            s Remote backup systems provide high availability by allowing transaction
                  processing to continue even if the primary site is destroyed.




Database System Concepts, 1st Ed.                  17.67   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Remote Backup Systems (Cont.)
            s Detection of failure: Backup site must detect when primary site has
                  failed
                    q    to distinguish primary site failure from link failure maintain several
                         communication links between the primary and the remote backup.
                    q    Heart-beat messages
            s Transfer of control:
                    q    To take over control backup site first perform recovery using its copy
                         of the database and all the long records it has received from the
                         primary.
                               Thus, completed transactions are redone and incomplete
                               transactions are rolled back.
                    q    When the backup site takes over processing it becomes the new
                         primary
                    q    To transfer control back to old primary when it recovers, old primary
                         must receive redo logs from the old backup and apply all updates
                         locally.

Database System Concepts, 1st Ed.                      17.68   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Remote Backup Systems (Cont.)

            s Time to recover: To reduce delay in takeover, backup site periodically
                  proceses the redo log records (in effect, performing recovery from
                  previous database state), performs a checkpoint, and can then delete
                  earlier parts of the log.
            s Hot-Spare configuration permits very fast takeover:
                    q Backup continually processes redo log record as they arrive,
                         applying the updates locally.
                    q When failure of the primary is detected the backup rolls back
                         incomplete transactions, and is ready to process new transactions.
            s Alternative to remote backup: distributed database with replicated data
                    q    Remote backup is faster and cheaper, but less tolerant to failure
                              more on this in Chapter 19




Database System Concepts, 1st Ed.                        17.69   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Remote Backup Systems (Cont.)

            s Ensure durability of updates by delaying transaction commit until update is
                  logged at backup; avoid this delay by permitting lower degrees of durability.
            s One-safe: commit as soon as transaction’s commit log record is written at
                  primary
                    q    Problem: updates may not arrive at backup before it takes over.
            s Two-very-safe: commit when transaction’s commit log record is written
                  at primary and backup
                    q    Reduces availability since transactions cannot commit if either site fails.
            s Two-safe: proceed as in two-very-safe if both primary and backup are
                  active. If only the primary is active, the transaction commits as soon as is
                  commit log record is written at the primary.
                    q    Better availability than two-very-safe; avoids problem of lost
                         transactions in one-safe.




Database System Concepts, 1st Ed.                     17.70   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
End of Chapter




        Database System Concepts, 1st Ed.
©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
       See www.vnsispl.com for conditions on re-use
Shadow Paging
            s Shadow paging is an alternative to log-based recovery; this scheme is
                  useful if transactions execute serially
            s Idea: maintain two page tables during the lifetime of a transaction –the
                  current page table, and the shadow page table
            s Store the shadow page table in nonvolatile storage, such that state of the
                  database prior to transaction execution may be recovered.
                    q    Shadow page table is never modified during execution
            s To start with, both the page tables are identical. Only current page table is
                  used for data item accesses during execution of the transaction.
            s Whenever any page is about to be written for the first time
                    q    A copy of this page is made onto an unused page.
                    q    The current page table is then made to point to the copy
                    q    The update is performed on the copy




Database System Concepts, 1st Ed.                    17.72   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Sample Page Table




Database System Concepts, 1st Ed.          17.73   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Example of Shadow Paging
                         Shadow and current page tables after write to page 4




Database System Concepts, 1st Ed.                   17.74   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Shadow Paging (Cont.)
            s To commit a transaction :
              1. Flush all modified pages in main memory to disk
              2. Output current page table to disk
              3. Make the current page table the new shadow page table, as follows:
                    q    keep a pointer to the shadow page table at a fixed (known) location
                         on disk.
                    q    to make the current page table the new shadow page table, simply
                         update the pointer to point to current page table on disk
            s Once pointer to shadow page table has been written, transaction is
                  committed.
            s No recovery is needed after a crash — new transactions can start right
                  away, using the shadow page table.
            s Pages not pointed to from current/shadow page table should be freed
                  (garbage collected).



Database System Concepts, 1st Ed.                    17.75   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Show Paging (Cont.)
            s Advantages of shadow-paging over log-based schemes
                    q    no overhead of writing log records
                    q    recovery is trivial
            s Disadvantages :
                    q    Copying the entire page table is very expensive
                              Can be reduced by using a page table structured like a B+-tree
                                – No need to copy entire tree, only need to copy paths in the tree
                                  that lead to updated leaf nodes
                    q    Commit overhead is high even with above extension
                              Need to flush every updated page, and page table
                    q    Data gets fragmented (related pages get separated on disk)
                    q    After every transaction completion, the database pages containing old
                         versions of modified data need to be garbage collected
                    q    Hard to extend algorithm to allow transactions to run concurrently
                              Easier to extend log based schemes


Database System Concepts, 1st Ed.                       17.76   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Block Storage Operations




Database System Concepts, 1st Ed.        17.77   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Portion of the Database Log
                                Corresponding to T 0 and T 1




Database System Concepts, 1st Ed.            17.78   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
State of the Log and Database
                          Corresponding to T 0 and T 1




Database System Concepts, 1st Ed.      17.79   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
Portion of the System Log Corresponding
                         to T 0 and T 1




Database System Concepts, 1st Ed.   17.80   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
State of System Log and Database
                        Corresponding to T 0 and T 1




Database System Concepts, 1st Ed.   17.81   ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002

Contenu connexe

Tendances

Ph.D. thesis presentation
Ph.D. thesis presentationPh.D. thesis presentation
Ph.D. thesis presentationdavidkftam
 
VNSISPL_DBMS_Concepts_ch21
VNSISPL_DBMS_Concepts_ch21VNSISPL_DBMS_Concepts_ch21
VNSISPL_DBMS_Concepts_ch21sriprasoon
 
Cache-partitioning
Cache-partitioningCache-partitioning
Cache-partitioningdavidkftam
 
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)npinto
 
ICDE2010 Nb-GCLOCK
ICDE2010 Nb-GCLOCKICDE2010 Nb-GCLOCK
ICDE2010 Nb-GCLOCKMakoto Yui
 
Distributed replicated block device
Distributed replicated block deviceDistributed replicated block device
Distributed replicated block deviceChanaka Lasantha
 
Linux Symposium 2009 Slide Suzaki "Effect of readahead and file system block ...
Linux Symposium 2009 Slide Suzaki "Effect of readahead and file system block ...Linux Symposium 2009 Slide Suzaki "Effect of readahead and file system block ...
Linux Symposium 2009 Slide Suzaki "Effect of readahead and file system block ...Kuniyasu Suzaki
 
Key-value databases in practice Redis @ DotNetToscana
Key-value databases in practice Redis @ DotNetToscanaKey-value databases in practice Redis @ DotNetToscana
Key-value databases in practice Redis @ DotNetToscanaMatteo Baglini
 
Storage virtualisation loughtec
Storage virtualisation   loughtecStorage virtualisation   loughtec
Storage virtualisation loughtecLoughtec
 
Let's Containerize New York with Docker!
Let's Containerize New York with Docker!Let's Containerize New York with Docker!
Let's Containerize New York with Docker!Jérôme Petazzoni
 
Checkpoint/Restore mostly in Userspace
Checkpoint/Restore mostly in UserspaceCheckpoint/Restore mostly in Userspace
Checkpoint/Restore mostly in UserspaceAndrey Vagin
 
Hybrid Columnar Compression in a non-Exadata System
Hybrid Columnar Compression in a non-Exadata SystemHybrid Columnar Compression in a non-Exadata System
Hybrid Columnar Compression in a non-Exadata SystemEnkitec
 
Hpux AdvFS On Disk Structure Scoping
Hpux AdvFS On Disk Structure ScopingHpux AdvFS On Disk Structure Scoping
Hpux AdvFS On Disk Structure ScopingJustin Goldberg
 

Tendances (20)

Ph.D. thesis presentation
Ph.D. thesis presentationPh.D. thesis presentation
Ph.D. thesis presentation
 
os
osos
os
 
VNSISPL_DBMS_Concepts_ch21
VNSISPL_DBMS_Concepts_ch21VNSISPL_DBMS_Concepts_ch21
VNSISPL_DBMS_Concepts_ch21
 
Cache-partitioning
Cache-partitioningCache-partitioning
Cache-partitioning
 
Vx vm
Vx vmVx vm
Vx vm
 
Namespaces in Linux
Namespaces in LinuxNamespaces in Linux
Namespaces in Linux
 
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
IAP09 CUDA@MIT 6.963 - Lecture 04: CUDA Advanced #1 (Nicolas Pinto, MIT)
 
ICDE2010 Nb-GCLOCK
ICDE2010 Nb-GCLOCKICDE2010 Nb-GCLOCK
ICDE2010 Nb-GCLOCK
 
Introduction to visual DSP++ Kernel
Introduction to visual DSP++ KernelIntroduction to visual DSP++ Kernel
Introduction to visual DSP++ Kernel
 
Openstorage Openstack
Openstorage OpenstackOpenstorage Openstack
Openstorage Openstack
 
Distributed replicated block device
Distributed replicated block deviceDistributed replicated block device
Distributed replicated block device
 
Linux Symposium 2009 Slide Suzaki "Effect of readahead and file system block ...
Linux Symposium 2009 Slide Suzaki "Effect of readahead and file system block ...Linux Symposium 2009 Slide Suzaki "Effect of readahead and file system block ...
Linux Symposium 2009 Slide Suzaki "Effect of readahead and file system block ...
 
2337610
23376102337610
2337610
 
Linux admin course
Linux admin courseLinux admin course
Linux admin course
 
Key-value databases in practice Redis @ DotNetToscana
Key-value databases in practice Redis @ DotNetToscanaKey-value databases in practice Redis @ DotNetToscana
Key-value databases in practice Redis @ DotNetToscana
 
Storage virtualisation loughtec
Storage virtualisation   loughtecStorage virtualisation   loughtec
Storage virtualisation loughtec
 
Let's Containerize New York with Docker!
Let's Containerize New York with Docker!Let's Containerize New York with Docker!
Let's Containerize New York with Docker!
 
Checkpoint/Restore mostly in Userspace
Checkpoint/Restore mostly in UserspaceCheckpoint/Restore mostly in Userspace
Checkpoint/Restore mostly in Userspace
 
Hybrid Columnar Compression in a non-Exadata System
Hybrid Columnar Compression in a non-Exadata SystemHybrid Columnar Compression in a non-Exadata System
Hybrid Columnar Compression in a non-Exadata System
 
Hpux AdvFS On Disk Structure Scoping
Hpux AdvFS On Disk Structure ScopingHpux AdvFS On Disk Structure Scoping
Hpux AdvFS On Disk Structure Scoping
 

En vedette (15)

VNSISPL_DBMS_Concepts_ch14
VNSISPL_DBMS_Concepts_ch14VNSISPL_DBMS_Concepts_ch14
VNSISPL_DBMS_Concepts_ch14
 
ch3
ch3ch3
ch3
 
VNSISPL_DBMS_Concepts_ch5
VNSISPL_DBMS_Concepts_ch5VNSISPL_DBMS_Concepts_ch5
VNSISPL_DBMS_Concepts_ch5
 
VNSISPL_DBMS_Concepts_ch6
VNSISPL_DBMS_Concepts_ch6VNSISPL_DBMS_Concepts_ch6
VNSISPL_DBMS_Concepts_ch6
 
Introduction To DBMS
Introduction To DBMSIntroduction To DBMS
Introduction To DBMS
 
VNSISPL_DBMS_Concepts_appA
VNSISPL_DBMS_Concepts_appAVNSISPL_DBMS_Concepts_appA
VNSISPL_DBMS_Concepts_appA
 
VNSISPL_DBMS_Concepts_ch8
VNSISPL_DBMS_Concepts_ch8VNSISPL_DBMS_Concepts_ch8
VNSISPL_DBMS_Concepts_ch8
 
Relational Model
Relational ModelRelational Model
Relational Model
 
ch11
ch11ch11
ch11
 
VNSISPL_DBMS_Concepts_ch22
VNSISPL_DBMS_Concepts_ch22VNSISPL_DBMS_Concepts_ch22
VNSISPL_DBMS_Concepts_ch22
 
ch13
ch13ch13
ch13
 
ch6
ch6ch6
ch6
 
2 database system concepts and architecture
2 database system concepts and architecture2 database system concepts and architecture
2 database system concepts and architecture
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashing
 
Computer Networks & mobile phone
Computer Networks & mobile phoneComputer Networks & mobile phone
Computer Networks & mobile phone
 

Similaire à VNSISPL_DBMS_Concepts_ch17

Recovery Management
Recovery ManagementRecovery Management
Recovery ManagementRam Sekhar
 
VNSISPL_DBMS_Concepts_ch23
VNSISPL_DBMS_Concepts_ch23VNSISPL_DBMS_Concepts_ch23
VNSISPL_DBMS_Concepts_ch23sriprasoon
 
Kubernetes Stateful Workloads on Legacy Storage
Kubernetes Stateful Workloads on Legacy StorageKubernetes Stateful Workloads on Legacy Storage
Kubernetes Stateful Workloads on Legacy StorageAkhil Mohan
 
Achieving Performance Isolation with Lightweight Co-Kernels
Achieving Performance Isolation with Lightweight Co-KernelsAchieving Performance Isolation with Lightweight Co-Kernels
Achieving Performance Isolation with Lightweight Co-KernelsJiannan Ouyang, PhD
 
VNSISPL_DBMS_Concepts_ch15
VNSISPL_DBMS_Concepts_ch15VNSISPL_DBMS_Concepts_ch15
VNSISPL_DBMS_Concepts_ch15sriprasoon
 
Openstorage with OpenStack, by Bradley
Openstorage with OpenStack, by BradleyOpenstorage with OpenStack, by Bradley
Openstorage with OpenStack, by BradleyHui Cheng
 
Pm 01 bradley stone_openstorage_openstack
Pm 01 bradley stone_openstorage_openstackPm 01 bradley stone_openstorage_openstack
Pm 01 bradley stone_openstorage_openstackOpenCity Community
 
2. Vagin. Linux containers. June 01, 2013
2. Vagin. Linux containers. June 01, 20132. Vagin. Linux containers. June 01, 2013
2. Vagin. Linux containers. June 01, 2013ru-fedora-moscow-2013
 
Fedora Virtualization Day: Linux Containers & CRIU
Fedora Virtualization Day: Linux Containers & CRIUFedora Virtualization Day: Linux Containers & CRIU
Fedora Virtualization Day: Linux Containers & CRIUAndrey Vagin
 
Sansymphony v-r9
Sansymphony v-r9Sansymphony v-r9
Sansymphony v-r9TTEC
 
Large-Scale Data Storage and Processing for Scientists with Hadoop
Large-Scale Data Storage and Processing for Scientists with HadoopLarge-Scale Data Storage and Processing for Scientists with Hadoop
Large-Scale Data Storage and Processing for Scientists with HadoopEvert Lammerts
 
An overview of OpenVZ virtualization technology
An overview of OpenVZ virtualization technologyAn overview of OpenVZ virtualization technology
An overview of OpenVZ virtualization technologyOpenVZ
 
An overview of OpenVZ virtualization technology
An overview of OpenVZ virtualization technologyAn overview of OpenVZ virtualization technology
An overview of OpenVZ virtualization technologyOpenVZ
 
Virtualization overheads
Virtualization overheadsVirtualization overheads
Virtualization overheadsSandeep Joshi
 

Similaire à VNSISPL_DBMS_Concepts_ch17 (20)

Recovery Management
Recovery ManagementRecovery Management
Recovery Management
 
VNSISPL_DBMS_Concepts_ch23
VNSISPL_DBMS_Concepts_ch23VNSISPL_DBMS_Concepts_ch23
VNSISPL_DBMS_Concepts_ch23
 
Kubernetes Stateful Workloads on Legacy Storage
Kubernetes Stateful Workloads on Legacy StorageKubernetes Stateful Workloads on Legacy Storage
Kubernetes Stateful Workloads on Legacy Storage
 
OpenVZ Linux Containers
OpenVZ Linux ContainersOpenVZ Linux Containers
OpenVZ Linux Containers
 
Achieving Performance Isolation with Lightweight Co-Kernels
Achieving Performance Isolation with Lightweight Co-KernelsAchieving Performance Isolation with Lightweight Co-Kernels
Achieving Performance Isolation with Lightweight Co-Kernels
 
VNSISPL_DBMS_Concepts_ch15
VNSISPL_DBMS_Concepts_ch15VNSISPL_DBMS_Concepts_ch15
VNSISPL_DBMS_Concepts_ch15
 
Openstorage with OpenStack, by Bradley
Openstorage with OpenStack, by BradleyOpenstorage with OpenStack, by Bradley
Openstorage with OpenStack, by Bradley
 
Pm 01 bradley stone_openstorage_openstack
Pm 01 bradley stone_openstorage_openstackPm 01 bradley stone_openstorage_openstack
Pm 01 bradley stone_openstorage_openstack
 
2. Vagin. Linux containers. June 01, 2013
2. Vagin. Linux containers. June 01, 20132. Vagin. Linux containers. June 01, 2013
2. Vagin. Linux containers. June 01, 2013
 
Fedora Virtualization Day: Linux Containers & CRIU
Fedora Virtualization Day: Linux Containers & CRIUFedora Virtualization Day: Linux Containers & CRIU
Fedora Virtualization Day: Linux Containers & CRIU
 
How swift is your Swift - SD.pptx
How swift is your Swift - SD.pptxHow swift is your Swift - SD.pptx
How swift is your Swift - SD.pptx
 
Top 17 Data Recovery System
Top 17 Data Recovery SystemTop 17 Data Recovery System
Top 17 Data Recovery System
 
Memory
MemoryMemory
Memory
 
Sansymphony v-r9
Sansymphony v-r9Sansymphony v-r9
Sansymphony v-r9
 
Large-Scale Data Storage and Processing for Scientists with Hadoop
Large-Scale Data Storage and Processing for Scientists with HadoopLarge-Scale Data Storage and Processing for Scientists with Hadoop
Large-Scale Data Storage and Processing for Scientists with Hadoop
 
Libra Library OS
Libra Library OSLibra Library OS
Libra Library OS
 
An overview of OpenVZ virtualization technology
An overview of OpenVZ virtualization technologyAn overview of OpenVZ virtualization technology
An overview of OpenVZ virtualization technology
 
An overview of OpenVZ virtualization technology
An overview of OpenVZ virtualization technologyAn overview of OpenVZ virtualization technology
An overview of OpenVZ virtualization technology
 
Ch3-2
Ch3-2Ch3-2
Ch3-2
 
Virtualization overheads
Virtualization overheadsVirtualization overheads
Virtualization overheads
 

Plus de sriprasoon

VNSISPL_DBMS_Concepts_AppB
VNSISPL_DBMS_Concepts_AppBVNSISPL_DBMS_Concepts_AppB
VNSISPL_DBMS_Concepts_AppBsriprasoon
 
VNSISPL_DBMS_Concepts_AppC
VNSISPL_DBMS_Concepts_AppCVNSISPL_DBMS_Concepts_AppC
VNSISPL_DBMS_Concepts_AppCsriprasoon
 
VNSISPL_DBMS_Concepts_ch25
VNSISPL_DBMS_Concepts_ch25VNSISPL_DBMS_Concepts_ch25
VNSISPL_DBMS_Concepts_ch25sriprasoon
 
VNSISPL_DBMS_Concepts_ch24
VNSISPL_DBMS_Concepts_ch24VNSISPL_DBMS_Concepts_ch24
VNSISPL_DBMS_Concepts_ch24sriprasoon
 
VNSISPL_DBMS_Concepts_ch20
VNSISPL_DBMS_Concepts_ch20VNSISPL_DBMS_Concepts_ch20
VNSISPL_DBMS_Concepts_ch20sriprasoon
 
VNSISPL_DBMS_Concepts_ch19
VNSISPL_DBMS_Concepts_ch19VNSISPL_DBMS_Concepts_ch19
VNSISPL_DBMS_Concepts_ch19sriprasoon
 
VNSISPL_DBMS_Concepts_ch18
VNSISPL_DBMS_Concepts_ch18VNSISPL_DBMS_Concepts_ch18
VNSISPL_DBMS_Concepts_ch18sriprasoon
 
VNSISPL_DBMS_Concepts_ch16
VNSISPL_DBMS_Concepts_ch16VNSISPL_DBMS_Concepts_ch16
VNSISPL_DBMS_Concepts_ch16sriprasoon
 
VNSISPL_DBMS_Concepts_ch13
VNSISPL_DBMS_Concepts_ch13VNSISPL_DBMS_Concepts_ch13
VNSISPL_DBMS_Concepts_ch13sriprasoon
 
VNSISPL_DBMS_Concepts_ch12
VNSISPL_DBMS_Concepts_ch12VNSISPL_DBMS_Concepts_ch12
VNSISPL_DBMS_Concepts_ch12sriprasoon
 
VNSISPL_DBMS_Concepts_ch10
VNSISPL_DBMS_Concepts_ch10VNSISPL_DBMS_Concepts_ch10
VNSISPL_DBMS_Concepts_ch10sriprasoon
 
VNSISPL_DBMS_Concepts_ch9
VNSISPL_DBMS_Concepts_ch9VNSISPL_DBMS_Concepts_ch9
VNSISPL_DBMS_Concepts_ch9sriprasoon
 
VNSISPL_DBMS_Concepts_ch7
VNSISPL_DBMS_Concepts_ch7VNSISPL_DBMS_Concepts_ch7
VNSISPL_DBMS_Concepts_ch7sriprasoon
 
VNSISPL_DBMS_Concepts_ch4
VNSISPL_DBMS_Concepts_ch4VNSISPL_DBMS_Concepts_ch4
VNSISPL_DBMS_Concepts_ch4sriprasoon
 
Vnsispl dbms concepts_ch3
Vnsispl dbms concepts_ch3Vnsispl dbms concepts_ch3
Vnsispl dbms concepts_ch3sriprasoon
 
VNSISPL_DBMS_Concepts_ch2
VNSISPL_DBMS_Concepts_ch2VNSISPL_DBMS_Concepts_ch2
VNSISPL_DBMS_Concepts_ch2sriprasoon
 
Vnsispl dbms concepts_ch1
Vnsispl dbms concepts_ch1Vnsispl dbms concepts_ch1
Vnsispl dbms concepts_ch1sriprasoon
 
Inventory Management
Inventory ManagementInventory Management
Inventory Managementsriprasoon
 

Plus de sriprasoon (18)

VNSISPL_DBMS_Concepts_AppB
VNSISPL_DBMS_Concepts_AppBVNSISPL_DBMS_Concepts_AppB
VNSISPL_DBMS_Concepts_AppB
 
VNSISPL_DBMS_Concepts_AppC
VNSISPL_DBMS_Concepts_AppCVNSISPL_DBMS_Concepts_AppC
VNSISPL_DBMS_Concepts_AppC
 
VNSISPL_DBMS_Concepts_ch25
VNSISPL_DBMS_Concepts_ch25VNSISPL_DBMS_Concepts_ch25
VNSISPL_DBMS_Concepts_ch25
 
VNSISPL_DBMS_Concepts_ch24
VNSISPL_DBMS_Concepts_ch24VNSISPL_DBMS_Concepts_ch24
VNSISPL_DBMS_Concepts_ch24
 
VNSISPL_DBMS_Concepts_ch20
VNSISPL_DBMS_Concepts_ch20VNSISPL_DBMS_Concepts_ch20
VNSISPL_DBMS_Concepts_ch20
 
VNSISPL_DBMS_Concepts_ch19
VNSISPL_DBMS_Concepts_ch19VNSISPL_DBMS_Concepts_ch19
VNSISPL_DBMS_Concepts_ch19
 
VNSISPL_DBMS_Concepts_ch18
VNSISPL_DBMS_Concepts_ch18VNSISPL_DBMS_Concepts_ch18
VNSISPL_DBMS_Concepts_ch18
 
VNSISPL_DBMS_Concepts_ch16
VNSISPL_DBMS_Concepts_ch16VNSISPL_DBMS_Concepts_ch16
VNSISPL_DBMS_Concepts_ch16
 
VNSISPL_DBMS_Concepts_ch13
VNSISPL_DBMS_Concepts_ch13VNSISPL_DBMS_Concepts_ch13
VNSISPL_DBMS_Concepts_ch13
 
VNSISPL_DBMS_Concepts_ch12
VNSISPL_DBMS_Concepts_ch12VNSISPL_DBMS_Concepts_ch12
VNSISPL_DBMS_Concepts_ch12
 
VNSISPL_DBMS_Concepts_ch10
VNSISPL_DBMS_Concepts_ch10VNSISPL_DBMS_Concepts_ch10
VNSISPL_DBMS_Concepts_ch10
 
VNSISPL_DBMS_Concepts_ch9
VNSISPL_DBMS_Concepts_ch9VNSISPL_DBMS_Concepts_ch9
VNSISPL_DBMS_Concepts_ch9
 
VNSISPL_DBMS_Concepts_ch7
VNSISPL_DBMS_Concepts_ch7VNSISPL_DBMS_Concepts_ch7
VNSISPL_DBMS_Concepts_ch7
 
VNSISPL_DBMS_Concepts_ch4
VNSISPL_DBMS_Concepts_ch4VNSISPL_DBMS_Concepts_ch4
VNSISPL_DBMS_Concepts_ch4
 
Vnsispl dbms concepts_ch3
Vnsispl dbms concepts_ch3Vnsispl dbms concepts_ch3
Vnsispl dbms concepts_ch3
 
VNSISPL_DBMS_Concepts_ch2
VNSISPL_DBMS_Concepts_ch2VNSISPL_DBMS_Concepts_ch2
VNSISPL_DBMS_Concepts_ch2
 
Vnsispl dbms concepts_ch1
Vnsispl dbms concepts_ch1Vnsispl dbms concepts_ch1
Vnsispl dbms concepts_ch1
 
Inventory Management
Inventory ManagementInventory Management
Inventory Management
 

Dernier

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 

Dernier (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 

VNSISPL_DBMS_Concepts_ch17

  • 1. Chapter 17: Recovery System Database System Concepts, 1st Ed. ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002 See www.vnsispl.com for conditions on re-use
  • 2. Chapter 17: Recovery System s Failure Classification s Storage Structure s Recovery and Atomicity s Log-Based Recovery s Shadow Paging s Recovery With Concurrent Transactions s Buffer Management s Failure with Loss of Nonvolatile Storage s Advanced Recovery Techniques s ARIES Recovery Algorithm s Remote Backup Systems Database System Concepts, 1st Ed. 17.2 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 3. Failure Classification s Transaction failure : q Logical errors: transaction cannot complete due to some internal error condition q System errors: the database system must terminate an active transaction due to an error condition (e.g., deadlock) s System crash: a power failure or other hardware or software failure causes the system to crash. q Fail-stop assumption: non-volatile storage contents are assumed to not be corrupted by system crash  Database systems have numerous integrity checks to prevent corruption of disk data s Disk failure: a head crash or similar disk failure destroys all or part of disk storage q Destruction is assumed to be detectable: disk drives use checksums to detect failures Database System Concepts, 1st Ed. 17.3 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 4. Recovery Algorithms s Recovery algorithms are techniques to ensure database consistency and transaction atomicity and durability despite failures q Focus of this chapter s Recovery algorithms have two parts 1. Actions taken during normal transaction processing to ensure enough information exists to recover from failures 2. Actions taken after a failure to recover the database contents to a state that ensures atomicity, consistency and durability Database System Concepts, 1st Ed. 17.4 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 5. Storage Structure s Volatile storage: q does not survive system crashes q examples: main memory, cache memory s Nonvolatile storage: q survives system crashes q examples: disk, tape, flash memory, non-volatile (battery backed up) RAM s Stable storage: q a mythical form of storage that survives all failures q approximated by maintaining multiple copies on distinct nonvolatile media Database System Concepts, 1st Ed. 17.5 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 6. Stable-Storage Implementation s Maintain multiple copies of each block on separate disks q copies can be at remote sites to protect against disasters such as fire or flooding. s Failure during data transfer can still result in inconsistent copies: Block transfer can result in q Successful completion q Partial failure: destination block has incorrect information q Total failure: destination block was never updated s Protecting storage media from failure during data transfer (one solution): q Execute output operation as follows (assuming two copies of each block): 1. Write the information onto the first physical block. 2. When the first write successfully completes, write the same information onto the second physical block. 3. The output is completed only after the second write successfully completes. Database System Concepts, 1st Ed. 17.6 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 7. Stable-Storage Implementation (Cont.) s Protecting storage media from failure during data transfer (cont.): s Copies of a block may differ due to failure during output operation. To recover from failure: 1. First find inconsistent blocks: Expensive solution: Compare the two copies of every disk block. Better solution: q Record in-progress disk writes on non-volatile storage (Non- volatile RAM or special area of disk). q Use this information during recovery to find blocks that may be inconsistent, and only compare copies of these. q Used in hardware RAID systems 2. If either copy of an inconsistent block is detected to have an error (bad checksum), overwrite it by the other copy. If both have no error, but are different, overwrite the second block by the first block. Database System Concepts, 1st Ed. 17.7 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 8. Data Access s Physical blocks are those blocks residing on the disk. s Buffer blocks are the blocks residing temporarily in main memory. s Block movements between disk and main memory are initiated through the following two operations: q input(B) transfers the physical block B to main memory. q output(B) transfers the buffer block B to the disk, and replaces the appropriate physical block there. s Each transaction Ti has its private work-area in which local copies of all data items accessed and updated by it are kept. q Ti's local copy of a data item X is called xi. s We assume, for simplicity, that each data item fits in, and is stored inside, a single block. Database System Concepts, 1st Ed. 17.8 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 9. Data Access (Cont.) s Transaction transfers data items between system buffer blocks and its private work-area using the following operations : q read(X) assigns the value of data item X to the local variable xi. q write(X) assigns the value of local variable xi to data item {X} in the buffer block. q both these commands may necessitate the issue of an input(BX) instruction before the assignment, if the block BX in which X resides is not already in memory. s Transactions q Perform read(X) while accessing X for the first time; q All subsequent accesses are to the local copy. q After last access, transaction executes write(X). s output(BX) need not immediately follow write(X). System can perform the output operation when it deems fit. Database System Concepts, 1st Ed. 17.9 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 10. Example of Data Access buffer Buffer Block A input(A) X A Buffer Block B Y B output(B) read(X) write(Y) x2 x1 y1 work area work area of T1 of T2 memory disk Database System Concepts, 1st Ed. 17.10 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 11. Recovery and Atomicity s Modifying the database without ensuring that the transaction will commit may leave the database in an inconsistent state. s Consider transaction Ti that transfers $50 from account A to account B; goal is either to perform all database modifications made by Ti or none at all. s Several output operations may be required for Ti (to output A and B). A failure may occur after one of these modifications have been made but before all of them are made. Database System Concepts, 1st Ed. 17.11 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 12. Recovery and Atomicity (Cont.) s To ensure atomicity despite failures, we first output information describing the modifications to stable storage without modifying the database itself. s We study two approaches: q log-based recovery, and q shadow-paging s We assume (initially) that transactions run serially, that is, one after the other. Database System Concepts, 1st Ed. 17.12 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 13. Log-Based Recovery s A log is kept on stable storage. q The log is a sequence of log records, and maintains a record of update activities on the database. s When transaction Ti starts, it registers itself by writing a <Ti start>log record s Before Ti executes write(X), a log record <Ti, X, V1, V2> is written, where V1 is the value of X before the write, and V2 is the value to be written to X. q Log record notes that Ti has performed a write on data item Xj Xj had value V1 before the write, and will have value V2 after the write. s When Ti finishes it last statement, the log record <Ti commit> is written. s We assume for now that log records are written directly to stable storage (that is, they are not buffered) s Two approaches using logs q Deferred database modification q Immediate database modification Database System Concepts, 1st Ed. 17.13 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 14. Deferred Database Modification s The deferred database modification scheme records all modifications to the log, but defers all the writes to after partial commit. s Assume that transactions execute serially s Transaction starts by writing <Ti start> record to log. s A write(X) operation results in a log record <Ti, X, V> being written, where V is the new value for X q Note: old value is not needed for this scheme s The write is not performed on X at this time, but is deferred. s When Ti partially commits, <Ti commit> is written to the log s Finally, the log records are read and used to actually execute the previously deferred writes. Database System Concepts, 1st Ed. 17.14 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 15. Deferred Database Modification (Cont.) s During recovery after a crash, a transaction needs to be redone if and only if both <Ti start> and<Ti commit> are there in the log. s Redoing a transaction Ti ( redoTi) sets the value of all data items updated by the transaction to the new values. s Crashes can occur while q the transaction is executing the original updates, or q while recovery action is being taken s example transactions T0 and T1 (T0 executes before T1): T0: read (A) T1 : read (C) A: - A - 50 C:- C- 100 Write (A) write (C) read (B) B:- B + 50 write (B) Database System Concepts, 1st Ed. 17.15 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 16. Deferred Database Modification (Cont.) s Below we show the log as it appears at three instances of time. s If log on stable storage at time of crash is as in case: (a) No redo actions need to be taken (b) redo(T0) must be performed since <T0 commit> is present (c) redo(T0) must be performed followed by redo(T1) since <T0 commit> and <Ti commit> are present Database System Concepts, 1st Ed. 17.16 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 17. Immediate Database Modification s The immediate database modification scheme allows database updates of an uncommitted transaction to be made as the writes are issued q since undoing may be needed, update logs must have both old value and new value s Update log record must be written before database item is written q We assume that the log record is output directly to stable storage q Can be extended to postpone log record output, so long as prior to execution of an output(B) operation for a data block B, all log records corresponding to items B must be flushed to stable storage s Output of updated blocks can take place at any time before or after transaction commit s Order in which blocks are output can be different from the order in which they are written. Database System Concepts, 1st Ed. 17.17 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 18. Immediate Database Modification Example Log Write Output <T0 start> <T0, A, 1000, 950> To, B, 2000, 2050 A = 950 B = 2050 <T0 commit> <T1 start> <T1, C, 700,x600> 1 C = 600 BB, BC <T1 commit> BA s Note: BX denotes block containing X. Database System Concepts, 1st Ed. 17.18 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 19. Immediate Database Modification (Cont.) s Recovery procedure has two operations instead of one: q undo(Ti) restores the value of all data items updated by Ti to their old values, going backwards from the last log record for Ti q redo(Ti) sets the value of all data items updated by Ti to the new values, going forward from the first log record for Ti s Both operations must be idempotent q That is, even if the operation is executed multiple times the effect is the same as if it is executed once  Needed since operations may get re-executed during recovery s When recovering after failure: q Transaction Ti needs to be undone if the log contains the record <Ti start>, but does not contain the record <Ti commit>. q Transaction Ti needs to be redone if the log contains both the record <Ti start> and the record <Ti commit>. s Undo operations are performed first, then redo operations. Database System Concepts, 1st Ed. 17.19 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 20. Immediate DB Modification Recovery Example Below we show the log as it appears at three instances of time. Recovery actions in each case above are: (a) undo (T0): B is restored to 2000 and A to 1000. (b) undo (T1) and redo (T0): C is restored to 700, and then A and B are set to 950 and 2050 respectively. (c) redo (T0) and redo (T1): A and B are set to 950 and 2050 respectively. Then C is set to 600 Database System Concepts, 1st Ed. 17.20 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 21. Checkpoints s Problems in recovery procedure as discussed earlier : 1. searching the entire log is time-consuming 2. we might unnecessarily redo transactions which have already 3. output their updates to the database. s Streamline recovery procedure by periodically performing checkpointing q Output all log records currently residing in main memory onto stable storage. q Output all modified buffer blocks to the disk. q Write a log record < checkpoint> onto stable storage. Database System Concepts, 1st Ed. 17.21 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 22. Checkpoints (Cont.) s During recovery we need to consider only the most recent transaction Ti that started before the checkpoint, and transactions that started after Ti. q Scan backwards from end of log to find the most recent <checkpoint> record q Continue scanning backwards till a record <Ti start> is found. q Need only consider the part of log following above start record. Earlier part of log can be ignored during recovery, and can be erased whenever desired. q For all transactions (starting from Ti or later) with no <Ti commit>, execute undo(Ti). (Done only in case of immediate modification.) q Scanning forward in the log, for all transactions starting from Ti or later with a <Ti commit>, execute redo(Ti). Database System Concepts, 1st Ed. 17.22 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 23. Example of Checkpoints Tc Tf T1 T2 T3 T4 checkpoint system failure s T1 can be ignored (updates already output to disk due to checkpoint) s T2 and T3 redone. s T4 undone Database System Concepts, 1st Ed. 17.23 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 24. Recovery With Concurrent Transactions s We modify the log-based recovery schemes to allow multiple transactions to execute concurrently. q All transactions share a single disk buffer and a single log q A buffer block can have data items updated by one or more transactions s We assume concurrency control using strict two-phase locking; q i.e. the updates of uncommitted transactions should not be visible to other transactions  Otherwise how to perform undo if T1 updates A, then T2 updates A and commits, and finally T1 has to abort? s Logging is done as described earlier. q Log records of different transactions may be interspersed in the log. s The checkpointing technique and actions taken on recovery have to be changed q since several transactions may be active when a checkpoint is performed. Database System Concepts, 1st Ed. 17.24 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 25. Recovery With Concurrent Transactions (Cont.) s Checkpoints are performed as before, except that the checkpoint log record is now of the form < checkpoint L> where L is the list of transactions active at the time of the checkpoint q We assume no updates are in progress while the checkpoint is carried out (will relax this later) s When the system recovers from a crash, it first does the following: q Initialize undo-list and redo-list to empty q Scan the log backwards from the end, stopping when the first <checkpoint L> record is found. For each record found during the backward scan: 5 if the record is <Ti commit>, add Ti to redo-list if the record is <Ti start>, then if Ti is not in redo-list, add Ti to 5 undo-list q For every Ti in L, if Ti is not in redo-list, add Ti to undo-list Database System Concepts, 1st Ed. 17.25 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 26. Recovery With Concurrent Transactions (Cont.) s At this point undo-list consists of incomplete transactions which must be undone, and redo-list consists of finished transactions that must be redone. s Recovery now continues as follows: q Scan log backwards from most recent record, stopping when <Ti start> records have been encountered for every Ti in undo- list. s During the scan, perform undo for each log record that belongs to a transaction in undo-list. q Locate the most recent <checkpoint L> record. q Scan log forwards from the <checkpoint L> record till the end of the log. s During the scan, perform redo for each log record that belongs to a transaction on redo-list Database System Concepts, 1st Ed. 17.26 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 27. Example of Recovery s Go over the steps of the recovery algorithm on the following log: <T0 start> <T0, A, 0, 10> <T0 commit> <T1 start> /* Scan at step 1 comes up to here */ <T1, B, 0, 10> <T2 start> <T2, C, 0, 10> <T2, C, 10, 20> <checkpoint {T1, T2}> <T3 start> <T3, A, 10, 20> <T3, D, 0, 10> <T3 commit> Database System Concepts, 1st Ed. 17.27 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 28. Log Record Buffering s Log record buffering: log records are buffered in main memory, instead of of being output directly to stable storage. q Log records are output to stable storage when a block of log records in the buffer is full, or a log force operation is executed. s Log force is performed to commit a transaction by forcing all its log records (including the commit record) to stable storage. s Several log records can thus be output using a single output operation, reducing the I/O cost. Database System Concepts, 1st Ed. 17.28 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 29. Log Record Buffering (Cont.) s The rules below must be followed if log records are buffered: q Log records are output to stable storage in the order in which they are created. q Transaction Ti enters the commit state only when the log record <Ti commit> has been output to stable storage. q Before a block of data in main memory is output to the database, all log records pertaining to data in that block must have been output to stable storage.  This rule is called the write-ahead logging or WAL rule – Strictly speaking WAL only requires undo information to be output Database System Concepts, 1st Ed. 17.29 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 30. Database Buffering s Database maintains an in-memory buffer of data blocks q When a new block is needed, if buffer is full an existing block needs to be removed from buffer q If the block chosen for removal has been updated, it must be output to disk s If a block with uncommitted updates is output to disk, log records with undo information for the updates are output to the log on stable storage first q (Write ahead logging) s No updates should be in progress on a block when it is output to disk. Can be ensured as follows. q Before writing a data item, transaction acquires exclusive lock on block containing the data item q Lock can be released once the write is completed.  Such locks held for short duration are called latches. q Before a block is output to disk, the system acquires an exclusive latch on the block  Ensures no update can be in progress on the block Database System Concepts, 1st Ed. 17.30 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 31. Buffer Management (Cont.) s Database buffer can be implemented either q in an area of real main-memory reserved for the database, or q in virtual memory s Implementing buffer in reserved main-memory has drawbacks: q Memory is partitioned before-hand between database buffer and applications, limiting flexibility. q Needs may change, and although operating system knows best how memory should be divided up at any time, it cannot change the partitioning of memory. Database System Concepts, 1st Ed. 17.31 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 32. Buffer Management (Cont.) s Database buffers are generally implemented in virtual memory in spite of some drawbacks: q When operating system needs to evict a page that has been modified, the page is written to swap space on disk. q When database decides to write buffer page to disk, buffer page may be in swap space, and may have to be read from swap space on disk and output to the database on disk, resulting in extra I/O!  Known as dual paging problem. q Ideally when OS needs to evict a page from the buffer, it should pass control to database, which in turn should 1. Output the page to database instead of to swap space (making sure to output log records first), if it is modified 2. Release the page from the buffer, for the OS to use Dual paging can thus be avoided, but common operating systems do not support such functionality. Database System Concepts, 1st Ed. 17.32 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 33. Failure with Loss of Nonvolatile Storage s So far we assumed no loss of non-volatile storage s Technique similar to checkpointing used to deal with loss of non- volatile storage q Periodically dump the entire content of the database to stable storage q No transaction may be active during the dump procedure; a procedure similar to checkpointing must take place  Output all log records currently residing in main memory onto stable storage.  Output all buffer blocks onto the disk.  Copy the contents of the database to stable storage.  Output a record <dump> to log on stable storage. Database System Concepts, 1st Ed. 17.33 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 34. Recovering from Failure of Non-Volatile Storage s To recover from disk failure q restore database from most recent dump. q Consult the log and redo all transactions that committed after the dump s Can be extended to allow transactions to be active during dump; known as fuzzy dump or online dump q Will study fuzzy checkpointing later Database System Concepts, 1st Ed. 17.34 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 35. Advanced Recovery Algorithm Database System Concepts, 1st Ed. ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002 See www.vnsispl.com for conditions on re-use
  • 36. Advanced Recovery: Key Features s Support for high-concurrency locking techniques, such as those used for B+-tree concurrency control, which release locks early q Supports “logical undo” s Recovery based on “repeating history”, whereby recovery executes exactly the same actions as normal processing q including redo of log records of incomplete transactions, followed by subsequent undo q Key benefits  supports logical undo  easier to understand/show correctness Database System Concepts, 1st Ed. 17.36 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 37. Advanced Recovery: Logical Undo Logging s Operations like B+-tree insertions and deletions release locks early. q They cannot be undone by restoring old values (physical undo), since once a lock is released, other transactions may have updated the B+-tree. q Instead, insertions (resp. deletions) are undone by executing a deletion (resp. insertion) operation (known as logical undo). s For such operations, undo log records should contain the undo operation to be executed q Such logging is called logical undo logging, in contrast to physical undo logging  Operations are called logical operations q Other examples:  delete of tuple, to undo insert of tuple – allows early lock release on space allocation information  subtract amount deposited, to undo deposit – allows early lock release on bank balance Database System Concepts, 1st Ed. 17.37 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 38. Advanced Recovery: Physical Redo s Redo information is logged physically (that is, new value for each write) even for operations with logical undo q Logical redo is very complicated since database state on disk may not be “operation consistent” when recovery starts q Physical redo logging does not conflict with early lock release Database System Concepts, 1st Ed. 17.38 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 39. Advanced Recovery: Operation Logging s Operation logging is done as follows: q When operation starts, log <Ti, Oj, operation-begin>. Here Oj is a unique identifier of the operation instance. q While operation is executing, normal log records with physical redo and physical undo information are logged. q When operation completes, <Ti, Oj, operation-end, U> is logged, where U contains information needed to perform a logical undo information. Example: insert of (key, record-id) pair (K5, RID7) into index I9 <T1, O1, operation-begin> …. <T1, X, 10, K5> Physical redo of steps in insert <T1, Y, 45, RID7> <T1, O1, operation-end, (delete I9, K5, RID7)> Database System Concepts, 1st Ed. 17.39 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 40. Advanced Recovery: Operation Logging (Cont.) s If crash/rollback occurs before operation completes: q the operation-end log record is not found, and q the physical undo information is used to undo operation. s If crash/rollback occurs after the operation completes: q the operation-end log record is found, and in this case q logical undo is performed using U; the physical undo information for the operation is ignored. s Redo of operation (after crash) still uses physical redo information. Database System Concepts, 1st Ed. 17.40 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 41. Advanced Recovery: Txn Rollback Rollback of transaction Ti is done as follows: s Scan the log backwards q If a log record <Ti, X, V1, V2> is found, perform the undo and log a special redo-only log record <Ti, X, V1>. q If a <Ti, Oj, operation-end, U> record is found  Rollback the operation logically using the undo information U. – Updates performed during roll back are logged just like during normal operation execution. – At the end of the operation rollback, instead of logging an operation-end record, generate a record <Ti, Oj, operation-abort>.  Skip all preceding log records for Ti until the record <Ti, Oj operation-begin> is found Database System Concepts, 1st Ed. 17.41 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 42. Advanced Recovery: Txn Rollback (Cont.) s Scan the log backwards (cont.): q If a redo-only record is found ignore it q If a <Ti, Oj, operation-abort> record is found: 5 skip all preceding log records for Ti until the record <Ti, Oj, operation-begin> is found. q Stop the scan when the record <Ti, start> is found q Add a <Ti, abort> record to the log Some points to note: s Cases 3 and 4 above can occur only if the database crashes while a transaction is being rolled back. s Skipping of log records as in case 4 is important to prevent multiple rollback of the same operation. Database System Concepts, 1st Ed. 17.42 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 43. Advanced Recovery: Txn Rollback Example s Example with a complete and an incomplete operation <T1, start> <T1, O1, operation-begin> …. <T1, X, 10, K5> <T1, Y, 45, RID7> <T1, O1, operation-end, (delete I9, K5, RID7)> <T1, O2, operation-begin> <T1, Z, 45, 70>  T1 Rollback begins here <T1, Z, 45>  redo-only log record during physical undo (of incomplete O2) <T1, Y, .., ..>  Normal redo records for logical undo of O1 … <T1, O1, operation-abort>  What if crash occurred immediately after this? <T1, abort> Database System Concepts, 1st Ed. 17.43 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 44. Advanced Recovery: Crash Recovery The following actions are taken when recovering from system crash s (Redo phase): Scan log forward from last < checkpoint L> record till end of log q Repeat history by physically redoing all updates of all transactions, q Create an undo-list during the scan as follows  undo-list is set to L initially  Whenever <Ti start> is found Ti is added to undo-list  Whenever <Ti commit> or <Ti abort> is found, Ti is deleted from undo-list This brings database to state as of crash, with committed as well as uncommitted transactions having been redone. Now undo-list contains transactions that are incomplete, that is, have neither committed nor been fully rolled back. Database System Concepts, 1st Ed. 17.44 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 45. Advanced Recovery: Crash Recovery (Cont.) Recovery from system crash (cont.) s (Undo phase): Scan log backwards, performing undo on log records of transactions found in undo-list. q Log records of transactions being rolled back are processed as described earlier, as they are found  Single shared scan for all transactions being undone q When <Ti start> is found for a transaction Ti in undo-list, write a <Ti abort> log record. q Stop scan when <Ti start> records have been found for all Ti in undo-list s This undoes the effects of incomplete transactions (those with neither commit nor abort log records). Recovery is now complete. Database System Concepts, 1st Ed. 17.45 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 46. Advanced Recovery: Checkpointing s Checkpointing is done as follows: q Output all log records in memory to stable storage q Output to disk all modified buffer blocks q Output to log on stable storage a < checkpoint L> record. Transactions are not allowed to perform any actions while checkpointing is in progress. s Fuzzy checkpointing allows transactions to progress while the most time consuming parts of checkpointing are in progress q Performed as described on next slide Database System Concepts, 1st Ed. 17.46 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 47. Advanced Recovery: Fuzzy Checkpointing s Fuzzy checkpointing is done as follows: q Temporarily stop all updates by transactions q Write a <checkpoint L> log record and force log to stable storage q Note list M of modified buffer blocks q Now permit transactions to proceed with their actions q Output to disk all modified buffer blocks in list M 5 blocks should not be updated while being output 5 Follow WAL: all log records pertaining to a block must be output before the block is output q Store a pointer to the checkpoint record in a fixed position last_checkpoint on disk …… <checkpoint L> ….. <checkpoint L> last_checkpoint ….. Log Database System Concepts, 1st Ed. 17.47 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 48. Advanced Rec: Fuzzy Checkpointing (Cont.) s When recovering using a fuzzy checkpoint, start scan from the checkpoint record pointed to by last_checkpoint q Log records before last_checkpoint have their updates reflected in database on disk, and need not be redone. q Incomplete checkpoints, where system had crashed while performing checkpoint, are handled safely Database System Concepts, 1st Ed. 17.48 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 49. ARIES Recovery Algorithm Database System Concepts, 1st Ed. ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002 See www.vnsispl.com for conditions on re-use
  • 50. ARIES s ARIES is a state of the art recovery method q Incorporates numerous optimizations to reduce overheads during normal processing and to speed up recovery q The “advanced recovery algorithm” we studied earlier is modeled after ARIES, but greatly simplified by removing optimizations s Unlike the advanced recovery algorithm, ARIES q Uses log sequence number (LSN) to identify log records  Stores LSNs in pages to identify what updates have already been applied to a database page 2. Physiological redo 3. Dirty page table to avoid unnecessary redos during recovery 4. Fuzzy checkpointing that only records information about dirty pages, and does not require dirty pages to be written out at checkpoint time  More coming up on each of the above … Database System Concepts, 1st Ed. 17.50 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 51. ARIES Optimizations s Physiological redo q Affected page is physically identified, action within page can be logical  Used to reduce logging overheads – e.g. when a record is deleted and all other records have to be moved to fill hole » Physiological redo can log just the record deletion » Physical redo would require logging of old and new values for much of the page  Requires page to be output to disk atomically – Easy to achieve with hardware RAID, also supported by some disk systems – Incomplete page output can be detected by checksum techniques, » But extra actions are required for recovery » Treated as a media failure Database System Concepts, 1st Ed. 17.51 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 52. ARIES Data Structures s ARIES uses several data structures q Log sequence number (LSN) identifies each log record  Must be sequentially increasing  Typically an offset from beginning of log file to allow fast access – Easily extended to handle multiple log files q Page LSN q Log records of several different types q Dirty page table Database System Concepts, 1st Ed. 17.52 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 53. ARIES Data Structures: Page LSN s Each page contains a PageLSN which is the LSN of the last log record whose effects are reflected on the page q To update a page:  X-latch the page, and write the log record  Update the page  Record the LSN of the log record in PageLSN  Unlock page q To flush page to disk, must first S-latch page  Thus page state on disk is operation consistent – Required to support physiological redo q PageLSN is used during recovery to prevent repeated redo  Thus ensuring idempotence Database System Concepts, 1st Ed. 17.53 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 54. ARIES Data Structures: Log Record s Each log record contains LSN of previous log record of the same transaction LSN TransID PrevLSN RedoInfo UndoInfo q LSN in log record may be implicit s Special redo-only log record called compensation log record (CLR) used to log actions taken during recovery that never need to be undone q Serves the role of operation-abort log records used in advanced recovery algorithm q Has a field UndoNextLSN to note next (earlier) record to be undone  Records in between would have already been undone  Required to avoid repeated undo of already undone actions LSN TransID UndoNextLSN RedoInfo 1 2 3 4 4' 3' 2' 1' Database System Concepts, 1st Ed. 17.54 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 55. ARIES Data Structures: DirtyPage Table s DirtyPageTable q List of pages in the buffer that have been updated q Contains, for each such page  PageLSN of the page  RecLSN is an LSN such that log records before this LSN have already been applied to the page version on disk – Set to current end of log when a page is inserted into dirty page table (just before being updated) Page LSNs on disk – Recorded in checkpoints, helps to minimize redo work P1 P6 P23 P1 16 Page PLSN RLSN 25 16 19 … P1 25 17 P6 12 P6 16 15 .. P23 19 18 P15 9 P15 .. 9 P23 11 Buffer Pool DirtyPage Table Database System Concepts, 1st Ed. 17.55 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 56. ARIES Data Structures: Checkpoint Log s Checkpoint log record q Contains:  DirtyPageTable and list of active transactions  For each active transaction, LastLSN, the LSN of the last log record written by the transaction q Fixed position on disk notes LSN of last completed checkpoint log record s Dirty pages are not written out at checkpoint time  Instead, they are flushed out continuously, in the background s Checkpoint is thus very low overhead q can be done frequently Database System Concepts, 1st Ed. 17.56 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 57. ARIES Recovery Algorithm ARIES recovery involves three passes s Analysis pass: Determines q Which transactions to undo q Which pages were dirty (disk version not up to date) at time of crash q RedoLSN: LSN from which redo should start s Redo pass: q Repeats history, redoing all actions from RedoLSN  RecLSN and PageLSNs are used to avoid redoing actions already reflected on page s Undo pass: q Rolls back all incomplete transactions  Transactions whose abort was complete earlier are not undone – Key idea: no need to undo these transactions: earlier undo actions were logged, and are redone as required Database System Concepts, 1st Ed. 17.57 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 58. Aries Recovery: 3 Passes s Analysis, redo and undo passes s Analysis determines where redo should start s Undo has to go back till start of earliest incomplete transaction Last checkpoint End of Log Time Log Analysis pass Redo pass Undo pass Database System Concepts, 1st Ed. 17.58 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 59. ARIES Recovery: Analysis Analysis pass s Starts from last complete checkpoint log record q Reads DirtyPageTable from log record q Sets RedoLSN = min of RecLSNs of all pages in DirtyPageTable  In case no pages are dirty, RedoLSN = checkpoint record’s LSN q Sets undo-list = list of transactions in checkpoint log record q Reads LSN of last log record for each transaction in undo-list from checkpoint log record s Scans forward from checkpoint s .. Cont. on next page … Database System Concepts, 1st Ed. 17.59 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 60. ARIES Recovery: Analysis (Cont.) Analysis pass (cont.) s Scans forward from checkpoint q If any log record found for transaction not in undo-list, adds transaction to undo-list q Whenever an update log record is found  If page is not in DirtyPageTable, it is added with RecLSN set to LSN of the update log record q If transaction end log record found, delete transaction from undo-list q Keeps track of last log record for each transaction in undo-list  May be needed for later undo s At end of analysis pass: q RedoLSN determines where to start redo pass q RecLSN for each page in DirtyPageTable used to minimize redo work q All transactions in undo-list need to be rolled back Database System Concepts, 1st Ed. 17.60 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 61. ARIES Redo Pass Redo Pass: Repeats history by replaying every action not already reflected in the page on disk, as follows: s Scans forward from RedoLSN. Whenever an update log record is found: 1. If the page is not in DirtyPageTable or the LSN of the log record is less than the RecLSN of the page in DirtyPageTable, then skip the log record 2. Otherwise fetch the page from disk. If the PageLSN of the page fetched from disk is less than the LSN of the log record, redo the log record NOTE: if either test is negative the effects of the log record have already appeared on the page. First test avoids even fetching the page from disk! Database System Concepts, 1st Ed. 17.61 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 62. ARIES Undo Actions s When an undo is performed for an update log record q Generate a CLR containing the undo action performed (actions performed during undo are logged physicaly or physiologically).  CLR for record n noted as n’ in figure below q Set UndoNextLSN of the CLR to the PrevLSN value of the update log record  Arrows indicate UndoNextLSN value s ARIES supports partial rollback q Used e.g. to handle deadlocks by rolling back just enough to release reqd. locks q Figure indicates forward actions after partial rollbacks  records 3 and 4 initially, later 5 and 6, then full rollback 1 2 3 4 4' 3' 5 6 6' 5' 2' 1' Database System Concepts, 1st Ed. 17.62 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 63. ARIES: Undo Pass Undo pass: s Performs backward scan on log undoing all transaction in undo-list q Backward scan optimized by skipping unneeded log records as follows:  Next LSN to be undone for each transaction set to LSN of last log record for transaction found by analysis pass.  At each step pick largest of these LSNs to undo, skip back to it and undo it  After undoing a log record – For ordinary log records, set next LSN to be undone for transaction to PrevLSN noted in the log record – For compensation log records (CLRs) set next LSN to be undo to UndoNextLSN noted in the log record » All intervening records are skipped since they would have been undone already s Undos performed as described earlier Database System Concepts, 1st Ed. 17.63 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 64. Other ARIES Features s Recovery Independence q Pages can be recovered independently of others  E.g. if some disk pages fail they can be recovered from a backup while other pages are being used s Savepoints: q Transactions can record savepoints and roll back to a savepoint  Useful for complex transactions  Also used to rollback just enough to release locks on deadlock Database System Concepts, 1st Ed. 17.64 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 65. Other ARIES Features (Cont.) s Fine-grained locking: q Index concurrency algorithms that permit tuple level locking on indices can be used  These require logical undo, rather than physical undo, as in advanced recovery algorithm s Recovery optimizations: For example: q Dirty page table can be used to prefetch pages during redo q Out of order redo is possible:  redo can be postponed on a page being fetched from disk, and performed when page is fetched.  Meanwhile other log records can continue to be processed Database System Concepts, 1st Ed. 17.65 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 66. Remote Backup Systems Database System Concepts, 1st Ed. ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002 See www.vnsispl.com for conditions on re-use
  • 67. Remote Backup Systems s Remote backup systems provide high availability by allowing transaction processing to continue even if the primary site is destroyed. Database System Concepts, 1st Ed. 17.67 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 68. Remote Backup Systems (Cont.) s Detection of failure: Backup site must detect when primary site has failed q to distinguish primary site failure from link failure maintain several communication links between the primary and the remote backup. q Heart-beat messages s Transfer of control: q To take over control backup site first perform recovery using its copy of the database and all the long records it has received from the primary.  Thus, completed transactions are redone and incomplete transactions are rolled back. q When the backup site takes over processing it becomes the new primary q To transfer control back to old primary when it recovers, old primary must receive redo logs from the old backup and apply all updates locally. Database System Concepts, 1st Ed. 17.68 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 69. Remote Backup Systems (Cont.) s Time to recover: To reduce delay in takeover, backup site periodically proceses the redo log records (in effect, performing recovery from previous database state), performs a checkpoint, and can then delete earlier parts of the log. s Hot-Spare configuration permits very fast takeover: q Backup continually processes redo log record as they arrive, applying the updates locally. q When failure of the primary is detected the backup rolls back incomplete transactions, and is ready to process new transactions. s Alternative to remote backup: distributed database with replicated data q Remote backup is faster and cheaper, but less tolerant to failure  more on this in Chapter 19 Database System Concepts, 1st Ed. 17.69 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 70. Remote Backup Systems (Cont.) s Ensure durability of updates by delaying transaction commit until update is logged at backup; avoid this delay by permitting lower degrees of durability. s One-safe: commit as soon as transaction’s commit log record is written at primary q Problem: updates may not arrive at backup before it takes over. s Two-very-safe: commit when transaction’s commit log record is written at primary and backup q Reduces availability since transactions cannot commit if either site fails. s Two-safe: proceed as in two-very-safe if both primary and backup are active. If only the primary is active, the transaction commits as soon as is commit log record is written at the primary. q Better availability than two-very-safe; avoids problem of lost transactions in one-safe. Database System Concepts, 1st Ed. 17.70 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 71. End of Chapter Database System Concepts, 1st Ed. ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002 See www.vnsispl.com for conditions on re-use
  • 72. Shadow Paging s Shadow paging is an alternative to log-based recovery; this scheme is useful if transactions execute serially s Idea: maintain two page tables during the lifetime of a transaction –the current page table, and the shadow page table s Store the shadow page table in nonvolatile storage, such that state of the database prior to transaction execution may be recovered. q Shadow page table is never modified during execution s To start with, both the page tables are identical. Only current page table is used for data item accesses during execution of the transaction. s Whenever any page is about to be written for the first time q A copy of this page is made onto an unused page. q The current page table is then made to point to the copy q The update is performed on the copy Database System Concepts, 1st Ed. 17.72 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 73. Sample Page Table Database System Concepts, 1st Ed. 17.73 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 74. Example of Shadow Paging Shadow and current page tables after write to page 4 Database System Concepts, 1st Ed. 17.74 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 75. Shadow Paging (Cont.) s To commit a transaction : 1. Flush all modified pages in main memory to disk 2. Output current page table to disk 3. Make the current page table the new shadow page table, as follows: q keep a pointer to the shadow page table at a fixed (known) location on disk. q to make the current page table the new shadow page table, simply update the pointer to point to current page table on disk s Once pointer to shadow page table has been written, transaction is committed. s No recovery is needed after a crash — new transactions can start right away, using the shadow page table. s Pages not pointed to from current/shadow page table should be freed (garbage collected). Database System Concepts, 1st Ed. 17.75 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 76. Show Paging (Cont.) s Advantages of shadow-paging over log-based schemes q no overhead of writing log records q recovery is trivial s Disadvantages : q Copying the entire page table is very expensive  Can be reduced by using a page table structured like a B+-tree – No need to copy entire tree, only need to copy paths in the tree that lead to updated leaf nodes q Commit overhead is high even with above extension  Need to flush every updated page, and page table q Data gets fragmented (related pages get separated on disk) q After every transaction completion, the database pages containing old versions of modified data need to be garbage collected q Hard to extend algorithm to allow transactions to run concurrently  Easier to extend log based schemes Database System Concepts, 1st Ed. 17.76 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 77. Block Storage Operations Database System Concepts, 1st Ed. 17.77 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 78. Portion of the Database Log Corresponding to T 0 and T 1 Database System Concepts, 1st Ed. 17.78 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 79. State of the Log and Database Corresponding to T 0 and T 1 Database System Concepts, 1st Ed. 17.79 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 80. Portion of the System Log Corresponding to T 0 and T 1 Database System Concepts, 1st Ed. 17.80 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002
  • 81. State of System Log and Database Corresponding to T 0 and T 1 Database System Concepts, 1st Ed. 17.81 ©VNS InfoSolutions Private Limited, Varanasi(UP), India 221002