• Heikki Linnakangas's avatar
    Delay reading timeline history file until it's fetched from master. · ee994272
    Heikki Linnakangas authored
    Streaming replication can fetch any missing timeline history files from the
    master, but recovery would read the timeline history file for the target
    timeline before reading the checkpoint record, and before walreceiver has
    had a chance to fetch it from the master. Delay reading it, and the sanity
    checks involving timeline history, until after reading the checkpoint
    record.
    
    There is at least one scenario where this makes a difference: if you take
    a base backup from a standby server right after a timeline switch, the
    WAL segment containing the initial checkpoint record will begin with an
    older timeline ID. Without the timeline history file, recovering that file
    will fail as the older timeline ID is not recognized to be an ancestor of
    the target timeline. If you try to recover from such a backup, using only
    streaming replication to fetch the WAL, this patch is required for that to
    work.
    ee994272
walreceiver.c 32.9 KB