• Heikki Linnakangas's avatar
    Keep timeline history files restored from archive in pg_xlog. · 60df192a
    Heikki Linnakangas authored
    The cascading standby patch in 9.2 changed the way WAL files are treated
    when restored from the archive. Before, they were restored under a temporary
    filename, and not kept in pg_xlog, but after the patch, they were copied
    under pg_xlog. This is necessary for a cascading standby to find them, but
    it also means that if the archive goes offline and a standby is restarted,
    it can recover back to where it was using the files in pg_xlog. It also
    means that if you take an offline backup from a standby server, it includes
    all the required WAL files in pg_xlog.
    
    However, the same change was not made to timeline history files, so if the
    WAL segment containing the checkpoint record contains a timeline switch, you
    will still get an error if you try to restart recovery without the archive,
    or recover from an offline backup taken from the standby.
    
    With this patch, timeline history files restored from archive are copied
    into pg_xlog like WAL files are, so that pg_xlog contains all the files
    required to recover. This is a corner-case pre-existing issue in 9.2, but
    even more important in master where it's possible for a standby to follow a
    timeline switch through streaming replication. To make that possible, the
    timeline history files must be present in pg_xlog.
    60df192a
xlog_internal.h 8.97 KB