Here's a patch to the wal.sgml text to take acocunt of Vadim's
explanations.


*** wal.sgml.orig	Wed Jan 24 21:55:56 2001
--- wal.sgml	Wed Jan 24 22:08:44 2001
***************
*** 149,154 ****
--- 149,176 ----
  </Sect1>
  
  
+ <Sect1 id="recovery">
+ <Title>Database Recovery with WAL</Title>
+ 
+ <Para>
+ After a checkpoint has been made and the log flushed, the checkpoint's
+ position is saved in <Filename>pg_control</Filename>. Therefore, when
+ recovery is to be done, the backend first reads
+ <Filename>pg_control</Filename>, and then the checkpoint record; next it
+ reads the redo record, whose position is saved in the checkpoint, and
+ begins the REDO operation.  Because the entire content of the
+ pages is saved in the log on the first page modification after a
+ checkpoint, the pages will be first restored to a consistent state.
+ 
+ Using <Filename>pg_control</Filename> to get the checkpoint position speeds
+ up the recovery process, but to handle possible corruption of
+ <Filename>pg_control</Filename>, we should actually
+ implement the reading of existing log segments in reverse order -- newest
+ to oldest -- in order to find the last checkpoint.  This has not yet been
+ done at release 7.1.
+ </Para>
+ </Sect1>
+ 
    
  <Sect1 id="WAL-parameters">
  <Title>WAL parameters</Title>
***************
*** 187,196 ****
  what record in the log (known as the redo record) it should start the
  REDO operation, since any changes made to data files before that record
  are already on disk. After a checkpoint has been made, any log segments
! written before the redo record may be removed/archived, so checkpoints
! are used to free disk space in the WAL directory. The checkpoint maker
! is also able to create a few log segments for future use, so as to avoid
! the need for <Function>LogInsert</Function> or <Function>LogFlush</Function> to spend time in creating them.
  </Para>
  
  <Para>
--- 209,220 ----
  what record in the log (known as the redo record) it should start the
  REDO operation, since any changes made to data files before that record
  are already on disk. After a checkpoint has been made, any log segments
! written before the redo record are automatically removed, so checkpoints
! are used to free disk space in the WAL directory.  Once WAL-based BAR
! is implemented, the log segments can be archived instead of just being
! removed.  The checkpoint maker is also able to create a few log segments
! for future use, so as to avoid the need for <Function>LogInsert</Function>
! or <Function>LogFlush</Function> to spend time in creating them.
  </Para>
  
  <Para>
Oliver Elphick                                [EMAIL PROTECTED]
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "If anyone has material possessions and sees his
      brother in need but has no pity on him, how can the
      love of God be in him?"
                                    I John 3:17 

Reply via email to